Package ptolemy.data

Examples of ptolemy.data.ArrayToken


        // Read the next input.
        _delayLine[0] = input.get(0);

        // output the output token.
        output.send(0, new ArrayToken(_delayLine));
    }
View Full Code Here


    public void fire() throws IllegalActionException {
        super.fire();
        if (!input.hasToken(0)) {
            return;
        }
        ArrayToken columns = (ArrayToken) columnSplit.getToken();
        ArrayToken rows = (ArrayToken) rowSplit.getToken();
        int[] columnsValue = new int[columns.length()];
        for (int i = 0; i < columnsValue.length; i++) {
            columnsValue[i] = ((IntToken) columns.getElement(i)).intValue();
        }
        int[] rowsValue = new int[rows.length()];
        for (int i = 0; i < rowsValue.length; i++) {
            rowsValue[i] = ((IntToken) rows.getElement(i)).intValue();
        }
        MatrixToken inputValue = (MatrixToken) input.get(0);
        MatrixToken[][] result = inputValue.split(rowsValue, columnsValue);
        for (int i = 0; i < result.length; i++) {
            for (int j = 0; j < result[i].length; j++) {
View Full Code Here

        for (int i = 0; i < p2.length; i++) {
            t2[i] = new DoubleToken(p2[i]);
        }

        senderLocation.setToken(new ArrayToken(t1));
        receiverLocation.setToken(new ArrayToken(t2));
        properties.setToken(initialProperties);

        if (_debugging) {
            _debug("----transformProperties is called; "
                    + "execute the subsystem.");
View Full Code Here

     @exception IllegalActionException If parameter values are invalid,
     *   or if there is no director.
     */
    public void fire() throws IllegalActionException {
        if (newCoefficients.hasToken(0)) {
            ArrayToken coefficientsToken = (ArrayToken) (newCoefficients.get(0));
            reflectionCoefficients.setToken(coefficientsToken);
        }

        for (int i = 0; i < _blockSizeValue; i++) {
            super.fire();
View Full Code Here

     *  dot product.
     *  @exception IllegalActionException If the input arrays have
     *  unequal widths or if the input arrays have no elements..
     */
    private void _arrayFire() throws IllegalActionException {
        ArrayToken token1 = (ArrayToken) input1.get(0);
        ArrayToken token2 = (ArrayToken) input2.get(0);

        Token[] array1 = token1.arrayValue();
        Token[] array2 = token2.arrayValue();

        if (array1.length != array2.length) {
            throw new IllegalActionException("Inputs to DotProduct have "
                    + "unequal lengths: " + array1.length + " and "
                    + array2.length + ".");
View Full Code Here

            throws IllegalActionException {
        if (attribute == xyPoints) {
            Token xypoints = xyPoints.getToken();

            if (xypoints instanceof ArrayToken) {
                ArrayToken xypointsArray = (ArrayToken) xypoints;

                if (xypointsArray.length() != _numberOfPoints) {
                    _numberOfPoints = xypointsArray.length();
                    _xPoints = new int[_numberOfPoints];
                    _yPoints = new int[_numberOfPoints];
                }

                for (int i = 0; i < xypointsArray.length(); i++) {
                    ArrayToken xypointArray = (ArrayToken) xypointsArray
                            .getElement(i);
                    _xPoints[i] = ((IntToken) xypointArray.getElement(0))
                            .intValue();
                    _yPoints[i] = ((IntToken) xypointArray.getElement(1))
                            .intValue();
                }

                _number++;
View Full Code Here

            for (int i = 0; i < location.length; i++) {
                locationArray[i] = new DoubleToken(location[i]);
            }

            double timeValue = getDirector().getModelTime().getDoubleValue();
            Token[] values = { new ArrayToken(locationArray),
                    new DoubleToken(timeValue) };
            Token result = new RecordToken(labels, values);

            output.send(0, result);
        }
View Full Code Here

        for (int i = 0; i < tapsArray.length; i++) {
            tapsArrayToken[i] = new DoubleToken(tapsArray[i]);
        }

        taps.setToken(new ArrayToken(BaseType.DOUBLE, tapsArrayToken));
    }
View Full Code Here

     @return An array that contains the 2D polygonal vertex coordinates.
     *  @exception IllegalActionException If the value of the <i>polygon</i>
     *   parameter can't be obtained.
     */
    private float[] _getPolygon() throws IllegalActionException {
        ArrayToken polygonToken = ((ArrayToken) polygon.getToken());

        int numberOfElements = polygonToken.length() / 2;

        // FIXME: What is this naked constant 18?
        // It seems the array gets filled with other things
        // after being returned.
        float[] data = new float[numberOfElements * 18];

        int j = 0;

        for (int i = 0; i < (numberOfElements * 2); i = i + 2) {
            data[j++] = (float) ((DoubleToken) polygonToken.getElement(i))
                    .doubleValue();
            data[j++] = (float) ((DoubleToken) polygonToken.getElement(i + 1))
                    .doubleValue();
            data[j++] = 0.0f;
        }

        return data;
View Full Code Here

     @return the number of vertices in the base polygon
     *  @exception IllegalActionException If the value of some parameters can't
     *   be obtained
     */
    private int _getVertexCount() throws IllegalActionException {
        ArrayToken polygonToken = ((ArrayToken) polygon.getToken());
        return polygonToken.length() / 2;
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.ArrayToken

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.