Package com.asakusafw.compiler.operator.ExecutableAnalyzer

Examples of com.asakusafw.compiler.operator.ExecutableAnalyzer.TypeConstraint


                parameters);
    }

    private OperatorPortDeclaration analyzePort(
            ExecutableAnalyzer analyzer, int index) {
        TypeConstraint type = analyzer.getParameterType(index);
        if (type.isIn()) {
            return toPort(OperatorPortDeclaration.Kind.INPUT, analyzer, type, index);
        } else if (type.isOut()) {
            return toPort(OperatorPortDeclaration.Kind.OUTPUT, analyzer, type, index);
        } else {
            return toParameter(analyzer, index, type);
        }
    }
View Full Code Here


            ExecutableAnalyzer analyzer,
            TypeConstraint type,
            int index) {
        assert analyzer != null;
        assert type != null;
        TypeConstraint dataType = type.getTypeArgument();
        if (dataType.isModel() == false) {
            analyzer.error(index, "モデルオブジェクト型以外は入出力に指定できません");
            return null;
        }
        return new OperatorPortDeclaration(
                kind,
                analyzer.getParameterDocument(index),
                analyzer.getParameterName(index),
                PortTypeDescription.reference(dataType.getType(), analyzer.getParameterName(index)),
                index,
                null);
    }
