Package com.asakusafw.vocabulary.flow.graph

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


        Set<FlowElement> removed = Sets.create();
        LinkedList<FlowElement> work = new LinkedList<FlowElement>();
        work.addAll(elements);

        while (work.isEmpty() == false) {
            FlowElement element = work.removeFirst();

            // このセッションで削除済みのものについては処理対象としない
            if (removed.contains(element)) {
                continue;
            }
View Full Code Here


        // 利用しない入力は削除
        Iterator<FlowBlock.Input> inputs = blockInputs.iterator();
        while (inputs.hasNext()) {
            FlowBlock.Input port = inputs.next();
            FlowElement element = port.getElementPort().getOwner();
            if (FlowGraphUtil.hasSuccessors(element) == false
                    && FlowGraphUtil.hasMandatorySideEffect(element) == false
                    && outputElements.contains(element) == false) {
                LOG.debug("Deleting unnecessary input: {} on {}", port, this);
                port.disconnect();
                inputs.remove();
                changed = true;
            } else {
                inputElements.add(element);
            }
        }

        // 利用しない出力は削除
        Iterator<FlowBlock.Output> outputs = blockOutputs.iterator();
        while (outputs.hasNext()) {
            FlowBlock.Output port = outputs.next();
            FlowElement element = port.getElementPort().getOwner();
            if (FlowGraphUtil.hasPredecessors(element) == false
                    && inputElements.contains(element) == false) {
                LOG.debug("Deleting unnecessary output: {} on {}", port, this);
                port.disconnect();
                outputs.remove();
View Full Code Here

    private Statement setupRendezvous(FragmentNode node, StageModel.Fragment value) {
        assert node != null;
        assert value != null;
        assert value.getInputPorts().isEmpty() == false;
        FlowElement element = value.getInputPorts().get(0).getOwner();
        Type type = importer.resolve(factory.newNamedType(value.getCompiled().getQualifiedName()));
        List<Expression> arguments = resolveArguments(node, value);
        assert rendezvous.containsKey(element);
        return new ExpressionBuilder(factory, factory.newThis())
            .field(node.getName())
View Full Code Here

        block.detach();
        assertThat(block.getElements().size(), is(1));
        assertThat(block.getBlockInputs().size(), is(1));
        assertThat(block.getBlockOutputs().size(), is(1));

        FlowElement op = block.getElements().iterator().next();
        FlowBlock.Input input = block.getBlockInputs().get(0);
        FlowBlock.Output output = block.getBlockOutputs().get(0);

        assertThat(op, not(sameInstance(gen.get("op"))));
        assertThat(input.getElementPort(), not(sameInstance(gen.input("op"))));
View Full Code Here

        FlowBlock.Output output = block.getBlockOutputs().get(0);

        assertThat(input.getElementPort(), not(sameInstance(gen.input("op1"))));
        assertThat(output.getElementPort(), not(sameInstance(gen.output("op2"))));

        FlowElement op1 = input.getElementPort().getOwner();
        FlowElement op2 = output.getElementPort().getOwner();

        assertThat(op1.getInputPorts().get(0).getConnected().size(), is(0));
        assertThat(op1.getOutputPorts().get(0).getConnected().size(), is(1));
        assertThat(op2.getInputPorts().get(0).getConnected().size(), is(1));
        assertThat(op2.getOutputPorts().get(0).getConnected().size(), is(0));

        assertThat(op1.getOutputPorts().get(0).getConnected(),
                is(op2.getInputPorts().get(0).getConnected()));
    }
View Full Code Here

        FlowGraph copy = FlowGraphUtil.deepCopy(graph);

        Set<FlowElement> allComponents = FlowGraphUtil.collectFlowParts(copy);
        assertThat(allComponents.size(), is(1));
        FlowElement compElem = allComponents.iterator().next();

        FlowPartDescription copyComponent = (FlowPartDescription) compElem.getDescription();

        assertThat(
                toDescription(FlowGraphUtil.toElementGraph(copyComponent.getFlowGraph())),
                is(toDescription(FlowGraphUtil.toElementGraph(component))));
        assertThat(
View Full Code Here

        FlowGraphUtil.insertCheckpoint(gen.output("in"));

        Set<FlowElement> succ = FlowGraphUtil.getSuccessors(gen.get("in"));
        assertThat(succ.size(), is(1));
        FlowElement elem = succ.iterator().next();
        assertThat(FlowGraphUtil.isStagePadding(elem), is(true));
        assertThat(FlowGraphUtil.getSuccessors(elem),
            is(gen.getAsSet("out")));
    }
View Full Code Here

        FlowGraphUtil.insertCheckpoint(gen.output("in"));

        Set<FlowElement> succ = FlowGraphUtil.getSuccessors(gen.get("in"));
        assertThat(succ.size(), is(1));
        FlowElement elem = succ.iterator().next();
        assertThat(FlowGraphUtil.isStagePadding(elem), is(true));
        assertThat(FlowGraphUtil.getSuccessors(elem),
            is(gen.getAsSet("out1", "out2", "out3")));
    }
View Full Code Here

        FlowGraphUtil.insertIdentity(gen.output("in"));

        Set<FlowElement> succ = FlowGraphUtil.getSuccessors(gen.get("in"));
        assertThat(succ.size(), is(1));
        FlowElement elem = succ.iterator().next();
        assertThat(FlowGraphUtil.isIdentity(elem), is(true));
        assertThat(FlowGraphUtil.getSuccessors(elem),
            is(gen.getAsSet("out")));
    }
View Full Code Here

        FlowGraphUtil.insertIdentity(gen.output("in"));

        Set<FlowElement> succ = FlowGraphUtil.getSuccessors(gen.get("in"));
        assertThat(succ.size(), is(1));
        FlowElement elem = succ.iterator().next();
        assertThat(FlowGraphUtil.isIdentity(elem), is(true));
        assertThat(FlowGraphUtil.getSuccessors(elem),
            is(gen.getAsSet("out1", "out2", "out3")));
    }
View Full Code Here

TOP

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

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.