Package ptolemy.data.type

Examples of ptolemy.data.type.ArrayType$ElementTypeTerm


        String[] labels = new String[] { "name", "value" };
        Type[] values = new Type[] { BaseType.STRING, BaseType.STRING };

        // An array of records {{name = "", value = ""}}
        environment
                .setTypeEquals(new ArrayType(new RecordType(labels, values)));

        // Array with an empty name and value means
        // default environment of the calling process.
        environment.setExpression("{{name = \"\", value = \"\"}}");
View Full Code Here


            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        dataToSend = new TypedIOPort(this, "dataToSend");
        dataToSend.setInput(true);
        dataToSend.setTypeEquals(new ArrayType(BaseType.UNSIGNED_BYTE));

        dataReceived = new TypedIOPort(this, "dataReceived");
        dataReceived.setOutput(true);
        dataReceived.setTypeEquals(new ArrayType(BaseType.UNSIGNED_BYTE));

        serialPortName = new StringParameter(this, "serialPortName");

        // Enumerate the available ports.
        Enumeration ports = CommPortIdentifier.getPortIdentifiers();
View Full Code Here

    public DiscreteRandomSource(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);
        pmf = new Parameter(this, "pmf");
        pmf.setExpression("{0.5, 0.5}");
        pmf.setTypeEquals(new ArrayType(BaseType.DOUBLE));

        // set the values parameter
        values = new Parameter(this, "values");
        values.setExpression("{0, 1}");
View Full Code Here

            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        indexes = new Parameter(this, "indexes");
        indexes.setExpression("{0, 1}");
        indexes.setTypeEquals(new ArrayType(BaseType.INT));

        // Call this so that we don't have to copy its code here...
        attributeChanged(indexes);

        // set values parameter
View Full Code Here

        // Tell the file browser to allow only selection of directories.
        directoryOrURL = new FilePortParameter(this, "directoryOrURL");
        new Parameter(directoryOrURL, "allowFiles", BooleanToken.FALSE);
        new Parameter(directoryOrURL, "allowDirectories", BooleanToken.TRUE);

        output.setTypeEquals(new ArrayType(BaseType.STRING));

        pattern = new StringParameter(this, "pattern");
        pattern.setExpression("");

        listOnlyDirectories = new Parameter(this, "listOnlyDirectories");
View Full Code Here

        period.setExpression("2.0");
        period.setTypeEquals(BaseType.DOUBLE);

        offsets = new Parameter(this, "offsets");
        offsets.setExpression("{0.0, 1.0}");
        offsets.setTypeEquals(new ArrayType(BaseType.DOUBLE));

        // Call this so that we don't have to copy its code here...
        attributeChanged(offsets);

        // Set the values parameter.
