Package ptolemy.data

Examples of ptolemy.data.Token


            RecordToken record = (RecordToken) input.get(0);
            Iterator labels = record.labelSet().iterator();

            while (labels.hasNext()) {
                String label = (String) labels.next();
                Token value = record.get(label);
                IOPort port = (IOPort) getPort(label);

                // since the record received may contain more fields than the
                // output ports, some fields may not have a corresponding
                // output port.
View Full Code Here


                //    (yet when I ran it with 'throw...' uncommented
                //     then it threw it right away!? )
                // Would TCP stall here awaiting reply??  I doubt it!
            }

            triggerOutput.broadcast(new Token());
        }
    }
View Full Code Here

     @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        if (input.hasToken(0)) {
            Token in = input.get(0);
            Token factorToken = factor.getToken();
            Token result;

            if (((BooleanToken) scaleOnLeft.getToken()).booleanValue()) {
                // Scale on the left.
                result = factorToken.multiply(in);
            } else {
View Full Code Here

        for (int i = 0; i < _pmf.length; i++) {
            alphabetTokens[i] = alphabetArrayToken.getElement(i);
        }

        // Get the input token. Ready for output.
        Token inputToken = input.get(0);

        // Find the token in the alphabet;
        //boolean validInput = false;

        for (int i = 0; i < _pmf.length; i++) {
            if (inputToken.equals(alphabetTokens[i])) {
                //validInput = true;
                _sendBooleans(_codeBook[i]);
                break;
            }
        }
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();
        for (int i = 0; i < input.getWidth(); i++) {
            if (input.hasToken(i)) {
                Token token = input.get(i);
                output.send(i, token);
            }
        }
    }
View Full Code Here

            if (input.hasToken(i)) {
                ImageToken imageToken = (ImageToken) input.get(i);
                Image image = imageToken.asAWTImage();
                String description = "Image: " + image.getWidth(null) + " x "
                        + image.getHeight(null);
                Token out = new StringToken(description);
                output.broadcast(out);
            }
        }
    }
View Full Code Here

        int width = input.getWidth();
        if (width == 0) {
            throw new IllegalActionException(this,
                    "SubscriptionAggregator has no matching Publisher.");
        }
        Token result = null;
        for (int i = 0; i < width; i++) {
            if (input.hasToken(i)) {
                Token token = input.get(i);
                if (result == null) {
                    result = token;
                } else {
                    if (_addOperation) {
                        result = result.add(token);
View Full Code Here

                int next = nextKey.intValue();

                while (next == _nextSequenceNumber) {
                    _nextSequenceNumber++;

                    Token token = (Token) _pending.remove(nextKey);
                    output.send(0, token);

                    if (_pending.size() == 0) {
                        break;
                    }
View Full Code Here

     @exception IllegalActionException If there is no director, or
     *   if the base class throws it.
     */
    public boolean postfire() throws IllegalActionException {
        if (input.hasToken(0)) {
            final Token in = input.get(0);

            // Display probably to be done in the Swing event thread.
            Runnable doDisplay = new Runnable() {
                public void run() {
                    _display(in);
View Full Code Here

     *   or if addition and subtraction are not supported by the
     *   available tokens.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        Token sum = null;

        for (int i = 0; i < plus.getWidth(); i++) {
            if (plus.hasToken(i)) {
                if (sum == null) {
                    sum = plus.get(i);
                } else {
                    sum = sum.add(plus.get(i));
                }
            }
        }

        for (int i = 0; i < minus.getWidth(); i++) {
            if (minus.hasToken(i)) {
                Token in = minus.get(i);

                if (sum == null) {
                    sum = in.zero();
                }

                sum = sum.subtract(in);
            }
        }
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.