Package ptolemy.data.type

Examples of ptolemy.data.type.Type


     @return The converted token.
     *  @exception IllegalActionException If the conversion is
     *   invalid.
     */
    public Token convert(Token token) throws IllegalActionException {
        Type type = getType();

        if (type.equals(token.getType())) {
            return token;
        } else {
            Token newToken = type.convert(token);
            return newToken;
        }
    }
View Full Code Here


     */
    public Type getType() {
        try {
            _workspace.getReadAccess();

            Type result = BaseType.UNKNOWN;

            if (isOpaque()) {
                result = _resolvedType;
            } else if (isInput()) {
                // is a transparent input port. Get all the ports connected
View Full Code Here

                        "TypedIOPort.setTypeEquals: Cannot clone type");
            }

            // Note: we are careful here to set the type before notifying
            // type listeners.
            Type oldType = _resolvedType;
            _resolvedType = _declaredType;

            if (!oldType.equals(_declaredType)) {
                _notifyTypeListener(oldType, _declaredType);
            }
        } finally {
            _workspace.doneWriting();
        }
View Full Code Here

        ylocation = new TypedIOPort(this, "ylocation", false, true);
        ylocation.setTypeEquals(BaseType.DOUBLE);

        workRange = new Parameter(this, "workRange");

        Type rangeType = new ArrayType(new ArrayType(BaseType.DOUBLE));
        workRange.setTypeEquals(rangeType);
        workRange.setExpression("{{0.0, 500.0}, {0.0, 500.0}}");
    }
View Full Code Here

                        + port.getFullName() + " and "
                        + matchingPort.getFullName()
                        + " must be both input ports or output ports.");
            }

            Type portType = port.getType();
            Type matchingPortType = matchingPort.getType();

            if (port.isInput() && !matchingPortType.isCompatible(portType)) {
                throw new IllegalActionException(this, "The type of the port "
                        + port.getName() + " of the actor " + getName()
                        + " must be equal to or less than "
                        + "that of the matching port.");
            }
View Full Code Here

            if (!(type instanceof Type)) {
                throw new IllegalActionException("TypeTerm.initialize: "
                        + "The argument is not a Type.");
            }

            Type oldType = _resolvedType;

            if (_declaredType == BaseType.UNKNOWN) {
                _resolvedType = (Type) type;
            } else {
                // _declaredType is a StructuredType
                ((StructuredType) _resolvedType).initialize((Type) type);
            }

            if (!oldType.equals(_resolvedType)) {
                _notifyTypeListener(oldType, _resolvedType);
            }
        }
View Full Code Here

                        + ".\n"
                        + "The connection or type constraints, however, "
                        + "require type " + type.toString());
            }

            Type oldType = _resolvedType;

            if (_declaredType == BaseType.UNKNOWN) {
                _resolvedType = (Type) type;
            } else {
                // _declaredType is a StructuredType
                ((StructuredType) _resolvedType)
                        .updateType((StructuredType) type);
            }

            if (!oldType.equals(type)) {
                _notifyTypeListener(oldType, _resolvedType);
            }
        }
View Full Code Here

            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]);
View Full Code Here

     @param event The type change event.
     */
    public void typeChanged(TypeEvent event) {
        _message = event.getSource().getFullName() + "/";

        Type oldtype = event.getOldType();
        _message += (oldtype.toString() + "/");

        Type newtype = event.getNewType();
        _message += newtype.toString();
    }
View Full Code Here

        boolean isUndeclared = sourcePort.getTypeTerm().isSettable();

        if (!isUndeclared) {
            // sourcePort has a declared type.
            Type srcDeclared = sourcePort.getType();
            Iterator destinationPorts = destinationPortList.iterator();

            while (destinationPorts.hasNext()) {
                TypedIOPort destinationPort = (TypedIOPort) destinationPorts
                        .next();
                isUndeclared = destinationPort.getTypeTerm().isSettable();

                if (!isUndeclared) {
                    // both source/destination ports are declared,
                    // check type
                    Type destDeclared = destinationPort.getType();
                    int compare = TypeLattice
                            .compare(srcDeclared, destDeclared);

                    if ((compare == CPO.HIGHER)
                            || (compare == CPO.INCOMPARABLE)) {
View Full Code Here

TOP

Related Classes of ptolemy.data.type.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.