Package ptolemy.data

Examples of ptolemy.data.IntMatrixToken


     @return The zero matrix with the given number of rows and
     *   columns.
     */
    public static IntMatrixToken zeroMatrixInt(int rows, int columns) {
        int[][] mtr = new int[rows][columns];
        IntMatrixToken result = null;

        try {
            result = new IntMatrixToken(mtr, IntMatrixToken.DO_NOT_COPY);
        } catch (IllegalActionException ex) {
            throw new InternalErrorException("UtilityFunctions.zeroMatrixInt: "
                    + "Cannot create IntMatrixToken. " + ex.getMessage());
        }

View Full Code Here


            component.addComponentListener(this);
            _listeningTo = component;
        }

        try {
            IntMatrixToken token = (IntMatrixToken) getToken();

            if (token != null) {
                int width = token.getElementAt(0, 0);
                int height = token.getElementAt(0, 1);

                // NOTE: As usual with swing, it's not obvious what the
                // right way to do this is. The following seems to work,
                // found by trial and error.  Even then, the layout
                // manager feels free to override it.
View Full Code Here

            Rectangle location = component.getBounds();
            int[][] locationMatrix = new int[1][2];
            locationMatrix[0][0] = location.x;
            locationMatrix[0][1] = location.y;

            IntMatrixToken token = new IntMatrixToken(locationMatrix);
            setToken(token);
        } catch (IllegalActionException ex) {
            throw new InternalErrorException("Can't set bounds value!");
        }
    }
View Full Code Here

     @param component The component whose location is to be set.
     *  @return True if successful.
     */
    public boolean setLocation(Window component) {
        try {
            IntMatrixToken token = (IntMatrixToken) getToken();

            if (token != null) {
                int x = token.getElementAt(0, 0);
                int y = token.getElementAt(0, 1);

                // NOTE: As usual with swing, it's not obvious what the
                // right way to do this is. The following seems to work,
                // found by trial and error.  Even then, the layout
                // manager feels free to override it.
View Full Code Here

     @exception IllegalActionException If the parameter value is invalid.
     */
    public void attributeChanged(Attribute attribute)
            throws IllegalActionException {
        if (attribute == precision) {
            IntMatrixToken token = (IntMatrixToken) precision.getToken();

            if ((token.getRowCount() != 1) || (token.getColumnCount() != 2)) {
                throw new IllegalActionException(this,
                        "Invalid precision (not a 1 by 2 matrix).");
            }

            Precision precision = new Precision(token.getElementAt(0, 0), token
                    .getElementAt(0, 1));
            output.setTypeEquals(new FixType(precision));
            _quantization = _quantization.setPrecision(precision);
        } else if (attribute == rounding) {
            Rounding r = Rounding.getName(rounding.getExpression());
View Full Code Here

            ExpertParameter vergilCenter = (ExpertParameter) top
                    .getAttribute("_vergilCenter");

            if (vergilSize != null) {
                try {
                    IntMatrixToken vergilSizeToken;
                    vergilSizeToken = (IntMatrixToken) vergilSize.getToken();

                    if (vergilSizeToken == null) {
                        throw new IllegalActionException(top,
                                "_vergilSize token was null?");
                    }
                    int width = vergilSizeToken.getElementAt(0, 0);
                    int height = vergilSizeToken.getElementAt(0, 1);

                    if (width > 800) {
                        analysis.append(" width(" + width + ") > 800");
                    }
View Full Code Here

        output_tokenProductionRate = new Parameter(input, "tokenProductionRate");
        output_tokenProductionRate.setExpression("outrate");

        initialOutputs = new Parameter(this, "initialOutputs",
                new IntMatrixToken(defaultValues));
    }
View Full Code Here

     @exception IllegalActionException If the parameter value is invalid.
     */
    public void attributeChanged(Attribute attribute)
            throws IllegalActionException {
        if (attribute == precision) {
            IntMatrixToken token = (IntMatrixToken) precision.getToken();

            if ((token.getRowCount() != 1) || (token.getColumnCount() != 2)) {
                throw new IllegalActionException(this,
                        "Invalid precision (not a 1 by 2 matrix).");
            }

            Precision precision = new Precision(token.getElementAt(0, 0), token
                    .getElementAt(0, 1));
            _quantization = _quantization.setPrecision(precision);
            if (_quantization.getOverflow() == Overflow.GROW) {
                output.setTypeEquals(BaseType.UNSIZED_FIX);
            } else {
View Full Code Here

TOP

Related Classes of ptolemy.data.IntMatrixToken

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.