Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.InvalidStateException


            breakpointODESolver.setVisibility(Settable.NOT_EDITABLE);
        } catch (IllegalActionException e) {
            //Should never happens. The parameters are always compatible.
            throw new InternalErrorException("Parameter creation error.");
        } catch (NameDuplicationException ex) {
            throw new InvalidStateException(this, "Parameter name duplication.");
        }
    }
View Full Code Here


            timeResolution.setVisibility(Settable.FULL);
        } catch (IllegalActionException e) {
            //Should never happens. The parameters are always compatible.
            throw new InternalErrorException("Parameter creation error: " + e);
        } catch (NameDuplicationException ex) {
            throw new InvalidStateException(this,
                    "Parameter name duplication: " + ex);
        }
    }
View Full Code Here

            // If we change this exception to a RuntimeException, then
            // the stack trace appears.  My guess is this indicates a
            // bug in the ptolemy.kernel.Exception* classes or in JDK1.3.1
            // Note that under JDK1.4, the stack trace is printed in
            // both cases.
            throw new InvalidStateException(this, ex,
                    "Failed to populate Library");
        } finally {
            _populating = false;
        }
    }
View Full Code Here

    /** Resume a delayed actor. This method is only called by CSPDirector
     *  after time has sufficiently advanced.
     */
    protected void _continue() {
        if (_delayed == false) {
            throw new InvalidStateException("CSPActor._continue() "
                    + "called on an actor that was not delayed: " + getName());
        }
        Object director = getDirector();
        synchronized (director) {
            _delayed = false;
View Full Code Here

     */
    public Iterator bottomVariables() throws IllegalActionException {
        Object bottom = _cpo.bottom();

        if (bottom == null) {
            throw new InvalidStateException(
                    "The underlying CPO does not have a bottom element.");
        }

        return _filterVariables(bottom);
    }
View Full Code Here

     */
    public Iterator topVariables() throws IllegalActionException {
        Object top = _cpo.top();

        if (top == null) {
            throw new InvalidStateException(
                    "The underlying CPO does not have a top element.");
        }

        return _filterVariables(top);
    }
View Full Code Here

                                .getFullName();
                    }
                } catch (Exception ex) {
                    variableObject = ex.toString();
                }
                throw new InvalidStateException("Port \" " + variableObject
                        + "\" of type \"" + variableValue
                        + "\" in an InequalityTerm is not settable."
                        + " If the port is an input and has a type constraint,"
                        + " try removing the type constraint and possibly"
                        + " placing it on the output.");
View Full Code Here

    private boolean _solve(boolean least) throws IllegalActionException {
        // initialize all variables
        Object init = least ? _cpo.bottom() : _cpo.top();

        if (init == null) {
            throw new InvalidStateException(
                    "The underlying CPO is not a lattice because "
                            + "the CPO has no " + (least ? "bottom" : "top")
                            + ". The CPO was a " + _cpo.getClass().getName());

        }

        for (Enumeration e = _Clist.keys(); e.hasMoreElements();) {
            InequalityTerm variable = (InequalityTerm) e.nextElement();

            try {
                variable.initialize(init);
            } catch (IllegalActionException ex) {
                throw new InvalidStateException(null, null, ex,
                        "Cannot initialize variable.");
            }
        }

        // initialize _NS(not satisfied) list; set _inCvar and _inserted flags.
        // Not Satisfied list.  Each entry is an Integer storing index to
        // _Ilist.
        // Note: removal in jdk1.2 LinkedList is not an O(1) operation, but
        // an O(n) operation, where n is the number of elements in list.
        // If the size of _NS is large, writing our own linked list class
        // with a Cell class might be better.
        LinkedList _NS = new LinkedList();

        for (int i = 0; i < _Ilist.size(); i++) {
            Info info = (Info) _Ilist.get(i);
            info._inCvar = least ? info._ineq.getGreaterTerm().isSettable()
                    : info._ineq.getLesserTerm().isSettable();

            if (info._inCvar) {
                if (info._ineq.isSatisfied(_cpo)) {
                    info._inserted = false;
                } else { // insert to _NS
                    _NS.addLast(Integer.valueOf(i));
                    info._inserted = true;
                }
            }
        }

        // The outer loop is for handling the situation that some
        // InequalityTerms do not report all the variables they depend on
        // from the getVariables() call. This can happen, for example, in
        // type resolution application involving structured types, where
        // the type term for an element of a structured type does not have
        // a reference to the term of its enclosing type.
        boolean allSatisfied = false;

        while (!allSatisfied) {
            // solve the inequalities
            while (_NS.size() > 0) {
                int index = ((Integer) (_NS.removeFirst())).intValue();

                Info info = (Info) (_Ilist.get(index));
                info._inserted = false;

                Object value = null;
                InequalityTerm updateTerm = null;

                if (least) {
                    updateTerm = info._ineq.getGreaterTerm();
                    value = _cpo.leastUpperBound(info._ineq.getLesserTerm()
                            .getValue(), updateTerm.getValue());
                } else {
                    updateTerm = info._ineq.getLesserTerm();
                    value = _cpo.greatestLowerBound(updateTerm.getValue(),
                            info._ineq.getGreaterTerm().getValue());
                }

                if (value == null) {
                    throw new InvalidStateException("The CPO over which "
                            + "the inequalities are defined is not a lattice.");
                }

                try {
                    updateTerm.setValue(value);
                } catch (IllegalActionException ex) {
                    throw new InvalidStateException(null, null, ex,
                            "Can't update variable.\n");
                }

                // insert or drop the inequalities affected
                ArrayList affected = (ArrayList) _Clist.get(updateTerm);
View Full Code Here

                        _debug(identifier
                                + ": A receive or get is already waiting!");
                    }
                    // Should never happen that a get or a ConditionalReceive
                    // is already at the receiver.
                    throw new InvalidStateException(((Nameable) controller
                            .getParent()).getName()
                            + ": ConditionalReceive branch trying to "
                            + " rendezvous with a receiver that already "
                            + " has a get or a ConditionalReceive waiting.");
                }
View Full Code Here

                // consider using the thread instead of the branch ID.
                director.notifyAll();
                return;
            }
        }
        throw new InvalidStateException(((Nameable) getParent()).getName()
                + ": Error: branch releasing first without possessing it! :"
                + _branchTrying + " & " + branchNumber);
    }
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.InvalidStateException

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.