Package com.asakusafw.vocabulary.flow.graph

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


         * この成果物の型を返す。
         * @return この成果物の型
         */
        public java.lang.reflect.Type getDataType() {
            FlowBlock.Output first = getOutputs().iterator().next();
            FlowElementOutput port = first.getElementPort();
            return port.getDescription().getDataType();
        }
View Full Code Here


    private List<FlowBlock.Output> toBlockOutputs(List<PortConnection> outputs) {
        assert outputs != null;
        Map<FlowElementOutput, Set<PortConnection>> map = new LinkedHashMap<FlowElementOutput, Set<PortConnection>>();
        for (PortConnection output : outputs) {
            FlowElementOutput port = output.getUpstream();
            Maps.addToSet(map, port, output);
        }
        List<FlowBlock.Output> results = Lists.create();
        for (Map.Entry<FlowElementOutput, Set<PortConnection>> entry : map.entrySet()) {
            results.add(new FlowBlock.Output(entry.getKey(), entry.getValue()));
View Full Code Here

            FlowElementInput port = inputMapping.get(bound.getElementPort());
            assert port != null;
            bound.setElementPort(port);
        }
        for (FlowBlock.Output bound : blockOutputs) {
            FlowElementOutput port = outputMapping.get(bound.getElementPort());
            assert port != null;
            bound.setElementPort(port);
        }
    }
View Full Code Here

                assert srcInput.size() == uniInput.size();
                for (int i = 0, n = srcInput.size(); i < n; i++) {
                    FlowElementInput srcPort = srcInput.get(i);
                    FlowElementInput uniPort = uniInput.get(i);
                    for (PortConnection conn : srcPort.getConnected()) {
                        FlowElementOutput opposite = unifiedOutputs.get(conn.getUpstream());
                        assert opposite != null;
                        PortConnection.connect(opposite, uniPort);
                    }
                    srcPort.disconnectAll();
                }
            }
        }

        // reconnect outputs
        for (FlowElement elem : elementMapping.values()) {
            FlowElement unified = unifiedElements.get(elem);
            assert unified != null;
            if (elem != unified) {
                List<FlowElementOutput> srcOutput = elem.getOutputPorts();
                List<FlowElementOutput> uniOutput = unified.getOutputPorts();
                assert srcOutput.size() == uniOutput.size();
                for (int i = 0, n = srcOutput.size(); i < n; i++) {
                    FlowElementOutput srcPort = srcOutput.get(i);
                    FlowElementOutput uniPort = uniOutput.get(i);
                    for (PortConnection conn : srcPort.getConnected()) {
                        FlowElementInput opposite = unifiedInputs.get(conn.getDownstream());
                        assert opposite != null;
                        PortConnection.connect(uniPort, opposite);
                    }
View Full Code Here

        assert outputMapping != null;
        assert inputMapping != null;
        Map<FlowElementOutput, FlowBlock.Output> map = Maps.create();
        for (Iterator<FlowBlock.Output> iter = blockOutputs.iterator(); iter.hasNext();) {
            FlowBlock.Output blockPort = iter.next();
            FlowElementOutput elementPort = outputMapping.get(blockPort.getElementPort());
            assert elementPort != null;
            FlowBlock.Output unified = map.get(elementPort);
            if (unified == null) {
                map.put(elementPort, blockPort);
                blockPort.setElementPort(elementPort);
View Full Code Here

     * @param upstream 上流
     * @param downstream 下流
     * @return 自身のオブジェクト
     */
    public FlowGraphGenerator connect(String upstream, String downstream) {
        FlowElementOutput output = findOutput(upstream);
        FlowElementInput input = findInput(downstream);
        PortConnection.connect(output, input);
        return this;
    }
View Full Code Here

                throw new AssertionError(element.getOutputPorts());
            }
            return element.getOutputPorts().get(0);
        }

        FlowElementOutput port = null;
        for (FlowElementOutput finding : element.getOutputPorts()) {
            if (portName.equals(finding.getDescription().getName())) {
                port = finding;
                break;
            }
View Full Code Here

        Source<CharSequence> op = output(CharSequence.class, example, "out");

        MockOut<CharSequence> out = new MockOut<CharSequence>(CharSequence.class, "out");
        out.add(op);

        FlowElementOutput port = op.toOutputPort();
        FlowElement element = port.getOwner();
        OperatorDescription desc = (OperatorDescription) element.getDescription();
        List<Parameter> params = desc.getParameters();
        assertThat(params.size(), is(1));
        assertThat(params.get(0).getName(), is("param"));
        assertThat(params.get(0).getType(), is((Type) int.class));
View Full Code Here

            FlowElementInput copyIn = entry.getValue();
            for (FlowElementOutput origOut : origIn.getOpposites()) {
                if (elements.contains(origOut.getOwner()) == false) {
                    continue;
                }
                FlowElementOutput copyOut = outputMapping.get(origOut);
                assert copyOut != null;
                PortConnection.connect(copyOut, copyIn);
            }
        }
    }
View Full Code Here

            throw new IllegalArgumentException("element must be identity operator"); //$NON-NLS-1$
        }
        assert element.getInputPorts().size() == 1;
        assert element.getOutputPorts().size() == 1;
        FlowElementInput input = element.getInputPorts().get(0);
        FlowElementOutput output = element.getOutputPorts().get(0);
        Set<PortConnection> sources = Sets.from(input.getConnected());
        Set<PortConnection> targets = Sets.from(output.getConnected());
        if (sources.size() <= 1 && targets.size() <= 1) {
            return false;
        } else {
            for (PortConnection source : sources) {
                FlowElementOutput upstream = source.getUpstream();
                for (PortConnection target : targets) {
                    FlowElementInput downstream = target.getDownstream();
                    connectWithIdentity(element, upstream, downstream);
                }
            }
View Full Code Here

TOP

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

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.