View Full Code Here

        try {
            if (tokenClass.equals(ptolemy.data.Token.class)) {
                return BaseType.GENERAL;
            } else if (ptolemy.data.ArrayToken.class
                    .isAssignableFrom(tokenClass)) {
                Type type = new ArrayType(BaseType.GENERAL);
                return type;
            } else if (ptolemy.data.RecordToken.class
                    .isAssignableFrom(tokenClass)) {
                Type type = new RecordType(new String[0], new Type[0]);
                return type;
            } else if (ptolemy.data.Token.class.isAssignableFrom(tokenClass)) {
                Type type = BaseType.forClassName(tokenClass.getName());

                if (type == null) {
                    throw new IllegalActionException(
                            "Could not return type for class " + tokenClass);
                }

                return type;
            } else if (tokenClass.equals(Boolean.class)
                    || tokenClass.equals(Boolean.TYPE)) {
                return BaseType.BOOLEAN;
            } else if (tokenClass.equals(Byte.class)
                    || tokenClass.equals(Byte.TYPE)) {
                return BaseType.UNSIGNED_BYTE;
            } else if (tokenClass.equals(Short.class)
                    || tokenClass.equals(Short.TYPE)) {
                return BaseType.SHORT;
            } else if (tokenClass.equals(Integer.class)
                    || tokenClass.equals(Integer.TYPE)) {
                return BaseType.INT;
            } else if (tokenClass.equals(Long.class)
                    || tokenClass.equals(Long.TYPE)) {
                return BaseType.LONG;
            } else if (tokenClass.equals(Double.class)
                    || tokenClass.equals(Double.TYPE)) {
                return BaseType.DOUBLE;
            } else if (tokenClass.equals(Float.class)
                    || tokenClass.equals(Float.TYPE)) {
                return BaseType.FLOAT;
            } else if (tokenClass.equals(Complex.class)) {
                return BaseType.COMPLEX;
            } else if (tokenClass.equals(FixPoint.class)) {
                return BaseType.UNSIZED_FIX;
            } else if (tokenClass.equals(String.class)) {
                return BaseType.STRING;
            } else if (tokenClass.equals(Class.forName("[[Z"))) {
                return BaseType.BOOLEAN_MATRIX;
            } else if (tokenClass.equals(Class.forName("[[I"))) {
                return BaseType.INT_MATRIX;
            } else if (tokenClass.equals(Class.forName("[[J"))) {
                return BaseType.LONG_MATRIX;
            } else if (tokenClass.equals(Class.forName("[[D"))) {
                return BaseType.DOUBLE_MATRIX;
            } else if (tokenClass.equals(Class
                    .forName("[[Lptolemy.math.Complex;"))) {
                return BaseType.COMPLEX_MATRIX;
            } else if (tokenClass.equals(Class
                    .forName("[[Lptolemy.math.FixPoint;"))) {
                return BaseType.FIX_MATRIX;
            } else if (tokenClass.isArray()) {
                return new ArrayType(convertJavaTypeToTokenType(tokenClass
                        .getComponentType()));
            } else if (java.lang.Object.class.isAssignableFrom(tokenClass)) {
                return BaseType.OBJECT;
            } else {
                // This should really never happen, since every class
View Full Code Here

            } else if (type.equals(BaseType.LONG_MATRIX)) {
                return Class.forName("[[J");
            } else if (type.equals(BaseType.BOOLEAN_MATRIX)) {
                return Class.forName("[[Z");
            } else if (type instanceof ArrayType) {
                ArrayType arrayType = (ArrayType) type;
                Type elementType = arrayType.getElementType();

                if (elementType.equals(BaseType.DOUBLE)) {
                    return Class.forName("[D");
                } else if (elementType.equals(BaseType.INT)) {
                    return Class.forName("[I");
                } else if (elementType.equals(BaseType.LONG)) {
                    return Class.forName("[J");
                } else if (elementType.equals(BaseType.BOOLEAN)) {
                    return Class.forName("[Z");
                } else {
                    return java.lang.reflect.Array.newInstance(
                            convertTokenTypeToJavaType(arrayType
                                    .getElementType()), 0).getClass();
                }
            } else {
                // Bailout.  The type is not recognized, so defer to
                // the type for some basic information.
View Full Code Here

            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        correctValues = new Parameter(this, "correctValues");
        correctValues.setExpression("{true}");
        correctValues.setTypeEquals(new ArrayType(BaseType.UNKNOWN));

        tolerance = new Parameter(this, "tolerance");
        tolerance.setExpression("1.0E-9");
        tolerance.setTypeEquals(BaseType.DOUBLE);
View Full Code Here

         * cannot be determined.
         */
        private ArrayType _getArrayTypeRaw() throws IllegalActionException  {
            Type type = input.getType();
            if (_arrayType == null || !_arrayType.getElementType().equals(type)) {
                $ASSIGN$_arrayType(new ArrayType(type));
            }
            return _arrayType;
        }
View Full Code Here

TOP

Related Classes of ptolemy.data.type.ArrayType$ElementTypeTerm

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.