Package ptolemy.graph

Examples of ptolemy.graph.Inequality


            try {
                NamedObj object = getDestination(name);

                if (object instanceof Typeable) {
                    InequalityTerm term = ((Typeable) object).getTypeTerm();
                    list.add(new Inequality(new TypeFunction(name), term));
                }
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
        }
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);
            }

            Inequality ineq2 = new Inequality(input.getTypeTerm(), output
                    .getTypeTerm());
            typeConstraints.add(ineq2);
        } catch (IllegalActionException ex) {
            // Errors in the initialValue parameter should
            // already have been caught in getAttribute() method
View Full Code Here

        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

     *  repeats the relative type constraints that were specified in
     *  the constructor.
     *  @param lesser A Typeable object.
     */
    public void setTypeAtLeast(Typeable lesser) {
        Inequality inequality = new Inequality(lesser.getTypeTerm(), this
                .getTypeTerm());
        _constraints.add(inequality);
    }
View Full Code Here

     *  repeats the relative type constraints that were specified in
     *  the constructor.
     *  @param typeTerm An InequalityTerm.
     */
    public void setTypeAtLeast(InequalityTerm typeTerm) {
        Inequality inequality = new Inequality(typeTerm, this.getTypeTerm());
        _constraints.add(inequality);
    }
View Full Code Here

     *  <p>Actors that call this method should have a clone() method that
     *  repeats the relative type constraints that were specified in
     *  the constructor.
     */
    public void setTypeAtMost(Type type) {
        Inequality inequality = new Inequality(this.getTypeTerm(),
                new TypeConstant(type));
        _constraints.add(inequality);
    }
View Full Code Here

     *  repeats the relative type constraints that were specified in
     *  the constructor.
     *  @param equal A Typeable object.
     */
    public void setTypeSameAs(Typeable equal) {
        Inequality inequality = new Inequality(this.getTypeTerm(), equal
                .getTypeTerm());
        _constraints.add(inequality);
        inequality = new Inequality(equal.getTypeTerm(), this.getTypeTerm());
        _constraints.add(inequality);
    }
View Full Code Here

            // Type conflict errors need to be handled specially.
            if (throwable instanceof TypeConflictException) {
                Iterator inequalities = ((TypeConflictException) throwable)
                        .inequalityList().iterator();
                while (inequalities.hasNext()) {
                    Inequality inequality = (Inequality) inequalities.next();
                    if (inequality != null) {
                        InequalityTerm term = inequality.getGreaterTerm();
                        if (term != null) {
                            Object object = term.getAssociatedObject();
                            if (object instanceof Nameable) {
                                _highlightError((Nameable) object);
                            }
                        }
                        term = inequality.getLesserTerm();
                        if (term != null) {
                            Object object = term.getAssociatedObject();
                            if (object instanceof Nameable) {
                                _highlightError((Nameable) object);
                            }
View Full Code Here

                // BaseType.UNKNOWN, add the inequalities to the list of type
                // conflicts.
                Iterator inequalities = constraintList.iterator();

                while (inequalities.hasNext()) {
                    Inequality inequality = (Inequality) inequalities.next();

                    if (!inequality.isSatisfied(TypeLattice.lattice())) {
                        conflicts.add(inequality);
                    } else {
                        // Check if type variables are resolved to unacceptable
                        //types
                        InequalityTerm[] lesserVariables = inequality
                                .getLesserTerm().getVariables();
                        InequalityTerm[] greaterVariables = inequality
                                .getGreaterTerm().getVariables();
                        boolean added = false;

                        for (int i = 0; i < lesserVariables.length; i++) {
                            InequalityTerm variable = lesserVariables[i];
View Full Code Here

                    int compare = TypeLattice
                            .compare(srcDeclared, destDeclared);

                    if ((compare == CPO.HIGHER)
                            || (compare == CPO.INCOMPARABLE)) {
                        Inequality inequality = new Inequality(sourcePort
                                .getTypeTerm(), destinationPort.getTypeTerm());
                        result.add(inequality);
                    }
                }
            }
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.