Package com.asakusafw.vocabulary.flow.graph

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


     * @return 追加した要素
     */
    public FlowElement defineFlowPart(
            String name,
            FlowGraph graph) {
        FlowElementDescription desc = new FlowPartDescription(graph);
        return register(name, desc);
    }
View Full Code Here


            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);
View Full Code Here

        FlowElementDescription description = element.getDescription();
        if (description.getKind() != FlowElementKind.FLOW_COMPONENT) {
            throw new IllegalArgumentException("element must be a flow component"); //$NON-NLS-1$
        }

        FlowPartDescription component = (FlowPartDescription) description;
        FlowGraph graph = component.getFlowGraph();

        // フロー部品の外側からの入力と、フロー部品の内部の入力を結線する
        List<FlowElementInput> externalInputs = element.getInputPorts();
        List<FlowElementOutput> internalInputs = Lists.create();
        for (FlowIn<?> fin : graph.getFlowInputs()) {
View Full Code Here

    private boolean rewriteGraph(FlowGraph graph) {
        boolean modified = false;
        for (FlowElement element : FlowGraphUtil.collectElements(graph)) {
            if (element.getDescription().getKind() == FlowElementKind.FLOW_COMPONENT) {
                FlowPartDescription desc = (FlowPartDescription) element.getDescription();
                rewriteGraph(desc.getFlowGraph());
            } else if (isDebugLogging(element)) {
                LOG.debug("デバッグ用のロギング演算子を削除します: {}", element);
                FlowGraphUtil.skip(element);
            }
        }
View Full Code Here

        Object operator = invoke(factory, "create", in);

        Source<MockHoge> flowOut = output(MockHoge.class, operator, "out");
        out.add(flowOut);

        FlowPartDescription desc = (FlowPartDescription) flowOut
            .toOutputPort()
            .getOwner()
            .getDescription();

        assertThat(desc.getInputPorts().size(), is(1));
        assertThat(desc.getInputPorts().get(0).getName(), is("in"));
        assertThat(desc.getInputPorts().get(0).getDataType(), is((Object) MockHoge.class));
        assertThat(desc.getOutputPorts().size(), is(1));
        assertThat(desc.getOutputPorts().get(0).getName(), is("out"));
        assertThat(desc.getOutputPorts().get(0).getDataType(), is((Object) MockHoge.class));

        Graph<String> graph = toGraph(in);
        assertThat(graph.getConnected("in"), isJust("Generic"));
        assertThat(graph.getConnected("Generic"), isJust("out"));

        FlowGraph flow = desc.getFlowGraph();
        assertThat(flow.getDescription(), is((Object) loader.loadClass("com.example.Generic")));
        assertThat(flow.getFlowInputs().size(), is(1));
        assertThat(flow.getFlowInputs().get(0).getDescription().getName(), is("in"));
        assertThat(flow.getFlowInputs().get(0).getDescription().getDataType(), is((Object) MockHoge.class));
        assertThat(flow.getFlowOutputs().size(), is(1));
View Full Code Here

        assertStored(loader, "OK");

        Source<MockHoge> flowOut = output(MockHoge.class, operator, "out");
        out.add(flowOut);

        FlowPartDescription desc = (FlowPartDescription) flowOut
            .toOutputPort()
            .getOwner()
            .getDescription();

        assertThat(desc.getInputPorts().size(), is(1));
        assertThat(desc.getInputPorts().get(0).getName(), is("in"));
        assertThat(desc.getInputPorts().get(0).getDataType(), is((Object) MockHoge.class));
        assertThat(desc.getOutputPorts().size(), is(1));
        assertThat(desc.getOutputPorts().get(0).getName(), is("out"));
        assertThat(desc.getOutputPorts().get(0).getDataType(), is((Object) MockHoge.class));

        Graph<String> graph = toGraph(in);
        assertThat(graph.getConnected("in"), isJust("Simple"));
        assertThat(graph.getConnected("Simple"), isJust("out"));

        FlowGraph flow = desc.getFlowGraph();
        assertThat(flow.getDescription(), is((Object) loader.loadClass("com.example.Simple")));
        assertThat(flow.getFlowInputs().size(), is(1));
        assertThat(flow.getFlowInputs().get(0).getDescription().getName(), is("in"));
        assertThat(flow.getFlowInputs().get(0).getDescription().getDataType(), is((Object) MockHoge.class));
        assertThat(flow.getFlowOutputs().size(), is(1));
View Full Code Here

        assertStored(loader, "OK");

        Source<MockHoge> flowOut = output(MockHoge.class, operator, "out");
        out.add(flowOut);

        FlowPartDescription desc = (FlowPartDescription) flowOut
            .toOutputPort()
            .getOwner()
            .getDescription();

        assertThat(desc.getInputPorts().size(), is(1));
        assertThat(desc.getInputPorts().get(0).getName(), is("in"));
        assertThat(desc.getInputPorts().get(0).getDataType(), is((Object) MockHoge.class));
        assertThat(desc.getOutputPorts().size(), is(1));
        assertThat(desc.getOutputPorts().get(0).getName(), is("out"));
        assertThat(desc.getOutputPorts().get(0).getDataType(), is((Object) MockHoge.class));

        Graph<String> graph = toGraph(in);
        assertThat(graph.getConnected("in"), isJust("Generic"));
        assertThat(graph.getConnected("Generic"), isJust("out"));

        FlowGraph flow = desc.getFlowGraph();
        assertThat(flow.getDescription(), is((Object) loader.loadClass("com.example.Generic")));
        assertThat(flow.getFlowInputs().size(), is(1));
        assertThat(flow.getFlowInputs().get(0).getDescription().getName(), is("in"));
        assertThat(flow.getFlowInputs().get(0).getDescription().getDataType(), is((Object) MockHoge.class));
        assertThat(flow.getFlowOutputs().size(), is(1));
View Full Code Here

        assertStored(loader, "OK");

        Source<MockFoo> flowOut = output(MockFoo.class, operator, "out");
        out.add(flowOut);

        FlowPartDescription desc = (FlowPartDescription) flowOut
            .toOutputPort()
            .getOwner()
            .getDescription();

        assertThat(desc.getInputPorts().size(), is(1));
        assertThat(desc.getInputPorts().get(0).getName(), is("in"));
        assertThat(desc.getInputPorts().get(0).getDataType(), is((Object) MockHoge.class));
        assertThat(desc.getOutputPorts().size(), is(1));
        assertThat(desc.getOutputPorts().get(0).getName(), is("out"));
        assertThat(desc.getOutputPorts().get(0).getDataType(), is((Object) MockFoo.class));

        Graph<String> graph = toGraph(in);
        assertThat(graph.getConnected("in"), isJust("GenericWithClass"));
        assertThat(graph.getConnected("GenericWithClass"), isJust("out"));

        FlowGraph flow = desc.getFlowGraph();
        assertThat(flow.getDescription(), is((Object) loader.loadClass("com.example.GenericWithClass")));
        assertThat(flow.getFlowInputs().size(), is(1));
        assertThat(flow.getFlowInputs().get(0).getDescription().getName(), is("in"));
        assertThat(flow.getFlowInputs().get(0).getDescription().getDataType(), is((Object) MockHoge.class));
        assertThat(flow.getFlowOutputs().size(), is(1));
View Full Code Here

                                    decl.toMethod().getName()));
                    context.connect(flowId, elementId);
                }
                break;
            case FLOW_COMPONENT:
                FlowPartDescription part = (FlowPartDescription) desc;
                Class<? extends FlowDescription> description = part.getFlowGraph().getDescription();
                String elementId = context.label(description, "FlowPart", description.getSimpleName());
                context.connect(flowId, elementId);
                dumpFlowBody(context, elementId, part.getFlowGraph());
                break;
            case INPUT:
            case OUTPUT:
            case PSEUD:
                break;
View Full Code Here

        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(
                copyComponent.getFlowGraph(),
                not(sameInstance(component)));
    }
View Full Code Here

TOP

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

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.