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

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


            ListBufferMirror list = context.createListBuffer(input.getDataType(), bufferKind);
            buffers.add(list);

            context.addBegin(list.createBegin());

            Expression proc = context.getProcessInput(input);
            context.addProcess(input, list.createAdvance(proc));

            context.addEnd(list.createEnd());

            arguments.add(list.get());
        }
        for (FlowElementPortDescription output : desc.getOutputPorts()) {
            arguments.add(context.getOutput(output).get());
        }
        for (OperatorDescription.Parameter param : desc.getParameters()) {
            arguments.add(Models.toLiteral(f, param.getValue()));
        }

        Expression impl = context.createImplementation();
        context.addEnd(new ExpressionBuilder(f, impl)
            .method(desc.getDeclaration().getName(), arguments)
            .toStatement());

        for (ListBufferMirror list : buffers) {
View Full Code Here


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

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

                .newArray(getSlotCount())
                .toLocalVariableDeclaration(
                        importer.toType(String[].class),
                        resultName));
            for (ResolvedSlot slot : slots) {
                Expression outputName;
                if (slot.getSortProperties().isEmpty() && ParallelSortClientEmitter.legacy(environment) == false) {
                    outputName = Models.toNullLiteral(factory);
                } else {
                    outputName = Models.toLiteral(factory, slot.getSource().getOutputName());
                }
View Full Code Here

                .newArray(getSlotCount())
                .toLocalVariableDeclaration(
                        importer.toType(Writable[].class),
                        resultName));
            for (ResolvedSlot slot : slots) {
                Expression object;
                if (slot.getSortProperties().isEmpty() && ParallelSortClientEmitter.legacy(environment) == false) {
                    object = Models.toNullLiteral(factory);
                } else {
                    DataClass slotClass = slot.getValueClass();
                    object = slotClass.createNewInstance(importer.toType(slotClass.getType()));
View Full Code Here

public class ExtractFlowProcessor extends LineEndProcessor {

    @Override
    public void emitLineEnd(Context context) {
        ModelFactory f = context.getModelFactory();
        Expression input = context.getInput();
        Expression impl = context.createImplementation();
        OperatorDescription desc = context.getOperatorDescription();

        List<Expression> arguments = Lists.create();
        arguments.add(input);
        for (FlowElementPortDescription output : desc.getOutputPorts()) {
View Full Code Here

public class UpdateFlowProcessor extends LinePartProcessor {

    @Override
    public void emitLinePart(Context context) {
        ModelFactory f = context.getModelFactory();
        Expression input = context.getInput();
        Expression impl = context.createImplementation();
        OperatorDescription desc = context.getOperatorDescription();

        List<Expression> arguments = Lists.create();
        arguments.add(input);
        for (OperatorDescription.Parameter param : desc.getParameters()) {
View Full Code Here

            List<Statement> statements = Lists.create();
            statements.add(new TypeBuilder(factory, t(ArrayList.class, t(StageOutput.class)))
                .newObject()
                .toLocalVariableDeclaration(t(List.class, t(StageOutput.class)), list));
            for (CopyDescription slot : slots) {
                Expression valueType = factory.newClassLiteral(t(slot.getDataModel().getType()));
                statements.add(new ExpressionBuilder(factory, list)
                    .method("add", new TypeBuilder(factory, t(StageOutput.class))
                        .newObject(
                                Models.toLiteral(factory, slot.getName()),
                                factory.newClassLiteral(t(NullWritable.class)),
View Full Code Here

public class BranchFlowProcessor extends LineEndProcessor {

    @Override
    public void emitLineEnd(Context context) {
        ModelFactory f = context.getModelFactory();
        Expression input = context.getInput();
        Expression impl = context.createImplementation();
        OperatorDescription desc = context.getOperatorDescription();

        Method method = desc.getDeclaration().toMethod();
        assert method != null : desc.getDeclaration();
        Class<?> enumType = method.getReturnType();

        List<Expression> arguments = Lists.create();
        arguments.add(input);
        for (OperatorDescription.Parameter param : desc.getParameters()) {
            arguments.add(Models.toLiteral(f, param.getValue()));
        }
        Expression result = context.createLocalVariable(
                enumType,
                new ExpressionBuilder(f, impl)
                    .method(desc.getDeclaration().getName(), arguments)
                    .toExpression());
        List<Tuple2<Enum<?>, FlowElementPortDescription>> constants =
View Full Code Here

            List<Statement> cases = Lists.create();
            for (FlowElementInput input : fragment.getInputPorts()) {
                Segment segment = shuffle.findSegment(input);
                cases.add(factory.newSwitchCaseLabel(
                        Models.toLiteral(factory, segment.getPortId())));
                Expression model = new ExpressionBuilder(factory, value)
                    .method(Naming.getShuffleValueGetter(segment.getPortId()))
                    .toExpression();
                cases.add(new ExpressionBuilder(factory, factory.newThis())
                    .method(getMethodName(PROCESS_PREFIX, segment), model)
                    .toStatement());
View Full Code Here

public class LoggingFlowProcessor extends LinePartProcessor {

    @Override
    public void emitLinePart(Context context) {
        ModelFactory f = context.getModelFactory();
        Expression input = context.getInput();
        Expression impl = context.createImplementation();
        OperatorDescription desc = context.getOperatorDescription();

        List<Expression> arguments = Lists.create();
        arguments.add(input);
        for (OperatorDescription.Parameter param : desc.getParameters()) {
            arguments.add(Models.toLiteral(f, param.getValue()));
        }
        Expression result = context.createLocalVariable(
                String.class,
                new ExpressionBuilder(f, impl)
                    .method(desc.getDeclaration().getName(), arguments)
                    .toExpression());
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.