Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Connection


        case INPUT:
        {
            ConnectionStrategy connection = (ConnectionStrategy)strategy;
            if (connection.mConnectionVar != null)
            {
                Connection c = (Connection) connection.mConnectionVar.getValue(connection.mArrayIndices);
                if (c == null ||
                        !(c.getSource() instanceof LiteralValuesNode &&
                                mConnection.getSource() instanceof LiteralValuesNode))
                {
                    connection.mConnectionVar.setValue(mConnection, connection.mArrayIndices);
                }
                else
                {
                    LiteralValuesNode literal = (LiteralValuesNode) c.getSource();
                    LiteralValuesNode current = (LiteralValuesNode) mConnection.getSource();
                    literal.add(current.getValues());
                }
            }
            else
            {
                Object value;
                Variable variable =
                    mExecutionState.getVariables().get(connection.mPE);
                if (variable == null)
                {
                    throw new UnresolvedVariableException(connection.mPE);
                }
                value = variable.getValue(connection.mArrayIndices);
                if (value instanceof RequestNode)
                {
                    RequestNode node = (RequestNode)value;
                    if (node.getAllInputs().containsKey(connection.mName))
                    {
                        Connection c = node.getAllInputs().get(connection.mName).get(connection.mIndex);
                        if (c != null && c.getSource() instanceof LiteralValuesNode
                                && mConnection.getSource() instanceof LiteralValuesNode)
                        {
                            LiteralValuesNode literal = (LiteralValuesNode) c.getSource();
                            LiteralValuesNode current = (LiteralValuesNode) mConnection.getSource();
                            literal.add(current.getValues());
                        }
                        else
                        {
View Full Code Here


        }
        for (Entry<String, Map<Integer, Connection>> outputs : mOutputs.getOutputs().entrySet())
        {
            for (Entry<Integer, Connection> output : outputs.getValue().entrySet())
            {
                Connection connection = output.getValue();
                RequestNode node = connection.getSource();
                nodes.addAll(GraphUtilities.getConnectedComponent(node).getNodes());
            }
        }
        Graph graph = new Graph();
        graph.addAll(nodes);
View Full Code Here

        Graph graph = builder.getSubmittedGraphs().iterator().next();
        for (RequestNode node : graph.getNodes())
        {
            if (node.getName().equals("a.A"))
            {
                Connection out1 = node.getOutput("out1", 0);
                RequestNodeInput input = out1.getTargets().get(0);
                assertEquals("b.B", input.getRequestNode().getName());
                assertEquals("input", input.getName());
                assertEquals(0, input.getIndex());
                Connection out2 = node.getOutput("out2", 0);
                input = out2.getTargets().get(0);
                assertEquals("b.B", input.getRequestNode().getName());
                assertEquals("input", input.getName());
                assertEquals(1, input.getIndex());
            }
        }
View Full Code Here

            "a1.other => c with @joe=\"eoj\";");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("a1");
        assertTrue(var.getValue() instanceof ProcessingElementNode);
        ProcessingElementNode a1 = (ProcessingElementNode)var.getValue();
        Connection output = a1.getOutput("output", 0);
        assertEquals("bla", output.getAnnotation("bli"));
        Connection other = a1.getOutput("other", 0);
        assertEquals("eoj", other.getAnnotation("joe"));
    }
View Full Code Here

        DISPELGraphBuilder builder =
            runDISPEL("Connection c; " +
                    "|- [ <s= { 1, 2, 3} > ] -| => c; ");
        assertNull(mError);
        Variable c = builder.getDispelExecutionState().getVariables().get("c");
        Connection connection = (Connection)c.getValue();
        LiteralValuesNode literal =
            (LiteralValuesNode)connection.getSource();
        List<Object> values = literal.getValues();
        assertEquals(ListMarker.BEGIN, values.get(0));
        assertTrue(values.get(1) instanceof Map);
        Map<String, Object> tuple = (Map<String, Object>) values.get(1);
        Object element = tuple.get("s");
View Full Code Here

        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("a1");
        assertNotNull(var);
        assertTrue(var.getValue() instanceof ProcessingElementNode);
        ProcessingElementNode a1 = (ProcessingElementNode)var.getValue();
        Connection out = a1.getOutput("output", 0);
        assertEquals(1, out.getTargets().size());
        System.out.println(a1);
    }
View Full Code Here

            "MyPE m = new MyPE;" +
            "|- 1 -| => m.in1; |- 2 -| => m.in2;");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("m");
        assertTrue(var.getValue() instanceof CompositeProcessingElement);
        Connection in1 = ((CompositeProcessingElement)var.getValue()).getInput("in1", 0);
        assertTrue(in1.getSource() instanceof LiteralValuesNode);
        assertEquals("a.A", in1.getTargets().get(0).getRequestNode().getName());
        Connection in2 = ((CompositeProcessingElement)var.getValue()).getInput("in2", 0);
        assertTrue(in2.getSource() instanceof LiteralValuesNode);
        assertEquals("b.B", in2.getTargets().get(0).getRequestNode().getName());
    }
View Full Code Here

        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("myPE");
        Object value = var.getValue();
        assertTrue(value instanceof CompositeProcessingElement);
        CompositeProcessingElement comp = (CompositeProcessingElement)value;
        Connection input = comp.getInput("input", 0);
        assertEquals(2, input.getTargets().size());
        RequestNode node = input.getTargets().get(0).getRequestNode();
        assertEquals("a.A", node.getName());
        assertNotNull(node.getAllInputs().get("in1"));
        node = input.getTargets().get(1).getRequestNode();
        assertEquals("b.B", node.getName());
        assertNotNull(node.getAllInputs().get("input"));
        assertTrue(input.getSource() instanceof LiteralValuesNode);
    }
View Full Code Here

        mExecutionState.getUsedProcessingElements().clear();
    }
   
    public void setConnection(String name) throws TypeMismatchException
    {
        Connection connection = new TeeConnection();
        Variable var = new Variable(new ConnectionType(), connection);
        mExecutionState.getVariables().put(name, var);
    }
View Full Code Here

            node.getAllOutputs().values().iterator().next();
        if (outputs.isEmpty())
        {
            throw new NullPointerException("Converter PE has no output.");
        }
        Connection connection = outputs.values().iterator().next();
        input.getRequestNode().connectInput(
                input.getName(), input.getIndex(), connection);
    }
View Full Code Here

TOP

Related Classes of eu.admire.dispel.graph.Connection

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.