Package ptolemy.data

Examples of ptolemy.data.ArrayToken.arrayValue()


     * with an unrecognized parameter.
     */
    public void attributeChanged(Attribute attribute) throws IllegalActionException  {
        if (attribute == numerator) {
            ArrayToken numeratorValue = (ArrayToken)numerator.getToken();
            $ASSIGN$_numerator(numeratorValue.arrayValue());
        } else if (attribute == denominator) {
            ArrayToken denominatorValue = (ArrayToken)denominator.getToken();
            $ASSIGN$_denominator(denominatorValue.arrayValue());
            if (!_denominator[0].isEqualTo(_denominator[0].one()).booleanValue()) {
                try {
View Full Code Here


        if (attribute == numerator) {
            ArrayToken numeratorValue = (ArrayToken)numerator.getToken();
            $ASSIGN$_numerator(numeratorValue.arrayValue());
        } else if (attribute == denominator) {
            ArrayToken denominatorValue = (ArrayToken)denominator.getToken();
            $ASSIGN$_denominator(denominatorValue.arrayValue());
            if (!_denominator[0].isEqualTo(_denominator[0].one()).booleanValue()) {
                try {
                    MessageHandler.warning("First denominator value is required to be 1. " + "Using 1.");
                } catch (CancelException ex) {
                    throw new IllegalActionException(this, "Canceled parameter change.");
View Full Code Here

        int outputWidth = 0;
        Token[][] inputs = new Token[width][];
        for (int i = 0; i < width; i++) {
            if (input.hasToken(i)) {
                ArrayToken token = (ArrayToken) input.get(i);
                inputs[i] = token.arrayValue();
                outputWidth += inputs[i].length;
            }
        }
        Token[] array = new Token[outputWidth];
        int runningPosition = 0;
View Full Code Here

        _updateInitialTrace();

        // Produce the data on the output so that this can be used in
        // feedback look in dataflow models.
        ArrayToken arrayToken = (ArrayToken) initialTrace.getToken();
        output.send(0, arrayToken.arrayValue(), arrayToken.length());

        _count = 0;
    }

    /** Override the base class to create an initial trace.
View Full Code Here

        if (_outputRate == -1) {
            output.broadcast(result);
        } else {
            // FIXME: Check size.
            ArrayToken resultArray = (ArrayToken) result;
            output.broadcast(resultArray.arrayValue(), resultArray.length());
        }
    }

    /** Return true if the input ports have enough tokens.
     *  @exception IllegalActionException Not thrown in this base class.
View Full Code Here

     *   or if there is no director, or if runtime type conflicts occur.
     */
    public void fire() throws IllegalActionException {
        if (newTaps.hasToken(0)) {
            ArrayToken tapsToken = (ArrayToken) (newTaps.get(0));
            _taps = tapsToken.arrayValue();

            // Get a token representing zero in the appropriate type.
            _zero = _taps[0].zero();

            _reinitialize();
View Full Code Here

            }

            _reinitializeNeeded = true;
        } else if (attribute == taps) {
            ArrayToken tapsToken = (ArrayToken) (taps.getToken());
            _taps = tapsToken.arrayValue();

            // Get a token representing zero in the appropriate type.
            _zero = _taps[0].zero();

            _reinitializeNeeded = true;
View Full Code Here

                    + "number of elements in the input ArrayToken ("
                    + token.length() + ") is not the same as the arrayLength "
                    + "parameter (" + rate + ").");
        }

        Token[] elements = token.arrayValue();
        output.send(0, elements, elements.length);
    }

    /** Return the type constraint that the type of the output port is no
     *  less than the type of the elements of the input array.
View Full Code Here

    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

            throw new IllegalActionException(this, "Table parameter must "
                    + "have at least " + size + " entries, but only has "
                    + tableToken.length());
        }

        _table = tableToken.arrayValue();
    }

    ///////////////////////////////////////////////////////////////////
    ////                         private variables                 ////
    // Local cache of these parameter values.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.