Package ptolemy.data

Examples of ptolemy.data.Token


     * @exception IllegalActionException Not thrown in this base class.
     */
    public void fire() throws IllegalActionException  {
        super.fire();
        if (input.hasToken(0)) {
            Token savedState = _stateVector[_currentTap];
            Token yCurrent = _computeOutput(input.get(0));
            $ASSIGN$_latestWindow(_stateVector[_currentTap]);
            $ASSIGN$_stateVector(_currentTap, savedState);
            output.send(0, yCurrent);
        }
    }
View Full Code Here


    private Token _computeOutput(Token xCurrent) throws IllegalActionException  {
        for (int j = 1; j < _denominator.length; j++) {
            xCurrent = xCurrent.subtract(_denominator[j].multiply(_stateVector[(_currentTap + j) % _stateVector.length]));
        }
        $ASSIGN$_stateVector(_currentTap, xCurrent);
        Token yCurrent = _numerator[0].zero();
        for (int k = 0; k < _numerator.length; k++) {
            yCurrent = yCurrent.add(_numerator[k].multiply(_stateVector[(_currentTap + k) % _stateVector.length]));
        }
        return yCurrent;
    }
View Full Code Here

    private void _initStateVector() throws IllegalActionException  {
        if (_numerator.length > 0) {
            int stateSize = java.lang.Math.max(_numerator.length, _denominator.length);
            $ASSIGN$_stateVector(new Token[stateSize]);
            Token zero = _numerator[0].zero();
            for (int j = 0; j < _stateVector.length; j++) {
                $ASSIGN$_stateVector(j, zero);
            }
        }
    }
View Full Code Here

                $ASSIGN$SPECIAL$_latestCount(12, _latestCount);
                $ASSIGN$_consumed(true);
            }
        }
        if (_consumed) {
            Token out = new IntToken(_latestCount);
            output.send(0, out);
        }
    }
View Full Code Here

        while (ports.hasNext()) {
            TypedIOPort port = (TypedIOPort) ports.next();

            if (port.isInput() && port.hasToken(0)
                    && !(port.isOutput() && !port.isInput())) {
                Token tok = port.get(0);

                String typ = _methods[_methodIndex].getParameterTypes()[args
                        .size()].toString();

                if (typ.equals("boolean")) {
View Full Code Here

                previous = _indexes[i];
            }
        } else if (attribute == values) {
            try {
                ArrayToken valuesArray = (ArrayToken)values.getToken();
                Token prototype = valuesArray.getElement(0);
                $ASSIGN$_zero(prototype.zero());
            } catch (ArrayIndexOutOfBoundsException ex) {
                throw new IllegalActionException(this, "Cannot set values to an empty array.");
            } catch (ClassCastException ex) {
                throw new IllegalActionException(this, "Cannot set values to something that is not an array: " + values.getToken());
            }
View Full Code Here

        super.fire();
        if (control.hasToken(0)) {
            $ASSIGN$_control(((IntToken)control.get(0)).intValue());
        }
        if (input.hasToken(0)) {
            Token token = input.get(0);
            if ((_control >= 0) && (_control < output.getWidth())) {
                output.send(_control, token);
            }
        }
    }
View Full Code Here

                }
            }
        }
        for (int i = 0; i < input.getWidth(); i++) {
            if (input.hasToken(i)) {
                Token in = input.get(i);
                $ASSIGN$_latestSum(_latestSum.add(in));
            }
        }
        Token lowerBoundValue = lowerBound.getToken();
        if (lowerBoundValue != null) {
            if (lowerBoundValue instanceof ScalarToken) {
                if (((ScalarToken)lowerBoundValue).isGreaterThan((ScalarToken)_latestSum).booleanValue()) {
                    $ASSIGN$_latestSum(lowerBoundValue);
                }
            } else {
                throw new IllegalActionException(this, "lowerBound parameter only works with scalar values. Value given was: " + lowerBoundValue);
            }
        }
        Token upperBoundValue = upperBound.getToken();
        if (upperBoundValue != null) {
            if (upperBoundValue instanceof ScalarToken) {
                if (((ScalarToken)upperBoundValue).isLessThan((ScalarToken)_latestSum).booleanValue()) {
                    $ASSIGN$_latestSum(upperBoundValue);
                }
View Full Code Here

                    $ASSIGN$_latestCount(0);
                }
            }
        }
        if (input.hasToken(0)) {
            Token in = input.get(0);
            $ASSIGN$SPECIAL$_latestCount(11, _latestCount);
            if (_latestSum == null) {
                $ASSIGN$_latestSum(in);
            } else {
                $ASSIGN$_latestSum(_latestSum.add(in));
            }
            Token out = _latestSum.divide(new IntToken(_latestCount));
            output.broadcast(out);
        }
    }
View Full Code Here

    public boolean postfire() throws IllegalActionException  {
        int width = input.getWidth();
        Token[] record = new Token[width];
        for (int i = 0; i < width; i++) {
            if (input.hasToken(i)) {
                Token token = input.get(i);
                record[i] = token;
                $ASSIGN$SPECIAL$_count(11, _count);
            }
        }
        int capacityValue = ((IntToken)(capacity.getToken())).intValue();
View Full Code Here

TOP

Related Classes of ptolemy.data.Token

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.