Package ptolemy.graph

Examples of ptolemy.graph.Inequality


                                destinationDeclared);
                    }

                    if ((compare == CPO.HIGHER)
                            || (compare == CPO.INCOMPARABLE)) {
                        Inequality inequality = new Inequality(sourcePort
                                .getTypeTerm(), destinationPort.getTypeTerm());
                        result.add(inequality);
                    }
                }
            }
View Full Code Here


                // not have declared type, form type constraint.
                if ((sourcePort.getContainer() == this)
                        && (destinationPort.getContainer() == this)) {
                    // Both ports belong to this, so their type must be equal.
                    // Represent this with two inequalities.
                    Inequality ineq1 = new Inequality(sourcePort.getTypeTerm(),
                            destinationPort.getTypeTerm());
                    result.add(ineq1);

                    Inequality ineq2 = new Inequality(destinationPort
                            .getTypeTerm(), sourcePort.getTypeTerm());
                    result.add(ineq2);
                } else if (sourcePort.getContainer().equals(this)) {
                    if (sourcePort.sourcePortList().size() == 0) {
                        // Skip this port. It is not connected on the outside.
                        continue;
                    }

                    // Require the source port to be an array.
                    Inequality arrayInequality = new Inequality(
                            ArrayType.ARRAY_BOTTOM, sourcePort.getTypeTerm());
                    result.add(arrayInequality);

                    // Next require that the element type of the
                    // source port array be compatible with the
                    // destination port.
                    try {
                        Inequality ineq = new Inequality(ArrayType
                                .elementType(sourcePort), destinationPort
                                .getTypeTerm());
                        result.add(ineq);
                    } catch (IllegalActionException e) {
                        throw new InternalErrorException(e);
                    }
                } else if (destinationPort.getContainer().equals(this)) {
                    // Require that the destination port type be an array
                    // with elements compatible with the source port.
                    try {
                        Inequality ineq = new Inequality(ArrayType
                                .arrayOf(sourcePort), destinationPort
                                .getTypeTerm());
                        result.add(ineq);
                    } catch (IllegalActionException e) {
                        throw new InternalErrorException(e);
View Full Code Here

            }

            _debug("setTypeAtLeast: " + name);
        }

        Inequality ineq = new Inequality(lesser.getTypeTerm(), this
                .getTypeTerm());
        _constraints.add(ineq);
    }
View Full Code Here

            }

            _debug("setTypeAtLeast: " + name);
        }

        Inequality ineq = new Inequality(typeTerm, this.getTypeTerm());
        _constraints.add(ineq);
    }
View Full Code Here

            }

            _debug("setTypeSameAs: " + name);
        }

        Inequality ineq = new Inequality(this.getTypeTerm(), equal
                .getTypeTerm());
        _constraints.add(ineq);
        ineq = new Inequality(equal.getTypeTerm(), this.getTypeTerm());
        _constraints.add(ineq);
    }
View Full Code Here

            if (currentToken != null) {
                Type currentType = currentToken.getType();

                TypeConstant current = new TypeConstant(currentType);
                Inequality ineq = new Inequality(current, getTypeTerm());
                result.add(ineq);
            }
        } catch (Exception e) {
            // Ignored: expression cannot be evaluated at this time.
            // do nothing.
        }

        // If the variable has a type, add a constraint.
        // Type currentType = getType();
        // if (currentType != BaseType.UNKNOWN) {
        //     TypeConstant current = new TypeConstant(currentType);
        //     Inequality ineq = new Inequality(current, getTypeTerm());
        //     result.add(ineq);
        // }
        // If an upper bound has been specified, add a constraint.
        if (_typeAtMost != BaseType.UNKNOWN) {
            TypeConstant atMost = new TypeConstant(_typeAtMost);
            Inequality ineq = new Inequality(getTypeTerm(), atMost);
            result.add(ineq);
        }

        return result;
    }
View Full Code Here

        Iterator outputPorts = outputPortList().iterator();

        while (outputPorts.hasNext()) {
            TypedIOPort outputPort = (TypedIOPort) outputPorts.next();
            String label = outputPort.getName();
            Inequality inequality = new Inequality(new PortFunction(label),
                    outputPort.getTypeTerm());
            constraints.add(inequality);
        }

        return constraints;
View Full Code Here

    public List typeConstraintList() {
        List typeConstraints = super.typeConstraintList();

        try {
            if (initialValue.getToken() != null) {
                Inequality ineq = new Inequality(initialValue.getTypeTerm(),
                        output.getTypeTerm());
                typeConstraints.add(ineq);
            }
        } catch (IllegalActionException ex) {
            // Errors in the initialValue parameter should already
View Full Code Here

    public List typeConstraintList() {
        List typeConstraints = super.typeConstraintList();

        try {
            if (initialValue.getToken() != null) {
                Inequality ineq = new Inequality(initialValue.getTypeTerm(),
                        output.getTypeTerm());
                typeConstraints.add(ineq);
            }
        } catch (IllegalActionException ex) {
            // Errors in the initialValue parameter should already
View Full Code Here

        List typeConstraints = super.typeConstraintList();

        try {
            if (initialValue.getToken() != null) {
                // Set type of initialValue to be equal to input type
                Inequality ineq = new Inequality(initialValue.getTypeTerm(),
                        input.getTypeTerm());
                typeConstraints.add(ineq);
                ineq = new Inequality(input.getTypeTerm(), initialValue
                        .getTypeTerm());
                typeConstraints.add(ineq);
            }
        } catch (IllegalActionException ex) {
            // Errors in the initialValue parameter should already
View Full Code Here

TOP

Related Classes of ptolemy.graph.Inequality

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.