Package ptolemy.data.type

Examples of ptolemy.data.type.Type.convert()


            Type type = ((ArrayType) getType()).getElementType();

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

        /** Override the base class to convert the token to the element
View Full Code Here


            if (declaredType instanceof StructuredType) {
                ((StructuredType) declaredType).initialize(BaseType.UNKNOWN);
            }

            if (declaredType.isCompatible(newToken.getType())) {
                newToken = declaredType.convert(newToken);
            } else {
                throw new IllegalActionException(this,
                        "Variable._setToken: Cannot store a token of type "
                                + newToken.getType().toString()
                                + ", which is incompatible with type "
View Full Code Here

        Type type = getType();

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

    /** Return the type of this port.  If this port is opaque, this method
View Full Code Here

        if (typeInfo == CPO.SAME) {
            Token result = _multiplyElement(rightArgument);
            return result;
        } else if (typeInfo == CPO.HIGHER) {
            Token convertedArgument = elementType.convert(rightArgument);

            try {
                Token result = _multiplyElement(convertedArgument);
                return result;
            } catch (IllegalActionException ex) {
View Full Code Here

            Type lubType = (Type) TypeLattice.lattice().leastUpperBound(
                    getType(), rightArgument.getType());

            // If the LUB is a new type, try it.
            if (!lubType.equals(getType())) {
                Token lub = lubType.convert(this);

                // Caution: convert() might return this again, e.g.
                // if lubType is general.  Only proceed if the conversion
                // returned a new type.
                if (!(lub.getType().equals(getType()))) {
View Full Code Here

        // and try a scalar operation.
        Type elementType = getElementType();
        int typeInfo = TypeLattice.compare(leftArgument, elementType);

        if (typeInfo == CPO.LOWER) {
            Token convertedArgument = elementType.convert(leftArgument);

            try {
                Token result = _multiplyElement(convertedArgument);
                return result;
            } catch (IllegalActionException ex) {
View Full Code Here

            Type lubType = (Type) TypeLattice.lattice().leastUpperBound(
                    getType(), leftArgument.getType());

            // If the LUB is a new type, try it.
            if (!lubType.equals(getType())) {
                Token lub = lubType.convert(this);

                // Caution: convert() might return this again, e.g.
                // if lubType is general.  Only proceed if the conversion
                // returned a new type.
                if (!(lub.getType().equals(getType()))) {
View Full Code Here

        if (typeInfo == CPO.SAME) {
            Token result = _subtractElement(rightArgument);
            return result;
        } else if (typeInfo == CPO.HIGHER) {
            Token convertedArgument = elementType.convert(rightArgument);

            try {
                Token result = _subtractElement(convertedArgument);
                return result;
            } catch (IllegalActionException ex) {
View Full Code Here

            Type lubType = (Type) TypeLattice.lattice().leastUpperBound(
                    getType(), rightArgument.getType());

            // If the LUB is a new type, try it.
            if (!lubType.equals(getType())) {
                Token lub = lubType.convert(this);

                // Caution: convert() might return this again, e.g.
                // if lubType is general.  Only proceed if the conversion
                // returned a new type.
                if (!(lub.getType().equals(getType()))) {
View Full Code Here

        // and try a scalar operation.
        Type elementType = getElementType();
        int typeInfo = TypeLattice.compare(leftArgument, elementType);

        if (typeInfo == CPO.LOWER) {
            Token convertedArgument = elementType.convert(leftArgument);

            try {
                Token result = _subtractElementReverse(convertedArgument);
                return result;
            } catch (IllegalActionException ex) {
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.