Package ptolemy.data.type

Examples of ptolemy.data.type.Type


                return Class.forName("[[J");
            } else if (type.equals(BaseType.BOOLEAN_MATRIX)) {
                return Class.forName("[[Z");
            } else if (type instanceof ArrayType) {
                ArrayType arrayType = (ArrayType) type;
                Type elementType = arrayType.getElementType();

                if (elementType.equals(BaseType.DOUBLE)) {
                    return Class.forName("[D");
                } else if (elementType.equals(BaseType.INT)) {
                    return Class.forName("[I");
                } else if (elementType.equals(BaseType.LONG)) {
                    return Class.forName("[J");
                } else if (elementType.equals(BaseType.BOOLEAN)) {
                    return Class.forName("[Z");
                } else {
                    return java.lang.reflect.Array.newInstance(
                            convertTokenTypeToJavaType(arrayType
                                    .getElementType()), 0).getClass();
View Full Code Here


        ptolemy.actor.lib.AddSubtract actor = (ptolemy.actor.lib.AddSubtract) getComponent();

        ArrayList args = new ArrayList();

        Type type = actor.output.getType();
        args.add(targetType(type));

        if (_codeStream.isEmpty()) {
            _codeStream.append(_eol
                    + _codeGenerator.comment("preinitialize "
View Full Code Here

        ArrayList args = new ArrayList();

        ptolemy.domains.sdf.lib.Chop actor = (ptolemy.domains.sdf.lib.Chop) getComponent();

        Type type = actor.input.getType();
        if (!isPrimitive(type)) {
            args.add("\\$tokenFunc(\\$ref(input)::zero())");
        } else {
            args.add("0");
        }
View Full Code Here

        StringBuffer code = new StringBuffer();

        Iterator channels = _getTypeConvertChannels().iterator();
        while (channels.hasNext()) {
            Channel channel = (Channel) channels.next();
            Type portType = ((TypedIOPort) channel.port).getType();

            if (isPrimitive(portType)) {

                code.append(targetType(portType));
                code.append(" " + _getTypeConvertReference(channel));
View Full Code Here

                if (_scope == null) {
                    _scope = new VariableScope();
                }

                Type type = _typeInference.inferTypes(_parseTree, _scope);
                return type;
            } catch (Exception ex) {
                throw new IllegalActionException(Expression.this, ex,
                        "An error occurred during expression type inference");
            }
View Full Code Here

        public Object getValue() throws IllegalActionException {
            if (input.getType() == BaseType.UNKNOWN) {
                return BaseType.UNKNOWN;
            } else if (input.getType() instanceof UnionType) {
                UnionType type = (UnionType) 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 UnionType) {
                UnionType type = (UnionType) input.getType();
                Type fieldType = type.get(_name);

                if (fieldType == null) {
                    return "Input Union doesn't have field named " + _name;
                }
            }
View Full Code Here

        if (actor.output.getType() == BaseType.STRING) {
            _codeStream.appendCodeBlock("StringInitBlock");
        } else {
            _codeStream.appendCodeBlock("CommonInitBlock", args);
            if (actor.output.getType() instanceof ArrayType) {
                Type elementType = ((ArrayType) actor.output.getType())
                        .getElementType();

                args.set(0, "TYPE_" + codeGenType(elementType));
                if (!actor.step.getType().equals(actor.output.getType())) {
                    _codeStream.appendCodeBlock("ArrayConvertStepBlock", args);
View Full Code Here

        /**        
         * Return the function result.
         * @return A Type.
         */
        public Object getValue() {
            Type inputType = _port.getType();
            if (inputType == BaseType.INT) {
                return BaseType.DOUBLE;
            } else if (inputType == BaseType.INT_MATRIX) {
                return BaseType.DOUBLE_MATRIX;
            } else {
View Full Code Here

         * @return An array type for the associated typeable.
         * @exception IllegalActionException If the type of the typeable
         * cannot be determined.
         */
        private ArrayType _getArrayTypeRaw() throws IllegalActionException  {
            Type type = input.getType();
            if (_arrayType == null || !_arrayType.getElementType().equals(type)) {
                $ASSIGN$_arrayType(new ArrayType(type));
            }
            return _arrayType;
        }
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.