Package com.asakusafw.vocabulary.flow.graph

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


        assert block != null;
        assert fragments != null;
        assert fgraph != null;
        Map<FlowBlock.Input, Graph<Fragment>> streams = new LinkedHashMap<FlowBlock.Input, Graph<Fragment>>();
        for (FlowBlock.Input blockInput : block.getBlockInputs()) {
            FlowElementInput input = blockInput.getElementPort();
            Fragment head = fragments.get(input.getOwner());
            Graph<Fragment> subgraph = createSubgraph(head, fgraph);
            streams.put(blockInput, subgraph);
        }
        List<MapUnit> results = Lists.create();
        for (Map.Entry<FlowBlock.Input, Graph<Fragment>> entry : streams.entrySet()) {
View Full Code Here


            successors.addAll(output.getOpposites());
        }
        Set<FlowElement> saw = Sets.create();
        boolean modified = false;
        while (successors.isEmpty() == false) {
            FlowElementInput next = successors.removeFirst();
            FlowElement element = next.getOwner();
            if (saw.contains(element)) {
                continue;
            }
            saw.add(element);
            if (element.getDescription().getKind() == FlowElementKind.PSEUD) {
                for (FlowElementOutput output : element.getOutputPorts()) {
                    successors.addAll(output.getOpposites());
                }
                continue;
            }
            if (element.getDescription().getKind() == FlowElementKind.FLOW_COMPONENT) {
                FlowPartDescription desc = (FlowPartDescription) element.getDescription();
                FlowIn<?> internal = desc.getInternalInputPort(next.getDescription());
                modified |= rewriteSuccessors(source, internal);
                continue;
            }
            if (element.getDescription().getKind() == FlowElementKind.OPERATOR) {
                modified |= rewriteOperator(source, next);
View Full Code Here

        FlowElement element = input.getOwner();
        assert element.getDescription().getKind() == FlowElementKind.OPERATOR;
        OperatorDescription desc = (OperatorDescription) element.getDescription();
        Class<? extends Annotation> annotationType = desc.getDeclaration().getAnnotationType();
        Class<? extends Annotation> sideDataType;
        FlowElementInput master;
        FlowElementInput tx;
        if (annotationType == MasterJoin.class) {
            sideDataType = SideDataJoin.class;
            master = getInput(element, MasterJoin.ID_INPUT_MASTER);
            tx = getInput(element, MasterJoin.ID_INPUT_TRANSACTION);
        } else if (annotationType == MasterBranch.class) {
            sideDataType = SideDataBranch.class;
            master = getInput(element, MasterBranch.ID_INPUT_MASTER);
            tx = getInput(element, MasterBranch.ID_INPUT_TRANSACTION);
        } else if (annotationType == MasterCheck.class) {
            sideDataType = SideDataCheck.class;
            master = getInput(element, MasterCheck.ID_INPUT_MASTER);
            tx = getInput(element, MasterCheck.ID_INPUT_TRANSACTION);
        } else if (annotationType == MasterJoinUpdate.class) {
            sideDataType = SideDataJoinUpdate.class;
            master = getInput(element, MasterJoinUpdate.ID_INPUT_MASTER);
            tx = getInput(element, MasterJoinUpdate.ID_INPUT_TRANSACTION);
        } else {
            return false;
        }
        if (master.equals(input) == false) {
            return false;
        }
        OperatorDescription.Builder builder = createSideDataOperator(desc, sideDataType);
        builder.addInput(
                tx.getDescription().getName(),
                tx.getDescription().getDataType());
        builder.addResource(createResource(source, master, tx));

        FlowElement rewrite = new FlowElement(builder.toDescription());
        for (FlowElementOutput upstream : tx.getOpposites()) {
            PortConnection.connect(upstream, rewrite.getInputPorts().get(0));
        }

        List<FlowElementOutput> originalOutputs = element.getOutputPorts();
        List<FlowElementOutput> rewriteOutputs = rewrite.getOutputPorts();
View Full Code Here

            }

            for (FlowBlock.Output output : node.getOutputs()) {
                Port source = toPort(output.getElementPort());
                for (FlowBlock.Connection conn : output.getConnections()) {
                    FlowElementInput downstream = conn.getDownstream().getElementPort();
                    connect(source, downstream);
                }
            }
            acceptAll(context, node.getNodes());
            return null;
View Full Code Here

        builder.addAttribute(Connectivity.OPTIONAL);
        if (setting.getMode() == Mode.STRICT) {
            builder.addAttribute(ObservationCount.EXACTLY_ONCE);
            port.disconnectAll();
            FlowElementResolver resolver = builder.toResolver();
            FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
            for (FlowElementOutput upstream : upstreams) {
                PortConnection.connect(upstream, input);
            }
            FlowElementOutput output = resolver.getOutput(OUTPUT_PORT_NAME);
            for (FlowElementInput downstream : downstreams) {
                PortConnection.connect(output, downstream);
            }
        } else if (setting.getMode() == Mode.IN_ORDER) {
            builder.addAttribute(ObservationCount.AT_LEAST_ONCE);
            port.disconnectAll();
            FlowElementResolver resolver = builder.toResolver();
            FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
            for (FlowElementOutput upstream : upstreams) {
                PortConnection.connect(upstream, input);
            }
            FlowElementOutput output = resolver.getOutput(OUTPUT_PORT_NAME);
            for (FlowElementInput downstream : downstreams) {
                PortConnection.connect(output, downstream);
            }
        } else if (setting.getMode() == Mode.OUT_OF_ORDER) {
            builder.addAttribute(ObservationCount.AT_LEAST_ONCE);
            FlowElementResolver resolver = builder.toResolver();
            FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
            for (FlowElementOutput upstream : upstreams) {
                PortConnection.connect(upstream, input);
            }
        }
    }
View Full Code Here

        private Type createInputType() {
            return t(getInputTypeAsReflect());
        }

        private java.lang.reflect.Type getInputTypeAsReflect() {
            FlowElementInput port = unit.getInputs().get(0).getElementPort();
            FlowElementPortDescription input = port.getDescription();
            return input.getDataType();
        }
View Full Code Here

TOP

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

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.