Package com.asakusafw.vocabulary.flow.graph

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


        FlowGraph component = cgen.toGraph();

        gen = new FlowGraphGenerator();
        gen.defineInput("in");
        gen.defineOutput("out");
        FlowElement fc = gen.defineFlowPart("c", component);
        gen.connect("in", "c.in");
        gen.connect("c.out", "out");

        FlowGraphUtil.inlineFlowPart(fc);
View Full Code Here


                LOG.debug("Inserts checkpoint after {}", output);
                FlowGraphUtil.insertCheckpoint(output);
                continue;
            }
            FlowElementInput input = connections.iterator().next().getDownstream();
            FlowElement successor = input.getOwner();
            if (isPushDownTarget(successor) == false) {
                LOG.debug("Inserts checkpoint after {}", output);
                FlowGraphUtil.insertCheckpoint(output);
                continue;
            }
            LOG.debug("Pushdown operator {}", successor);
            work.addAll(successor.getOutputPorts());
        }
    }
View Full Code Here

        if (FlowGraphUtil.isStageBoundary(element) == false) {
            return;
        }
        for (FlowElementOutput output : element.getOutputPorts()) {
            for (FlowElementInput opposite : output.getOpposites()) {
                FlowElement successor = opposite.getOwner();
                if (FlowGraphUtil.isBoundary(successor)) {
                    FlowGraphUtil.insertIdentity(output);
                }
            }
        }
View Full Code Here

                Set<FlowElement> preds = FlowGraphUtil.getPredecessors(element);
                Set<FlowElement> succs = FlowGraphUtil.getSuccessors(element);
                assert preds.size() == 1 && succs.size() == 1 : "all identities must be splitted";

                // ブロック唯一の要素になりそうであれば残す
                FlowElement pred = preds.iterator().next();
                FlowElement succ = succs.iterator().next();
                if (FlowGraphUtil.isStageBoundary(pred) && FlowGraphUtil.isBoundary(succ)) {
                    continue;
                }
                LOG.debug("{}は不要な恒等演算子なので削除します", element);
View Full Code Here

        assert block != null;
        assert fragments != null;
        assert fgraph != null;
        Map<FlowElement, List<FlowBlock.Input>> inputGroups = new LinkedHashMap<FlowElement, List<FlowBlock.Input>>();
        for (FlowBlock.Input blockInput : block.getBlockInputs()) {
            FlowElement element = blockInput.getElementPort().getOwner();
            Maps.addToList(inputGroups, element, blockInput);
        }

        Map<FlowElement, Graph<Fragment>> streams = Maps.create();

        for (FlowElement element : inputGroups.keySet()) {
            Fragment head = fragments.get(element);
            Graph<Fragment> subgraph = createSubgraph(head, fgraph);
            streams.put(element, subgraph);
        }
        List<ReduceUnit> results = Lists.create();
        for (Map.Entry<FlowElement, Graph<Fragment>> entry : streams.entrySet()) {
            FlowElement element = entry.getKey();
            Graph<Fragment> subgraph = entry.getValue();
            List<Fragment> body = sort(subgraph);
            for (int i = 0, n = body.size(); i < n; i++) {
                body.set(i, body.get(i));
            }
View Full Code Here

            FlowElement element,
            Set<FlowElement> startElements) {
        assert context != null;
        assert element != null;
        assert startElements != null;
        FlowElement current = element;
        List<Factor> factors = Lists.create();
        List<ResourceFragment> resources = Lists.create();
        while (true) {
            Factor factor = getFactor(current);
            if (factor == null) {
                break;
            }
            factors.add(factor);
            resources.addAll(getResources(current));
            if (factor.isLineEnd()) {
                break;
            }
            Set<FlowElement> successors = FlowGraphUtil.getSuccessors(current);
            if (successors.size() != 1) {
                break;
            }
            FlowElement next = successors.iterator().next();
            if (startElements.contains(next)) {
                break;
            }
            current = next;
        }
View Full Code Here

            work.add(elem);
        }
        Graph<String> graph = Graphs.newInstance();

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

            String self = elem.getDescription().getName();
            if (saw.contains(self)) {
                continue;
            }
            saw.add(self);

            // 逆辺をキューに追加
            for (FlowElementInput input : elem.getInputPorts()) {
                for (PortConnection conn : input.getConnected()) {
                    work.add(conn.getUpstream().getOwner());
                }
            }

            // 順辺をグラフに追加
            for (FlowElementOutput output : elem.getOutputPorts()) {
                for (PortConnection conn : output.getConnected()) {
                    FlowElement opposite = conn.getDownstream().getOwner();
                    work.add(opposite);
                    String dest = opposite.getDescription().getName();
                    graph.addEdge(self, dest);
                }
            }
        }
View Full Code Here

        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));
        assertThat(params.get(0).getValue(), is((Object) 5));
View Full Code Here

            outputs.put(blockOutput.getElementPort(), blockOutput);
        }

        boolean changed = false;
        for (FlowBlock.Input blockInput : block.getBlockInputs()) {
            FlowElement element = blockInput.getElementPort().getOwner();
            if (FlowGraphUtil.isIdentity(element) == false) {
                continue;
            }
            FlowElementOutput output = element.getOutputPorts().get(0);
            FlowBlock.Output blockOutput = outputs.get(output);
            if (blockOutput == null) {
                continue;
            }
View Full Code Here

            }
        } else {
            for (FlowElement element : startings) {
                for (FlowElementOutput output : element.getOutputPorts()) {
                    for (PortConnection conn : output.getConnected()) {
                        FlowElement target = conn.getDownstream().getOwner();
                        if (passings.contains(target) || arrivals.contains(target)) {
                            results.add(conn);
                        }
                    }
                }
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.