View Full Code Here

            a.error("マスタ結合演算子はジェネリックメソッドで宣言できません");
        }
        if (a.isAbstract() == false) {
            a.error("マスタ結合演算子はabstractで宣言する必要があります");
        }
        TypeConstraint joined = a.getReturnType();
        if (joined.isConcreteModel() == false) {
            a.error("マスタ結合演算子は戻り値にモデルオブジェクト型を指定する必要があります");
        }
        TypeConstraint master = a.getParameterType(0);
        if (master.isModel() == false) {
            a.error(0, "マスタ結合演算子の一つ目の引数はモデルオブジェクト型である必要があります");
        }
        TypeConstraint transaction = a.getParameterType(1);
        if (transaction.isModel() == false) {
            a.error(1, "マスタ結合演算子の二つ目の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 2, n = a.countParameters(); i < n; i++) {
            a.error(i, "マスタ結合演算子にはユーザー引数を利用できません");
        }
        ExecutableElement selector = null;
        try {
            selector = MasterKindOperatorAnalyzer.findSelector(context.environment, context);
        } catch (ResolveException e) {
            a.error(e.getMessage());
        }
        if (joined.isJoinedModel(master.getType(), transaction.getType()) == false) {
            a.error("マスタ結合演算子の戻り値型は引数の結合結果を表す型である必要があります");
            return null;
        }

        ShuffleKey masterKey = joined.getJoinKey(master.getType());
        ShuffleKey transactionKey = joined.getJoinKey(transaction.getType());

        MasterJoin annotation = context.element.getAnnotation(MasterJoin.class);
        if (annotation == null) {
            a.error("注釈の解釈に失敗しました");
            return null;
View Full Code Here

            a.error(0, "抽出演算子の最初の引数はモデルオブジェクト型である必要があります");
        }

        int startParameters = RESULT_START;
        for (int i = RESULT_START, n = a.countParameters(); i < n; i++) {
            TypeConstraint param = a.getParameterType(i);
            if (param.isResult() == false) {
                break;
            } else if (param.getTypeArgument().isModel() == false) {
                a.error(i, "抽出演算子の結果は結果のモデルオブジェクト型である必要があります");
            } else {
                startParameters++;
            }
        }
        if (startParameters == RESULT_START) { // 結果型がない
            a.error("抽出演算子の引数には一つ以上の結果(Result)型を指定する必要があります");
        }
        for (int i = startParameters, n = a.countParameters(); i < n; i++) {
            TypeConstraint param = a.getParameterType(i);
            if (param.isResult()) {
                a.error(i, "ユーザー引数の後には結果型を含められません");
            } else if (param.isBasic() == false) {
                a.error(i, "ユーザー引数は文字列またはプリミティブ型である必要があります");
            }
        }
        if (a.hasError()) {
            return null;
        }

        Builder builder = new Builder(Extract.class, context);
        builder.addAttribute(a.getObservationCount());
        builder.setDocumentation(a.getExecutableDocument());
        builder.addInput(
                a.getParameterDocument(0),
                a.getParameterName(0),
                a.getParameterType(0).getType(),
                0);
        for (int i = 1; i < startParameters; i++) {
            TypeConstraint outputType = a.getParameterType(i).getTypeArgument();
            TypeMirror outputTypeMirror = outputType.getType();
            String found = builder.findInput(outputTypeMirror);
            if (found == null && outputType.isProjectiveModel()) {
                a.error("出力型{0}に対する入力が見つかりません", outputTypeMirror);
            }
            builder.addOutput(
                    a.getParameterDocument(i),
                    a.getParameterName(i),
View Full Code Here

            a.error(0, "グループ整列演算子の最初の引数はリストのモデルオブジェクト型である必要があります");
        }

        int startParameters = RESULT_START;
        for (int i = RESULT_START, n = a.countParameters(); i < n; i++) {
            TypeConstraint param = a.getParameterType(i);
            if (param.isResult() == false) {
                break;
            } else if (param.getTypeArgument().isModel() == false) {
                a.error(i, "グループ整列演算子の結果は結果のモデルオブジェクト型である必要があります");
            } else {
                startParameters++;
            }
        }
        if (startParameters == RESULT_START) { // 結果型がない
            a.error("グループ整列演算子の引数には一つ以上の結果(Result)型を指定する必要があります");
        }
        for (int i = startParameters, n = a.countParameters(); i < n; i++) {
            TypeConstraint param = a.getParameterType(i);
            if (param.isResult()) {
                a.error(i, "ユーザー引数の後には結果型を含められません");
            } else if (param.isBasic() == false) {
                a.error(i, "ユーザー引数は文字列またはプリミティブ型である必要があります");
            }
        }
        if (a.hasError()) {
            return null;
        }

        ShuffleKey key = a.getParameterKey(0);
        if (key == null) {
            a.error("グループ整列演算子の引数には@Key注釈によってグループ化項目を指定する必要があります");
            return null;
        }
        GroupSort annotation = context.element.getAnnotation(GroupSort.class);
        if (annotation == null) {
            a.error("注釈の解釈に失敗しました");
            return null;
        }

        // redirect to @CoGroup
        Builder builder = new Builder(CoGroup.class, context);
        builder.addAttribute(FlowBoundary.SHUFFLE);
        builder.addAttribute(a.getObservationCount());
        builder.addAttribute(annotation.inputBuffer());
        builder.setDocumentation(a.getExecutableDocument());
        builder.addInput(
                a.getParameterDocument(0),
                a.getParameterName(0),
                a.getParameterType(0).getTypeArgument().getType(),
                0,
                key);
        for (int i = 1; i < startParameters; i++) {
            TypeConstraint outputType = a.getParameterType(i).getTypeArgument();
            TypeMirror outputTypeMirror = outputType.getType();
            String found = builder.findInput(outputTypeMirror);
            if (found == null && outputType.isProjectiveModel()) {
                a.error("出力型{0}に対する入力が見つかりません", outputTypeMirror);
            }
            builder.addOutput(
                    a.getParameterDocument(i),
                    a.getParameterName(i),
View Full Code Here

            a.error("マスタ確認演算子はabstractで宣言する必要があります");
        }
        if (a.getReturnType().isBoolean() == false) {
            a.error("マスタ確認演算子は戻り値にboolean型を指定する必要があります");
        }
        TypeConstraint master = a.getParameterType(0);
        if (master.isModel() == false) {
            a.error(0, "マスタ確認演算子の一つ目の引数はモデルオブジェクト型である必要があります");
        }
        TypeConstraint transaction = a.getParameterType(1);
        if (transaction.isModel() == false) {
            a.error(1, "マスタ確認演算子の二つ目の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 2, n = a.countParameters(); i < n; i++) {
            a.error(i, "マスタ確認演算子にはユーザー引数を利用できません");
        }
View Full Code Here

            a.error("マスタつき更新演算子はabstractで宣言できません");
        }
        if (a.getReturnType().isVoid() == false) {
            a.error("マスタつき更新演算子は戻り値にvoidを指定する必要があります");
        }
        TypeConstraint master = a.getParameterType(0);
        if (master.isModel() == false) {
            a.error(0, "マスタつき更新演算子の一つ目の引数はモデルオブジェクト型である必要があります");
        }
        TypeConstraint transaction = a.getParameterType(1);
        if (transaction.isModel() == false) {
            a.error(1, "マスタつき更新演算子の二つ目の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 2, n = a.countParameters(); i < n; i++) {
            if (a.getParameterType(i).isBasic() == false) {
                a.error(i, "マスタつき更新演算子の2つ目以降の引数は文字列またはプリミティブ型である必要があります");
View Full Code Here

            a.error("畳み込み演算子はabstractで宣言できません");
        }
        if (a.getReturnType().isVoid() == false) {
            a.error("畳み込み演算子は戻り値にvoidを指定する必要があります");
        }
        TypeConstraint left = a.getParameterType(0);
        if (left.isModel() == false) {
            a.error(0, "畳み込み演算子の1つ目の引数はモデルオブジェクト型である必要があります");
        }
        TypeConstraint right = a.getParameterType(1);
        if (right.isModel() == false) {
            a.error(1, "畳み込み演算子の2つ目の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 2, n = a.countParameters(); i < n; i++) {
            if (a.getParameterType(i).isBasic() == false) {
                a.error(i, "畳み込み演算子の3つ目以降の引数は文字列またはプリミティブ型である必要があります");
            }
        }
        if (a.hasError()) {
            return null;
        }

        if (context.environment.getTypeUtils().isSameType(left.getType(), right.getType()) == false) {
            a.error(1, "畳み込み演算子の1つ目の引数と2つ目の引数は同じ型である必要があります");
        }
        ShuffleKey foldKey = a.getParameterKey(0);
        if (foldKey == null) {
            a.error("畳み込み演算子の引数には@Key注釈によってグループ化項目を指定する必要があります");
View Full Code Here

            constants = a.getReturnType().getEnumConstants();
            if (constants.isEmpty()) {
                a.error("マスタ分岐演算子の戻り値は定数が1つ以上宣言された列挙型である必要があります");
            }
        }
        TypeConstraint master = a.getParameterType(0);
        if (master.isModel() == false) {
            a.error(0, "マスタ分岐演算子の1つ目の引数はモデルオブジェクト型である必要があります");
        }
        TypeConstraint transaction = a.getParameterType(1);
        if (transaction.isModel() == false) {
            a.error(1, "マスタ分岐演算子の2つ目の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 2, n = a.countParameters(); i < n; i++) {
            if (a.getParameterType(i).isBasic() == false) {
                a.error(i, "マスタ分岐演算子の3つ目以降の引数は文字列またはプリミティブ型である必要があります");
View Full Code Here

            a.error("単純集計演算子はジェネリックメソッドで宣言できません");
        }
        if (a.isAbstract() == false) {
            a.error("単純集計演算子はabstractで宣言する必要があります");
        }
        TypeConstraint summarized = a.getReturnType();
        if (summarized.isConcreteModel() == false) {
            a.error("単純集計演算子は戻り値にモデルオブジェクト型を指定する必要があります");
        }
        TypeConstraint summarizee = a.getParameterType(0);
        if (summarizee.isModel() == false) {
            a.error(0, "単純集計演算子の最初の引数はモデルオブジェクト型である必要があります");
        }
        for (int i = 1, n = a.countParameters(); i < n; i++) {
            a.error(i, "単純集計演算子にはユーザー引数を利用できません");
        }
        if (a.hasError()) {
            return null;
        }
        if (summarized.isSummarizedModel(summarizee.getType()) == false) {
            a.error("単純集計演算子の戻り値型は最初の引数の集計結果を表す型である必要があります");
            return null;
        }

        ShuffleKey key = summarized.getSummarizeKey();
View Full Code Here

TOP

Related Classes of com.asakusafw.compiler.operator.ExecutableAnalyzer.TypeConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.