Package ptolemy.data.type

Examples of ptolemy.data.type.UnionType


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

        UnionType declaredType = new UnionType(labels, types);

        output.setTypeEquals(declaredType);

        // set the constraints between union fields and input ports
        List constraints = new LinkedList();

        // since the output port has a clone of the above UnionType, need to
        // get the type from the output port.
        UnionType outputType = (UnionType) 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));
            constraints.add(inequality);
        }

        return constraints;
    }
View Full Code Here


        String[] labels = new String[1];
        labels[0] = _label;

        Type[] types = new Type[1];
        types[0] = _value.getType();
        return new UnionType(labels, types);
    }
View Full Code Here

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

        UnionType declaredType = new UnionType(labels, types);

        //FIXME: is this what we want?
        input.setTypeAtMost(declaredType);

        // set the constraints between union fields and output ports
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

        /** Return an additional string describing the current value
         *  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

TOP

Related Classes of ptolemy.data.type.UnionType

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.