Package eu.admire.dispel.parser.types

Examples of eu.admire.dispel.parser.types.Variable


    {
        switch (context)
        {
        case NEW_INSTANCE:
            NewInstanceStrategy instance = (NewInstanceStrategy)strategy;
            mVariable = new Variable(instance.getType());
            instance.assign(mVariable, null);
            break;
        case CREATE_PE:
            CreatePETypeStrategy create = (CreatePETypeStrategy)strategy;
            mVariable = new Variable(create.getType(), create.getPE());
            break;
        case INNER_EXPRESSION:
            mReturnExpression = ((InnerExpressionStrategy)strategy).getInnerExpression();
            break;
        }
View Full Code Here


                "  return PE(<Connection input = c> => <>); } " +
                "PE(<Connection input>=><>) MyPE = f();\n" +
                "MyPE myPE = new MyPE;\n" +
                "|- 1, 2, 3 -| => myPE.input; ");
        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();
View Full Code Here

                "{ return 10; } " +
                "Connection c;" +
                "a = a + f(c);" +
                "Stype s is [ Real ];");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("a");
        assertNotNull(var);
        assertEquals(
                20l,
                var.getValue());
        Type type = builder.getDispelExecutionState().getUsedProcessingElements().getType("s");
        assertNotNull(type);
        assertTrue(type instanceof StructuralType);
        assertTrue(((StructuralType)type).getSType() instanceof ListSType);
    }
View Full Code Here

            "PE<A>[] AnotherPE = new PE<A>[3];\n" +
            "A a = new A;\n" +
            "AnotherPE[0] = createA();\n" +
            "AnotherPE[2] = createA();");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("MyPE");
        assertTrue(var.getType() instanceof ProcessingElementTypeType);
        assertEquals(Arrays.asList(10), var.getArraySizes());
        for (int i=0; i<10; i++)
        {
            assertNull(var.getValue(Arrays.asList(i)));
        }
        var = builder.getDispelExecutionState().getVariables().get("AnotherPE");
        assertTrue(var.getType() instanceof ProcessingElementTypeType);
        assertEquals(Arrays.asList(3), var.getArraySizes());
    }
View Full Code Here

                "package test {" +
                "  use example.MyPE;\n " +
                "  MyPE p = new MyPE with data as :[String];" +
                "}");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("p");
        Object value = var.getValue();
        assertTrue(value instanceof ProcessingElementNode);
        ProcessingElementDescriptor descriptor =
            ((ProcessingElementNode) value).getProcessingElementDescriptor();
        assertEquals("[String]", descriptor.getInput("data").getSType().toString());
    }
View Full Code Here

        DISPELGraphBuilder builder = runDISPEL(
                "use uk.org.ogsadai.SQLQuery;" +
                "SQLQuery sqlQuery = new SQLQuery with data as output:[<Integer i, j; Real r; String s>], expression as input;"
                );
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("sqlQuery");
        assertNotNull(var);
        assertTrue(var.getValue() instanceof ProcessingElementNode);
        ProcessingElementDescriptor descriptor =
            ((ProcessingElementNode)var.getValue()).getProcessingElementDescriptor();
        assertNull(descriptor.getOutput("data"));
        assertNotNull(descriptor.getOutput("output"));
    }
View Full Code Here

                    "PE<MyPE> SubPE = create(); " +
                    "MyPE[] pes = new MyPE[2]; " +
                    "pes[0] = new SubPE; " +
                    "}");
        assertNull(mError);
        Variable var = builder.getDispelExecutionState().getVariables().get("SubPE");
        assertNotNull(var);
        ProcessingElementType pe = (ProcessingElementType)var.getValue();
        assertTrue(pe.getDescriptor().getSuperType().contains("eu.admire.MyPE"));
        var = builder.getDispelExecutionState().getVariables().get("pes");
        assertNotNull(var);
        Object value = var.getValue(Arrays.asList(0));
        assertTrue(value instanceof CompositeProcessingElement);
        assertNotNull(((CompositeProcessingElement)value).getElements());
    }
View Full Code Here

            ProcessingElementTypeType type = ((PETypeStrategy)strategy).getPEType();
            mPE = new ProcessingElementType();
            mPE.setDescriptor(type.getDescriptor());
            mPE.setName(qualifiedName);
            mType = type;
            mExecutionState.getVariables().put(mName, new Variable(type, mPE));
            mExecutionState.getUsedProcessingElements().registerType(qualifiedName, mPE);
            mExecutionState.getNamespaceManager().addUsingDeclaration(qualifiedName);
            break;
        }
        case CONNECTION:
View Full Code Here

            // other types too?
            ProcessingElementType pe = (ProcessingElementType)type;
            ProcessingElementTypeType petype =
                new ProcessingElementTypeType(pe.getDescriptor());
            mType = petype;
            mExecutionState.getVariables().put(mName, new Variable(petype, type));
        }
    }
View Full Code Here

        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out2", 0, connection2);
        nodeB.connectInput("in2", 0, connection2);
        Map<String, Variable> variables = new HashMap<String, Variable>();
        variables.put("query", new Variable(new ProcessingElementType("uk.org.ogsadai.SQLQuery"), nodeA));
        variables.put("results", new Variable(new ProcessingElementType("eu.admire.Results"), nodeB));
        String dot = DotGenerator.generate(graph.getNodes(), variables);
        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

TOP

Related Classes of eu.admire.dispel.parser.types.Variable

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.