Examples of RecordType


Examples of ptolemy.data.type.RecordType

        // 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

Examples of ptolemy.data.type.RecordType

        // 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

Examples of ptolemy.data.type.RecordType

        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

Examples of ptolemy.data.type.RecordType

        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

Examples of ptolemy.data.type.RecordType

     *  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

Examples of ptolemy.data.type.RecordType

        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

Examples of ptolemy.data.type.RecordType

                    .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) {
View Full Code Here

Examples of ptolemy.data.type.RecordType

            throws IllegalActionException {
        Type[] childTypes = _inferAllChildren(node);

        // Handle indexing into a record.
        if ((childTypes.length == 1) && childTypes[0] instanceof RecordType) {
            RecordType type = (RecordType) childTypes[0];

            if (type.labelSet().contains(node.getMethodName())) {
                _setType(node, type.get(node.getMethodName()));
                return;
            }
        }

        CachedMethod cachedMethod = CachedMethod.findMethod(node
View Full Code Here

Examples of ptolemy.data.type.RecordType

        Type[] childTypes = _inferAllChildren(node);

        String[] names = (String[]) node.getFieldNames().toArray(
                new String[node.jjtGetNumChildren()]);

        _setType(node, new RecordType(names, childTypes));
    }
View Full Code Here

Examples of ptolemy.data.type.RecordType

        // Set the type of the output port.
        //output.setMultiport(true);
        output.setTypeEquals(BaseType.STRING);

        styleSheetParameters = new PortParameter(this, "styleSheetParameters");
        styleSheetParameters.setTypeAtMost(new RecordType(new String[0],
                new Type[0]));
        styleSheetParameters.setExpression("emptyRecord()");
        styleSheetFile = new FileParameter(this, "styleSheetFile");

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.