Package ptolemy.data.type

Examples of ptolemy.data.type.RecordType$FieldType


        for (int i = 0; i < size; i++) {
            labels[i] = ((Port) portArray[i]).getName();
            types[i] = BaseType.GENERAL;
        }

        RecordType declaredType = new RecordType(labels, types);

        input.setTypeAtMost(declaredType);

        // set the constraints between record fields and output ports
        List constraints = new LinkedList();
View Full Code Here


         */
        public Object getValue() throws IllegalActionException {
            if (input.getType() == BaseType.UNKNOWN) {
                return BaseType.UNKNOWN;
            } else if (input.getType() instanceof RecordType) {
                RecordType type = (RecordType) input.getType();
                Type fieldType = type.get(_name);

                if (fieldType == null) {
                    return BaseType.UNKNOWN;
                } else {
                    return fieldType;
View Full Code Here

        /** Return an additional string describing the current value
         *  of this function.
         */
        public String getVerboseString() {
            if (input.getType() instanceof RecordType) {
                RecordType type = (RecordType) input.getType();
                Type fieldType = type.get(_name);

                if (fieldType == null) {
                    return "Input Record doesn't have field named " + _name;
                }
            }
View Full Code Here

        // Force the type of the defaultProperties to at least include
        // the range field.
        String[] labels = { "range" };
        Type[] types = { BaseType.DOUBLE };
        RecordType type = new RecordType(labels, types);

        // Setting an upper bound allows the addition of fields.
        defaultProperties.setTypeAtMost(type);
        defaultProperties.setExpression("{range=Infinity}");
    }
View Full Code Here

        // the range field. This must be done after setting the value
        // above, because the value in the base class is not a subtype
        // of this specified type.
        String[] labels = { "range", "power" };
        Type[] types = { BaseType.DOUBLE, BaseType.DOUBLE };
        RecordType type = new RecordType(labels, types);

        // Setting an upper bound allows the addition of fields.
        defaultProperties.setTypeAtMost(type);

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

        // Force the type of the defaultProperties to at least include
        // the range field.
        String[] labels = { "range" };
        Type[] types = { BaseType.DOUBLE };
        RecordType type = new RecordType(labels, types);

        // Setting an upper bound allows the addition of fields.
        defaultProperties.setTypeAtMost(type);
        defaultProperties.setExpression("{range = Infinity}");
    }
View Full Code Here

        super(container, name);
        update = new TypedIOPort(this, "update", true, false);

        String[] labels = { "lot", "state" };
        Type[] types = { BaseType.STRING, BaseType.INT };
        RecordType recordType = new RecordType(labels, types);
        update.setTypeEquals(recordType);

        debug = new TypedIOPort(this, "debug", false, true);
        debug.setTypeEquals(recordType);
View Full Code Here

        for (int i = 0; i < size; i++) {
            labels[i] = (String) labelsObjects[i];
            types[i] = get(labels[i]).getType();
        }

        return new RecordType(labels, types);
    }
View Full Code Here

     *  corresponding function.
     *  @return The type of the value returned from the corresponding function.
     */
    public static Type mergeReturnType(Type type1, Type type2) {
        if (type1 instanceof RecordType && type2 instanceof RecordType) {
            RecordType recordType1 = (RecordType) type1;
            RecordType recordType2 = (RecordType) type2;

            Set unionSet = new HashSet();
            Set labelSet1 = recordType1.labelSet();
            Set labelSet2 = recordType2.labelSet();
            unionSet.addAll(labelSet1);
            unionSet.addAll(labelSet2);

            Object[] labelsObjects = unionSet.toArray();
            int size = labelsObjects.length;
            String[] labels = new String[size];
            Type[] types = new Type[size];

            for (int i = 0; i < size; i++) {
                labels[i] = (String) labelsObjects[i];

                Type fieldType = recordType1.get(labels[i]);

                if (fieldType != null) {
                    types[i] = fieldType;
                } else {
                    types[i] = recordType2.get(labels[i]);
                }
            }

            return new RecordType(labels, types);
        } else {
            return BaseType.UNKNOWN;
        }
    }
View Full Code Here

        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

TOP

Related Classes of ptolemy.data.type.RecordType$FieldType

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.