Package com.asakusafw.vocabulary.flow.graph

Examples of com.asakusafw.vocabulary.flow.graph.FlowElementPortDescription


    public void emitRendezvous(Context context) {
        MasterKindFlowAnalyzer masterAnalyzer = new MasterKindFlowAnalyzer(context);
        ModelFactory f = context.getModelFactory();
        OperatorDescription desc = context.getOperatorDescription();

        FlowElementPortDescription tx = context.getInputPort(MasterJoinUpdate.ID_INPUT_TRANSACTION);

        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();
View Full Code Here


@TargetOperator(Split.class)
public class SplitFlowProcessor extends LineEndProcessor {

    @Override
    public void emitLineEnd(Context context) {
        FlowElementPortDescription inputPort = context.getInputPort(Split.ID_INPUT);
        Joined joined = TypeUtil.erase(inputPort.getDataType()).getAnnotation(Joined.class);
        assert joined != null;
        Map<Class<?>, Term> terms = Maps.create();
        for (Term term : joined.terms()) {
            terms.put(term.source(), term);
        }
View Full Code Here

    public void emitRendezvous(Context context) {
        MasterKindFlowAnalyzer masterAnalyzer = new MasterKindFlowAnalyzer(context);

        ModelFactory f = context.getModelFactory();

        FlowElementPortDescription tx = context.getInputPort(MasterCheck.ID_INPUT_TRANSACTION);

        FlowElementPortDescription foundPort = context.getOutputPort(MasterCheck.ID_OUTPUT_FOUND);
        FlowElementPortDescription missedPort = context.getOutputPort(MasterCheck.ID_OUTPUT_MISSED);
        ResultMirror found = context.getOutput(foundPort);
        ResultMirror missed = context.getOutput(missedPort);

        context.addProcess(tx, f.newIfStatement(
                masterAnalyzer.getHasMasterExpresion(),
View Full Code Here

            EnumUtil.extractConstants(enumType, desc.getOutputPorts());

        List<Statement> cases = Lists.create();
        for (Tuple2<Enum<?>, FlowElementPortDescription> tuple : constants) {
            Enum<?> constant = tuple.first;
            FlowElementPortDescription port = tuple.second;
            ResultMirror next = context.getOutput(port);
            cases.add(f.newSwitchCaseLabel(f.newSimpleName(constant.name())));
            cases.add(next.createAdd(input));
            cases.add(f.newBreakStatement());
        }
View Full Code Here

        ModelFactory f = context.getModelFactory();
        Expression input = context.getInput();
        Expression impl = context.createImplementation();
        OperatorDescription desc = context.getOperatorDescription();

        FlowElementPortDescription converted = context.getOutputPort(Convert.ID_OUTPUT_CONVERTED);
        FlowElementPortDescription original = context.getOutputPort(Convert.ID_OUTPUT_ORIGINAL);

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

        SideDataKindFlowAnalyzer helper = new SideDataKindFlowAnalyzer(
                context,
                (JoinResourceDescription) resource);
        ModelFactory f = context.getModelFactory();

        FlowElementPortDescription joinedPort = context.getOutputPort(SideDataJoin.ID_OUTPUT_JOINED);
        FlowElementPortDescription missedPort = context.getOutputPort(SideDataJoin.ID_OUTPUT_MISSED);

        DataObjectMirror resultCache = context.createModelCache(joinedPort.getDataType());
        DataClass outputType = getEnvironment().getDataClasses().load(joinedPort.getDataType());
        List<Statement> process = Lists.create();
        process.add(resultCache.createReset());
View Full Code Here

@TargetOperator(Restructure.class)
public class RestructureFlowProcessor extends LinePartProcessor {

    @Override
    public void emitLinePart(Context context) {
        FlowElementPortDescription input = context.getInputPort(Restructure.ID_INPUT);
        FlowElementPortDescription output = context.getOutputPort(Restructure.ID_OUTPUT);
        DataObjectMirror cache = context.createModelCache(output.getDataType());
        context.setOutput(cache.get());

        DataClass sourceType = loadChecked(input);
        DataClass sinkType = loadChecked(output);
        if (sourceType == null || sinkType == null) {
View Full Code Here

                    .toExpression());

        List<Statement> cases = Lists.create();
        for (Tuple2<Enum<?>, FlowElementPortDescription> tuple : constants) {
            Enum<?> constant = tuple.first;
            FlowElementPortDescription port = tuple.second;
            ResultMirror next = context.getOutput(port);
            cases.add(f.newSwitchCaseLabel(f.newSimpleName(constant.name())));
            cases.add(next.createAdd(context.getInput()));
            cases.add(f.newBreakStatement());
        }
View Full Code Here

    @Override
    public void emitRendezvous(Context context) {
        ModelFactory f = context.getModelFactory();
        MasterKindFlowAnalyzer masterAnalyzer = new MasterKindFlowAnalyzer(context);

        FlowElementPortDescription tx = context.getInputPort(MasterBranch.ID_INPUT_TRANSACTION);

        OperatorDescription desc = context.getOperatorDescription();
        List<Expression> arguments = Lists.create();
        arguments.add(masterAnalyzer.getGetCheckedMasterExpression());
        arguments.add(context.getProcessInput(tx));
        for (OperatorDescription.Parameter param : desc.getParameters()) {
            arguments.add(Models.toLiteral(f, param.getValue()));
        }

        Method method = desc.getDeclaration().toMethod();
        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),
                    branch));

        List<Statement> cases = Lists.create();
        for (Tuple2<Enum<?>, FlowElementPortDescription> tuple : constants) {
            Enum<?> constant = tuple.first;
            FlowElementPortDescription port = tuple.second;
            ResultMirror next = context.getOutput(port);
            cases.add(f.newSwitchCaseLabel(f.newSimpleName(constant.name())));
            cases.add(next.createAdd(context.getProcessInput(tx)));
            cases.add(f.newBreakStatement());
        }
View Full Code Here

            PortDirection direction,
            String nameList) {
        String[] names = nameList.trim().split("\\s+");
        List<FlowElementPortDescription> results = Lists.create();
        for (String name : names) {
            results.add(new FlowElementPortDescription(name, TYPE, direction));
        }
        return results;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.vocabulary.flow.graph.FlowElementPortDescription

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.