Package ptolemy.data.type

Examples of ptolemy.data.type.RecordType$FieldType


                    .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


            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

        Type[] childTypes = _inferAllChildren(node);

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

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

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

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

        RecordType declaredType = new RecordType(labels, types);

        output.setTypeEquals(declaredType);

        // set the constraints between record fields and input ports
        _typeConstraintList = new LinkedList();

        // since the output port has a clone of the above RecordType, need to
        // get the type from the output port.
        RecordType outputType = (RecordType) output.getType();

        Iterator inputPorts = inputPortList().iterator();

        while (inputPorts.hasNext()) {
            TypedIOPort inputPort = (TypedIOPort) inputPorts.next();
            String label = inputPort.getName();
            Inequality inequality = new Inequality(inputPort.getTypeTerm(),
                    outputType.getTypeTerm(label));
            _typeConstraintList.add(inequality);
        }
        _typeConstraintListVersion = workspace().getVersion();
        return _typeConstraintList;
    }
View Full Code Here

        // Handle indexing into a record.
        ptolemy.data.type.Type baseTokenType = ((ASTPtRootNode) node
                .jjtGetChild(0)).getType();

        if ((argCount == 1) && baseTokenType instanceof RecordType) {
            RecordType type = (RecordType) baseTokenType;

            if (type.labelSet().contains(node.getMethodName())) {
                Local originalBaseLocal = (Local) _nodeToLocal.get(node
                        .jjtGetChild(0));
                Local baseLocal = Jimple.v().newLocal("base",
                        RefType.v(PtolemyUtilities.recordTokenClass));
                _body.getLocals().add(baseLocal);
View Full Code Here

     */
    public List typeConstraintList() {
        String[] labels = new String[0];
        Type[] types = new Type[0];

        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

            if (!(inputType instanceof RecordType)) {
                return BaseType.UNKNOWN;
            }

            RecordType recordType = (RecordType) inputType;
            Map outputMap = new HashMap();
            Set recordLabels = recordType.labelSet();
            Iterator iterator = recordLabels.iterator();

            while (iterator.hasNext()) {
                String label = (String) iterator.next();
                Type type = recordType.get(label);
                outputMap.put(label, type);
            }

            List inputPorts = inputPortList();
            iterator = inputPorts.iterator();

            while (iterator.hasNext()) {
                TypedIOPort port = (TypedIOPort) iterator.next();

                if (port != input) {
                    outputMap.put(port.getName(), port.getType());
                }
            }

            // Construct the RecordType
            Object[] labelsObj = outputMap.keySet().toArray();
            String[] labels = new String[labelsObj.length];
            Type[] types = new Type[labelsObj.length];

            for (int i = 0; i < labels.length; i++) {
                labels[i] = (String) labelsObj[i];
                types[i] = (Type) outputMap.get(labels[i]);
            }

            return new RecordType(labels, types);
        }
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.