Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.RequestNode


                    throw new UnresolvedVariableException(connection.mPE);
                }
                value = variable.getValue(connection.mArrayIndices);
                if (value instanceof RequestNode)
                {
                    RequestNode node = (RequestNode)value;
                    mConnection = node.getOutput(connection.mName, connection.mIndex.intValue());
                }
                else
                {
                    throw new TypeMismatchException("ProcessingElement", value);
                }
            }
            break;
        }
        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
                        {
                            node.connectInput(connection.mName, connection.mIndex.intValue(), mConnection);
                        }
                    }
                    else
                    {
                        node.connectInput(connection.mName, connection.mIndex.intValue(), mConnection);
                    }
                }
                else
                {
                    throw new TypeMismatchException("ProcessingElement", value);
View Full Code Here


            {
                value = variable.getValue(mArrayIndices);
            }
            if (value instanceof RequestNode)
            {
                RequestNode node = (RequestNode)value;
                if (mIsInput)
                {
                    return node.getInput(mName, mIndex.intValue());
                }
                else
                {
                    return node.getOutput(mName, mIndex.intValue());
                }
            }
            else
            {
                throw new TypeMismatchException("ProcessingElement", value);
View Full Code Here

        {
            value = variable.getValue(mPEVariableArrayIndices);
        }
        if (value instanceof RequestNode)
        {
            RequestNode node = (RequestNode)value;
            node.addAnnotation(mAnnotationKey, mAnnotationValue);
        }
        else
        {
            throw new TypeMismatchException("ProcessingElement", value);
        }
View Full Code Here

    public void submit(Expression expression) throws Exception
    {
        Object value = expression.evaluate(mExecutionState.getVariables());
        if (value instanceof RequestNode)
        {
            RequestNode node = (RequestNode)value;
            Graph graph = GraphUtilities.getConnectedComponent(node);
           
            // now replace all subgraphs with their composite processing elements
            for (Variable var : mExecutionState.getVariables().values())
            {
                if (var.getType() instanceof ProcessingElementType)
                {
                    if (var.getValue() instanceof CompositeProcessingElement)
                    {
                        CompositeProcessingElement composite =
                            (CompositeProcessingElement)var.getValue();
                        List<RequestNode> elements = composite.getElements();
                        if (graph.getNodes().removeAll(elements))
                        {
                            graph.add(composite);
                        }
                    }
                }
            }
            if (!mSubmittedGraphs.add(graph))
            {
                LOG.warn("Ignoring submit of graph containing processing element "
                        + node.getName()
                        + " because it has already been submitted.");
            }
        }
        else
        {
View Full Code Here

                    "|- [ 0 ] -| => d; |- [ 1 ] -| => d; " +
                    "A a = new A; |- 0 -| => a.in; |- 1 -| => a.in; ");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("c");
        assertTrue(var.getValue() instanceof Connection);
        RequestNode source = ((Connection)var.getValue()).getSource();
        assertTrue(source instanceof LiteralValuesNode);
        List<Object> values = ((LiteralValuesNode)source).getValues();
        assertEquals(Arrays.asList(0l, 1l, 2l), values);
       
        var = builder.getDispelExecutionState().getVariables().get("d");
View Full Code Here

                    "     p.output => b.input[i]; " +
                    "}");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("b");
        assertTrue(var.getValue() instanceof RequestNode);
        RequestNode node = (RequestNode)var.getValue();
        for (int i=0; i<4; i++)
        {
            RequestNode a = node.getInput("input", i).getSource();
            RequestNode source = a.getInput("input", 0).getSource();
            assertTrue(source instanceof LiteralValuesNode);
            assertEquals(
                    Arrays.asList(Long.valueOf(i)),
                    ((LiteralValuesNode)source).getValues());
        }
View Full Code Here

        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

        {
            for (Entry<Integer, Connection> input : inputs.getValue().entrySet())
            {
                for (RequestNodeInput inp : input.getValue().getTargets())
                {
                    RequestNode node = inp.getRequestNode();
                    nodes.addAll(GraphUtilities.getConnectedComponent(node).getNodes());
                }
            }
        }
        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

                    // this is valid so we're just ignoring it
                        continue;
                }
                for (Entry<Integer, Connection> connection : input.entrySet())
                {
                    RequestNode source = connection.getValue().getSource();
                    String name = connection.getValue().getSourceOutputName();
                    ProcessingElementOutputDescriptor outputDescriptor =
                        getOutputDescriptor(source, name);
                    try
                    {
                        RequestNode converter =
                            mTypeChecker.checkCompatibility(
                                    outputDescriptor, inputDescriptor);
                        insertConverter(
                                newNodes,
                                requestNode,
View Full Code Here

        List<RequestNode> nodes = transformed.getNodes();
        TestCase.assertTrue(nodes.remove(a));
        TestCase.assertTrue(nodes.remove(c));
        TestCase.assertTrue(!nodes.contains(b));
        TestCase.assertEquals(1, nodes.size());
        RequestNode node = nodes.get(0);
        TestCase.assertTrue(node instanceof CompositeProcessingElement);
        CompositeProcessingElement composite = (CompositeProcessingElement)node;
        TestCase.assertEquals(2, composite.getElements().size());
    }
View Full Code Here

TOP

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

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.