Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.IllegalActionException


            // multiple GenericJNIActors in it and we had already
            // created the JNI files for those actors.
            try {
                actor.setName(newName);
            } catch (NameDuplicationException ex) {
                throw new IllegalActionException(actor, ex,
                        "Unable to rename GenericJNIActor '" + actor.getName()
                                + "' to '" + newName + "': \n"
                                + "An JNI Actor already exists!\n");
            }
        }
View Full Code Here


                    throw new IOException("Directory \"" + dir
                            + "\" does not exist and cannot be created.");
                }
            }
        } catch (NullPointerException ex) {
            throw new IllegalActionException(null, ex, "No directory '" + dir
                    + "'");
        }

        File javaFile = new File(destinationDirectory + "/Jni"
                + actor.getName() + ".java");
View Full Code Here

     */
    public void attributeChanged(Attribute attribute) throws IllegalActionException  {
        if (attribute == A) {
            DoubleMatrixToken token = (DoubleMatrixToken)A.getToken();
            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)||(token.getRowCount() != token.getColumnCount())) {
                throw new IllegalActionException(this, "The A matrix must be a nonempty square matrix.");
            }
        } else if (attribute == B) {
            DoubleMatrixToken token = (DoubleMatrixToken)B.getToken();
            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)) {
                throw new IllegalActionException(this, "The B matrix must be a nonempty matrix.");
            }
        } else if (attribute == C) {
            DoubleMatrixToken token = (DoubleMatrixToken)C.getToken();
            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)) {
                throw new IllegalActionException(this, "The C matrix must be a nonempty matrix.");
            }
        } else if (attribute == D) {
            DoubleMatrixToken token = (DoubleMatrixToken)D.getToken();
            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)) {
                throw new IllegalActionException(this, "The D matrix must be a nonempty matrix.");
            }
        } else if (attribute == initialStates) {
            DoubleMatrixToken token = (DoubleMatrixToken)initialStates.getToken();
            if ((token.getColumnCount() != 1) || (token.getRowCount() < 1)) {
                throw new IllegalActionException(this, "The initialStates must be a column vector.");
            }
            $ASSIGN$_initialStateChanged(true);
        } else {
            super.attributeChanged(attribute);
        }
View Full Code Here

        super.preinitialize();
        DoubleMatrixToken a = (DoubleMatrixToken)A.getToken();
        int n = a.getRowCount();
        DoubleMatrixToken b = (DoubleMatrixToken)B.getToken();
        if (b.getRowCount() != n) {
            throw new IllegalActionException(this, "The number of rows of the B matrix should equal to " + "the number of rows of the A matrix.");
        }
        if (n == 1) {
            $ASSIGN$_singleState(true);
            state.setTypeEquals(BaseType.DOUBLE);
        } else {
            $ASSIGN$_singleState(false);
            state.setTypeEquals(BaseType.DOUBLE_MATRIX);
        }
        int m = b.getColumnCount();
        if (m == 1) {
            input.setTypeEquals(BaseType.DOUBLE);
        } else {
            input.setTypeEquals(BaseType.DOUBLE_MATRIX);
        }
        DoubleMatrixToken c = (DoubleMatrixToken)C.getToken();
        if (c.getColumnCount() != n) {
            throw new IllegalActionException(this, "The number of columns of the C matrix should equal to " + "the number of rows of the A matrix.");
        }
        int r = c.getRowCount();
        if (r == 1) {
            $ASSIGN$_singleOutput(true);
            output.setTypeEquals(BaseType.DOUBLE);
        } else {
            $ASSIGN$_singleOutput(false);
            output.setTypeEquals(BaseType.DOUBLE_MATRIX);
        }
        DoubleMatrixToken d = (DoubleMatrixToken)D.getToken();
        if (c.getRowCount() != d.getRowCount()) {
            throw new IllegalActionException(this, "The number of rows of the D matrix should equal to " + "the number of rows of the C matrix.");
        }
        DoubleMatrixToken x0 = (DoubleMatrixToken)initialStates.getToken();
        if (x0.getRowCount() != n) {
            throw new IllegalActionException(this, "The number of initial states should equal to " + "the number of columns of the A matrix.");
        }
        $ASSIGN$_initialStateChanged(true);
    }
View Full Code Here

                MoMLParser parser = new MoMLParser();

                try {
                    _model = parser.parse(null, url);
                } catch (Exception ex) {
                    throw new IllegalActionException(this, ex,
                            "Failed to read model.");
                }

                // Create a manager, if appropriate.
                if (_model instanceof CompositeActor) {
                    _manager = new Manager(_model.workspace(), "Manager");
                    ((CompositeActor) _model).setManager(_manager);

                    if (_debugging) {
                        _debug("** Created new manager.");
                    }
                }
            } else {
                // URL is null... delete the current model.
                _model = null;
                _manager = null;
                _throwable = null;
            }
        } else if (attribute == maxOutputLength) {
            IntToken length = (IntToken) maxOutputLength.getToken();

            if (length.intValue() > 0) {
                _outputLength = length.intValue();
            } else {
                throw new IllegalActionException(this,
                        "output array length is less than or equal 0?!");
            }
        } else {
            super.attributeChanged(attribute);
        }
View Full Code Here

                }

                try {
                    _manager.execute();
                } catch (KernelException ex) {
                    throw new IllegalActionException(this, ex,
                            "Execution failed.");
                }

                if (_getResult()) {
                    i++;
View Full Code Here

        super.wrapup();

        if (_throwable != null) {
            Throwable throwable = _throwable;
            _throwable = null;
            throw new IllegalActionException(this, throwable,
                    "Background run threw an exception");
        }
    }
View Full Code Here

                _debug("** Transferring input as string to inputArrayElement.");
            }

            ((Settable) attribute).setExpression(t.toString());
        } else {
            throw new IllegalActionException(this,
                    "The specified model does not have an inputArrayElement parameter.");
        }
    }
View Full Code Here

        } else if (attribute instanceof Settable) {
            BooleanToken t = new BooleanToken(((Settable) attribute)
                    .getExpression());
            return t.booleanValue();
        } else {
            throw new IllegalActionException(this,
                    "The specified model does not have an evaluatedValue parameter.");
        }
    }
View Full Code Here

                        _gainControl.setLevel(0.01f * percentGain
                                .getCurrentValue());
                    }
                }
            } catch (IOException ex) {
                throw new IllegalActionException(this, "Cannot open file: "
                        + ex.toString());
            } catch (MediaException ex) {
                throw new IllegalActionException(this, ex,
                        "Exception thrown by media framework");
            }
        } else if ((attribute == percentGain) && (_gainControl != null)) {
            _gainControl.setLevel(0.01f * percentGain.getCurrentValue());
        } else {
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.IllegalActionException

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.