Package eu.admire.dispel.parser.types

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


    @Override
    public void setProcessingElement(String text)
        throws UnknownTypeException
    {
        Type type = mExecutionState.getUsedProcessingElements().getType(text);
        if (type instanceof ProcessingElementType)
        {
            ProcessingElementType used = (ProcessingElementType) type;
            ProcessingElementType peType =
                new ProcessingElementType(used.getImplementation());
            peType.setName(used.getName());
            mDescriptor = new SimpleProcessingElementDescriptor(
                    type.getName(),
                    TypeUtilities.cloneDescriptor(
                            ((ProcessingElementType)type).getDescriptor()),
                    null);
            peType.setDescriptor(mDescriptor);
            mType = peType;
View Full Code Here


                "namespace dispel \"dispel\";\n" +
                "Dtype X represents \"dispel:X\" " +
                "with f(g(h(x))), " +
                "@description=\"This is X!\";");
        TestCase.assertNull(mGraphBuilder.getError());
        Type type = builder.getDispelExecutionState().getUsedProcessingElements().getType("X");
        TestCase.assertTrue(type instanceof DomainType);
        DomainType dtype = (DomainType)type;
        TestCase.assertEquals("This is X!", dtype.getAnnotation("description"));
        Object assertion = dtype.getAnnotation(AnnotationKeys.ASSERTION_EXPRESSIONS);
        TestCase.assertTrue(assertion instanceof List<?>);
View Full Code Here

        DISPELGraphBuilder builder =
            mGraphBuilder.runDISPEL(
                "Stype Y is String[] " +
                "with @description=\"An Stype\";");
        TestCase.assertNull(mGraphBuilder.getError());
        Type type = builder.getDispelExecutionState().getUsedProcessingElements().getType("Y");
        TestCase.assertTrue(type instanceof StructuralType);
        StructuralType stype = (StructuralType)type;
        TestCase.assertEquals(1, stype.getAnnotationKeys().size());
        TestCase.assertEquals("An Stype", stype.getAnnotation("description"));
    }
View Full Code Here

        for (int i=0; i<arguments.size(); i++)
        {
            Object value =
                arguments.get(i).evaluate(executionState.getVariables());
            String paramName = indices.get(i);
            Type type = parameters.get(paramName);
            Variable variable = new Variable(type, value);
            result.put(paramName, variable);
            // add the parameter name to the used types
            // if its type is a processing element type
            if (type instanceof ProcessingElementTypeType
                    && arrayDimensions.get(paramName) == 0)
            {
                executionState.getUsedProcessingElements().
                    registerType(
                        paramName,
                        ((ProcessingElementType)type.cast(value)));
            }
        }
        return result;
    }
View Full Code Here

        String qName = mExecutionState.getNamespaceManager().resolve(name);
        RegisteredObject reg = null;
        try
        {
            // see if the object is a type
            Type type = mExecutionState.getUsedProcessingElements().getType(qName);
            reg = new RegisteredObject(qName, type);
        }
        catch (UnknownTypeException e)
        {
            // it's not a type so check if it's a function
View Full Code Here

        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

                "Type DataProjector is PE( <Connection:String::\"dispel:URI\" source;\n" +
                "Connection[]:[Integer]::\"data:Vector\" vectors> => " +
                "<Connection:[<rest>]::\"data:Projection\" projection> )" +
                "with lockstep(source, vectors);");
        assertNull(mError);
        Type type = builder.getDispelExecutionState().getUsedProcessingElements().getType("DataProjector");
        assertNotNull(type);
        assertTrue(type instanceof ProcessingElementType);
        ProcessingElementDescriptor descriptor =
            ((ProcessingElementType)type).getDescriptor();
        ProcessingElementInputDescriptor input = descriptor.getInput("vectors");
View Full Code Here

        switch (context)
        {
        case TUPLE_ELEMENT:
            TupleElementStrategy element = (TupleElementStrategy)strategy;
            String name = element.getElementName();
            Type type = element.getType();
            mTuple.addElement(name, type);
            break;
        }
    }
View Full Code Here

   
    @Override
    public void setProcessingElementType(String text)
            throws UnknownTypeException, TypeMismatchException
    {
        Type supertype = mExecutionState.getUsedProcessingElements().getType(text);
        if (supertype == null)
        {
            throw new UnknownTypeException(text);
        }
        String qName = mExecutionState.getNamespaceManager().resolve(mName);
        Type type = TypeUtils.newSubtypeOf(qName, supertype);
        mExecutionState.getUsedProcessingElements().registerType(qName, type);
        mExecutionState.getNamespaceManager().addUsingDeclaration(qName);
        if (type instanceof ProcessingElementType)
        {
            // PE types are registered as variables
View Full Code Here

            if (i != 0)
            {
                dispel.append(", ");
            }
            String parameterName = function.getIndices().get(i);
            Type parameterType = function.getParameters().get(parameterName);
            convertType(
                    parameterType,
                    function.getArrayDimensions().get(parameterName),
                    dispel,
                    usedPEs,
View Full Code Here

TOP

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

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.