Examples of FlowElement


Examples of cascading.flow.FlowElement

    assertEquals( "not equal: steps.size()", 3, steps.size() );

    BaseFlowStep step = (BaseFlowStep) steps.get( 0 );

    Scope nextScope = step.getNextScope( step.getGroup() );
    FlowElement operator = step.getNextFlowElement( nextScope );

    assertTrue( "not an Every", operator instanceof Every );

    nextScope = step.getNextScope( operator );
    operator = step.getNextFlowElement( nextScope );
View Full Code Here

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

    private boolean mergeIdentity() {
        boolean changed = false;
        boolean foundTarget = false;
        Map<FlowBlock.Input, List<FlowBlock.Output>> targets =  Maps.create();
        for (FlowBlock.Output output : blockOutputs) {
            FlowElement element = output.getElementPort().getOwner();
            if (element.getDescription().getKind() != FlowElementKind.PSEUD) {
                continue;
            }
            if (output.getConnections().size() != 1) {
                continue;
            }
            FlowBlock.Input opposite = output.getConnections().get(0).getDownstream();
            List<FlowBlock.Output> list = targets.get(opposite);
            if (list == null) {
                list = new ArrayList<FlowBlock.Output>();
                targets.put(opposite, list);
            } else {
                foundTarget = true;
            }
            list.add(output);
        }
        if (foundTarget == false) {
            return changed;
        }
        Map<FlowElementInput, FlowBlock.Input> inputs = Maps.create();
        for (FlowBlock.Input input : blockInputs) {
            FlowElementInput elementInput = input.getElementPort();
            assert inputs.containsKey(elementInput) == false;
            inputs.put(elementInput, input);
        }
        for (Map.Entry<FlowBlock.Input, List<FlowBlock.Output>> entry : targets.entrySet()) {
            List<FlowBlock.Output> upstream = entry.getValue();
            if (upstream.size() == 1) {
                continue;
            }
            FlowElement primaryElement = upstream.get(0).getElementPort().getOwner();
            assert primaryElement.getDescription().getKind() == FlowElementKind.PSEUD;
            assert primaryElement.getInputPorts().size() == 1;
            FlowElementInput primaryInput = primaryElement.getInputPorts().get(0);
            FlowBlock.Input primarySource = inputs.get(primaryInput);
            assert primarySource != null;

            for (int i = 1, n = upstream.size(); i < n; i++) {
                FlowBlock.Output otherTarget = upstream.get(i);
                FlowElement otherElement = otherTarget.getElementPort().getOwner();
                LOG.debug("Unifying pseud element: {} -> {}", otherElement, primaryElement);

                assert otherElement.getDescription().getKind() == FlowElementKind.PSEUD;
                assert otherElement.getInputPorts().size() == 1;
                FlowElementInput otherInput = otherElement.getInputPorts().get(0);
                FlowBlock.Input otherSource = inputs.get(otherInput);
                assert otherSource != null;
                for (FlowBlock.Connection conn : otherSource.getConnections()) {
                    FlowBlock.connect(conn.getUpstream(), primarySource);
                }
View Full Code Here

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

    public boolean collectGarbages() {
        LOG.debug("{}の不要になった要素を削除しています", this);
        Set<FlowElement> blockEdge = collectBlockEdges();
        boolean changed = false;
        LOOP: for (Iterator<FlowElement> iter = elements.iterator(); iter.hasNext();) {
            FlowElement element = iter.next();
            if (blockEdge.contains(element)) {
                continue;
            }
            for (FlowElementInput input : element.getInputPorts()) {
                if (input.getConnected().isEmpty() == false) {
                    continue LOOP;
                }
            }
            for (FlowElementOutput output : element.getOutputPorts()) {
                if (output.getConnected().isEmpty() == false) {
                    continue LOOP;
                }
            }
            iter.remove();
View Full Code Here

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

            List<Statement> cases = Lists.create();
            for (List<ShuffleModel.Segment> group : ShuffleEmiterUtil.groupByElement(shuffle)) {
                for (ShuffleModel.Segment segment : group) {
                    cases.add(factory.newSwitchCaseLabel(v(segment.getPortId())));
                }
                FlowElement element = group.get(0).getPort().getOwner();
                SimpleName rendezvousName = fragments.get(element);
                if (rendezvousName == null) {
                    cases.add(new ExpressionBuilder(factory, Models.toNullLiteral(factory))
                        .toReturnStatement());
                } else {
View Full Code Here

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

            Map<FlowElementOutput, FlowElementOutput> outputMapping) {
        Precondition.checkMustNotBeNull(elements, "elements"); //$NON-NLS-1$
        Precondition.checkMustNotBeNull(elementMapping, "elementMapping"); //$NON-NLS-1$
        // 全てのポートをコピー前後で対応付け
        for (FlowElement orig : elements) {
            FlowElement copy = createMapping(elementMapping, orig);
            addMapping(inputMapping, orig.getInputPorts(), copy.getInputPorts());
            addMapping(outputMapping, orig.getOutputPorts(), copy.getOutputPorts());
        }

        // ポート接続のコピー
        for (Map.Entry<FlowElementInput, FlowElementInput> entry : inputMapping.entrySet()) {
            FlowElementInput origIn = entry.getKey();
View Full Code Here

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

    private static FlowElement createMapping(
            Map<FlowElement, FlowElement> elemMapping,
            FlowElement orig) {
        assert elemMapping != null;
        assert orig != null;
        FlowElement mapped = elemMapping.get(orig);
        if (mapped != null) {
            return mapped;
        }
        FlowElement copy;
        FlowElementDescription description = orig.getDescription();
        if (description.getKind() == FlowElementKind.FLOW_COMPONENT) {
            FlowPartDescription fcd = (FlowPartDescription) description;
            FlowGraph subgraph = deepCopy(fcd.getFlowGraph());
            FlowPartDescription partCopy = new FlowPartDescription(subgraph);
            copy = new FlowElement(partCopy, orig.getAttributeOverride());
        } else {
            copy = orig.copy();
        }
        elemMapping.put(orig, copy);
        return copy;
View Full Code Here

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

    private static void collect(Set<FlowElement> collected) {
        assert collected != null;
        LinkedList<FlowElement> work = new LinkedList<FlowElement>(collected);
        while (work.isEmpty() == false) {
            FlowElement first = work.removeFirst();
            if (collected.contains(first) == false) {
                collected.add(first);
            }
            for (FlowElement pred : FlowGraphUtil.getPredecessors(first)) {
                if (collected.contains(pred) == false) {
View Full Code Here

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

        LinkedList<FlowElement> successors = new LinkedList<FlowElement>();
        for (FlowElement starting : startings) {
            addSuccessors(successors, starting);
        }
        while (successors.isEmpty() == false) {
            FlowElement successor = successors.removeFirst();
            if (saw.contains(successor)) {
                continue;
            }
            saw.add(successor);
View Full Code Here

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

        LinkedList<FlowElement> predecessors = new LinkedList<FlowElement>();
        for (FlowElement starting : startings) {
            addPredecessors(predecessors, starting);
        }
        while (predecessors.isEmpty() == false) {
            FlowElement predecessor = predecessors.removeFirst();
            if (saw.contains(predecessor)) {
                continue;
            }
            saw.add(predecessor);
View Full Code Here

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

        }

        Set<FlowElement> saw = Sets.create();
        Set<FlowElement> results = Sets.create();
        while (nextSuccessors.isEmpty() == false) {
            FlowElement successor = nextSuccessors.removeFirst();
            if (saw.contains(successor)) {
                continue;
            }
            saw.add(successor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.