Package ptolemy.data.type

Examples of ptolemy.data.type.Type


     */
    protected void _setTokenAndNotify(Token newToken)
            throws IllegalActionException {
        // Save to restore in case the change is rejected.
        Token oldToken = _token;
        Type oldVarType = _varType;

        if (_varType instanceof StructuredType) {
            try {
                oldVarType = (Type) ((StructuredType) _varType).clone();
            } catch (CloneNotSupportedException ex2) {
                throw new InternalErrorException(
                        "Variable._setTokenAndNotify: "
                                + " Cannot clone _varType" + ex2.getMessage());
            }
        }

        boolean oldNoTokenYet = _noTokenYet;
        String oldInitialExpression = _initialExpression;
        Token oldInitialToken = _initialToken;

        try {
            _setToken(newToken);

            NamedObj container = getContainer();

            if (container != null) {
                if (!oldVarType.equals(_varType)
                        && (oldVarType != BaseType.UNKNOWN)) {
                    container.attributeTypeChanged(this);
                }

                container.attributeChanged(this);
View Full Code Here


     */
    public void fire() throws IllegalActionException {
        super.fire();
        if (input.hasToken(0)) {
            ArrayToken token = (ArrayToken) input.get(0);
            Type inputElementType = token.getElementType();
            if (token.length() == 0) {
                output.send(0, token);
                return;
            }

View Full Code Here

        /** Return the function result.
         *  @return A Type.
         */
        public Object getValue() {
            Type inputType = _port.getType();

            if (inputType == BaseType.COMPLEX) {
                return BaseType.DOUBLE;
            } else if (inputType == BaseType.COMPLEX_MATRIX) {
                return BaseType.DOUBLE_MATRIX;
View Full Code Here

                // System.out.println("conversions are the same");
                Class class1 = arguments1[j];
                Class class2 = arguments2[j];

                try {
                    Type type1 = ConversionUtilities
                            .convertJavaTypeToTokenType(class1);
                    Type type2 = ConversionUtilities
                            .convertJavaTypeToTokenType(class2);

                    if (TypeLattice.compare(type2, type1) == ptolemy.graph.CPO.LOWER) {
                        // Found one conversion where the second method
                        // is preferable. This is enough to return false.
View Full Code Here

        try {
            // We have to do this because Java is stupid and doesn't
            // give us a way to tell if primitive arguments are
            // acceptable
            if (formal.isPrimitive() || formal.isArray()) {
                Type type = ConversionUtilities
                        .convertJavaTypeToTokenType(formal);

                if (ptolemy.graph.CPO.LOWER == TypeLattice
                        .compare(actual, type)) {
                    return new TypeArgumentConversion(type, NATIVE_CONVERSION);
View Full Code Here

                        "The return type of the method " + toString()
                                + " cannot be determined because "
                                + "no matching method was found.");
            }

            Type elementType = _cachedMethod.getReturnType();
            return new ArrayType(elementType);
        }
View Full Code Here

                        "The return type of the method " + toString()
                                + " cannot be determined because "
                                + "no matching method was found.");
            }

            Type elementType = _cachedMethod.getReturnType();
            return MatrixType.getMatrixTypeForElementType(elementType);
        }
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

         *  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

    public String generateFireCode() throws IllegalActionException {
        super.generateFireCode();

        ptolemy.actor.lib.conversions.TokenToExpression actor = (ptolemy.actor.lib.conversions.TokenToExpression) getComponent();

        Type inputType = actor.input.getType();
        if (isPrimitive(inputType)) {
            ArrayList args = new ArrayList();
            args.add(codeGenType(inputType));
            _codeStream.appendCodeBlock("FireBlock", args);
        } else {
            if (inputType instanceof ArrayType) {
                Type elementType = ((ArrayType) inputType).getElementType();

                if (elementType instanceof BaseType.ScalarType) {
                    // test/auto/AddSubtract4.xml needs this.
                    _codeStream.appendCodeBlock("TokenFireBlock");
                } else {
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.