Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.IllegalActionException


     */
    protected Token _getValue(int index) throws IllegalActionException {
        ArrayToken val = (ArrayToken) (values.getToken());

        if ((val == null) || (val.length() <= index)) {
            throw new IllegalActionException(this,
                    "Index out of range of the values parameter.");
        }

        return val.getElement(index);
    }
View Full Code Here


                        .getTransferData(DataFlavor.stringFlavor)));

                // NullPointerException also possible //
                // Ignore this for now, allowing exception to go uncaught.
            } catch (IOException ex) {
                throw new IllegalActionException(this,
                        " Failed to paste (IO Exception): " + ex);
            } catch (UnsupportedFlavorException ex) {
                throw new IllegalActionException(this,
                        " Failed to paste: (Flavor Exception)" + ex);
            }
        }

        // Copy
View Full Code Here

        // Those properties are only used when originally opening a window.
        if (attribute == binWidth) {
            double width = ((DoubleToken) binWidth.getToken()).doubleValue();

            if (width <= 0.0) {
                throw new IllegalActionException(this,
                        "Invalid bin width (must be positive): " + width);
            }

            if (plot instanceof Histogram) {
                ((Histogram) plot).setBinWidth(width);
View Full Code Here

        if ((_frame == null) && (_container == null)) {
            // Need an effigy and a tableau so that menu ops work properly.
            Effigy containerEffigy = Configuration.findEffigy(toplevel());

            if (containerEffigy == null) {
                throw new IllegalActionException(this,
                        "Cannot find effigy for top level: "
                                + toplevel().getFullName());
            }

            try {
                PlotEffigy plotEffigy = new PlotEffigy(containerEffigy,
                        containerEffigy.uniqueName("plot"));

                // The default identifier is "Unnamed", which is no good for
                // two reasons: Wrong title bar label, and it causes a save-as
                // to destroy the original window.
                plotEffigy.identifier.setExpression(getFullName());

                PlotWindowTableau tableau = new PlotWindowTableau(plotEffigy,
                        "tableau");
                _frame = tableau.frame;
            } catch (Exception ex) {
                throw new IllegalActionException(this, null, ex,
                        "Error creating effigy and tableau");
            }

            _windowProperties.setProperties(_frame);
            _implementDeferredConfigurations();
View Full Code Here

            // Check that it is a square matrix.
            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.");
            }

            _requestInitialization = true;
        } else if (attribute == B) {
            // Check that B is a matrix.
            DoubleMatrixToken token = (DoubleMatrixToken) B.getToken();

            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)) {
                throw new IllegalActionException(this,
                        "The B matrix must be a nonempty matrix.");
            }

            _requestInitialization = true;
        } else if (attribute == C) {
            // Check that C is a matrix.
            DoubleMatrixToken token = (DoubleMatrixToken) C.getToken();

            if ((token.getRowCount() == 0) || (token.getColumnCount() == 0)) {
                throw new IllegalActionException(this,
                        "The C matrix must be a nonempty matrix.");
            }

            _requestInitialization = true;
        } 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.");
            }

            _requestInitialization = true;
        } else if (attribute == initialStates) {
            // The initialStates parameter should be a row vector.
            DoubleMatrixToken token = (DoubleMatrixToken) initialStates
                    .getToken();

            if ((token.getRowCount() != 1) || (token.getColumnCount() < 1)) {
                throw new IllegalActionException(this,
                        "The initialStates must be a row vector.");
            }

            // Changes of the initialStates parameter are ignored after
            // the execution.
View Full Code Here

        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 (" + b.getRowCount()
                            + ") should be equal to "
                            + "the number of rows of the A matrix (" + n + ").");
        }

        int m = b.getColumnCount();

        if (input.getWidth() != m) {
            throw new IllegalActionException(this,
                    "The number of columns of the B matrix ("
                            + b.getColumnCount() + ") should be equal to "
                            + "the width of the input port ("
                            + input.getWidth() + ").");
        }

        DoubleMatrixToken c = (DoubleMatrixToken) C.getToken();

        if (c.getColumnCount() != n) {
            throw new IllegalActionException(this,
                    "The number of columns of the C matrix ("
                            + c.getColumnCount() + ") should be equal to "
                            + "the number of rows of the A matrix (" + n + ").");
        }

        // The output width is not checked, since we may only want
        // to use some of the outputs
        DoubleMatrixToken d = (DoubleMatrixToken) D.getToken();

        if (c.getRowCount() != d.getRowCount()) {
            throw new IllegalActionException(this,
                    "The number of rows of the D matrix (" + d.getRowCount()
                            + ") should be equal to "
                            + "the number of rows of the C matrix ("
                            + c.getRowCount() + ").");
        }

        if (d.getColumnCount() != input.getWidth()) {
            throw new IllegalActionException(this,
                    "The number of columns of the D matrix ("
                            + d.getColumnCount() + ") should be equal to "
                            + "the width of the input port ("
                            + input.getWidth() + ").");
        }

        DoubleMatrixToken x0 = (DoubleMatrixToken) initialStates.getToken();

        if (x0.getColumnCount() != n) {
            throw new IllegalActionException(this,
                    "The number of initial states (" + x0.getColumnCount()
                            + ") should equal to "
                            + "the number of columns of the A matrix (" + n
                            + ").");
        }
View Full Code Here

    protected void _propagateValue(NamedObj destination)
            throws IllegalActionException {
        try {
            ((Configurable) destination).configure(_base, _source, _text);
        } catch (Exception ex) {
            throw new IllegalActionException(this, ex, "Propagation failed.");
        }
    }
View Full Code Here

    public boolean postfire() throws IllegalActionException {
        int widthX = inputX.getWidth();
        int widthY = inputY.getWidth();

        if (widthX != widthY) {
            throw new IllegalActionException(this,
                    " The number of input channels mismatch.");
        }

        int offset = ((IntToken) startingDataset.getToken()).intValue();
View Full Code Here

            } else if (dataFormatName.equals("int")) {
                _dataFormat = _INT;
            } else if (dataFormatName.equals("short")) {
                _dataFormat = _SHORT;
            } else {
                throw new IllegalActionException(this,
                        "Unrecognized data type: " + dataFormatName);
            }
        } else {
            super.attributeChanged(attribute);
        }
View Full Code Here

            } else if (typeName.equals("bilinear")) {
                _interpolationType = _BILINEAR;
            } else if (typeName.equals("nearestNeighbor")) {
                _interpolationType = _NEARESTNEIGHBOR;
            } else {
                throw new IllegalActionException(this,
                        "Unrecognized interpolation type: " + typeName);
            }
        } else if (attribute == subSampleBits) {
            _subSampleBits = ((IntToken) subSampleBits.getToken()).intValue();
        } else if (attribute == affineMatrix) {
            DoubleMatrixToken affineMatrixToken = (DoubleMatrixToken) affineMatrix
                    .getToken();

            if ((affineMatrixToken.getColumnCount() == 3)
                    && (affineMatrixToken.getRowCount() == 2)) {
                _matrixValue = affineMatrixToken.doubleMatrix();
                _affineTransform = new AffineTransform(_matrixValue[0][0],
                        _matrixValue[1][0], _matrixValue[0][1],
                        _matrixValue[1][1], _matrixValue[0][2],
                        _matrixValue[1][2]);
            } else {
                throw new IllegalActionException(this,
                        "Matrix must have two rows and three " + "columns");
            }
        } else {
            super.attributeChanged(attribute);
        }
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.