Package com.asakusafw.utils.java.model.syntax

Examples of com.asakusafw.utils.java.model.syntax.Expression


        if (sourceType == null || sinkType == null) {
            return;
        }

        context.add(cache.createReset());
        Expression inputObject = context.getInput();
        Expression outputObject = cache.get();
        for (DataClass.Property sourceProperty : sourceType.getProperties()) {
            Property sinkProperty = sinkType.findProperty(sourceProperty.getName());
            if (sinkProperty == null) {
                // skip this property
            } else if (sourceProperty.getType().equals(sinkProperty.getType()) == false) {
View Full Code Here


        assert method != null : desc.getDeclaration();
        Class<?> enumType = method.getReturnType();
        List<Tuple2<Enum<?>, FlowElementPortDescription>> constants =
            EnumUtil.extractConstants(enumType, desc.getOutputPorts());

        Expression impl = context.createImplementation();
        Expression branch = context.createLocalVariable(
                context.convert(enumType),
                new ExpressionBuilder(f, impl)
                    .method(desc.getDeclaration().getName(), arguments)
                    .toExpression());
View Full Code Here

        }

        private MethodDeclaration createWriteMethod() {
            SimpleName out = factory.newSimpleName("out");

            Expression segmentId = new ExpressionBuilder(factory, factory.newThis())
                .field(SEGMENT_ID_FIELD_NAME)
                .toExpression();

            List<Statement> cases = Lists.create();
            for (Segment segment : model.getSegments()) {
View Full Code Here

        }

        private MethodDeclaration createReadFieldsMethod() {
            SimpleName in = factory.newSimpleName("in");

            Expression segmentId = new ExpressionBuilder(factory, factory.newThis())
                .field(SEGMENT_ID_FIELD_NAME)
                .toExpression();

            List<Statement> statements = Lists.create();
            statements.add(new ExpressionBuilder(factory, segmentId)
View Full Code Here

        assert method != null : desc.getDeclaration();
        Class<?> enumType = method.getReturnType();
        List<Tuple2<Enum<?>, FlowElementPortDescription>> constants =
            EnumUtil.extractConstants(enumType, desc.getOutputPorts());

        Expression impl = context.createImplementation();
        SimpleName branch = context.createName("branch");
        context.addProcess(tx, new ExpressionBuilder(f, impl)
            .method(desc.getDeclaration().getName(), arguments)
            .toLocalVariableDeclaration(
                    context.convert(enumType),
View Full Code Here

        FlowElementPortDescription updatedPort = context.getOutputPort(SideDataJoinUpdate.ID_OUTPUT_UPDATED);
        FlowElementPortDescription missedPort = context.getOutputPort(SideDataJoinUpdate.ID_OUTPUT_MISSED);
        ResultMirror updated = context.getOutput(updatedPort);
        ResultMirror missed = context.getOutput(missedPort);

        Expression impl = context.createImplementation();
        List<Expression> arguments = Lists.create();
        arguments.add(helper.getGetRawMasterExpression());
        arguments.add(context.getInput());
        for (OperatorDescription.Parameter param : desc.getParameters()) {
            arguments.add(Models.toLiteral(f, param.getValue()));
View Full Code Here

                for (Term term : segment.getTerms()) {
                    if (term.getArrangement() != Arrangement.GROUPING) {
                        continue;
                    }
                    String name = ShuffleEmiterUtil.getPropertyName(segment, term);
                    Expression rhs = term.getSource().createValueDiff(
                            new ExpressionBuilder(factory, o1)
                                .field(name)
                                .toExpression(),
                            new ExpressionBuilder(factory, o2)
                                .field(name)
View Full Code Here

                        name));
            arguments[var.getParameterPosition()] = name;
        }
        for (OperatorPortDeclaration var : flowClass.getOutputPorts()) {
            SimpleName name = names.create(var.getName());
            Expression type = toExpression(var);
            assert type != null;
            statements.add(new ExpressionBuilder(factory, builderName)
                .method("addOutput", util.v(var.getName()), type)
                .toLocalVariableDeclaration(
                        util.toOutType(var.getType().getRepresentation()),
                        name));
            arguments[var.getParameterPosition()] = name;
        }
        for (OperatorPortDeclaration var : flowClass.getParameters()) {
            Expression type = toExpression(var);
            SimpleName name = factory.newSimpleName(var.getName());
            statements.add(new ExpressionBuilder(factory, builderName)
                .method("addParameter",
                    util.v(var.getName()),
                    type,
                    name)
                .toStatement());
            arguments[var.getParameterPosition()] = name;
        }
        SimpleName descName = names.create("desc");
        statements.add(new TypeBuilder(factory, getType(util.t(flowClass.getElement())))
            .newObject(arguments)
            .toLocalVariableDeclaration(util.t(FlowDescription.class), descName));

        Expression resolver = new ExpressionBuilder(factory, factory.newThis())
            .field(RESOLVER_FIELD_NAME)
            .toExpression();
        statements.add(new ExpressionBuilder(factory, resolver)
            .assignFrom(new ExpressionBuilder(factory, builderName)
                .method("toResolver", descName)
View Full Code Here

        }
        return statements;
    }

    private Expression toExpression(OperatorPortDeclaration var) throws AssertionError {
        Expression type;
        switch (var.getType().getKind()) {
        case DIRECT:
            type = factory.newClassLiteral(util.t(environment.getErasure(var.getType().getDirect())));
            break;
        case REFERENCE:
View Full Code Here

         * @return リソースを表す式
         * @throws IllegalArgumentException 引数に{@code null}が含まれる場合
         */
        public Expression getResource(FlowResourceDescription resource) {
            Precondition.checkMustNotBeNull(resource, "resource"); //$NON-NLS-1$
            Expression expression = resources.get(resource);
            assert expression != null;
            return expression;
        }
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.model.syntax.Expression

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.