Package ptolemy.data

Examples of ptolemy.data.Token


        if (control.hasToken(0)) {
            _control = ((BooleanToken) control.get(0)).booleanValue();
        }

        if (input.hasToken(0)) {
            Token token = input.get(0);

            if (_control) {
                trueOutput.send(0, token);
            } else {
                falseOutput.send(0, token);
View Full Code Here


        if (type == BaseType.INT) {

            int[][] tokens = (int[][]) outputTokens;
            for (int i = 0; i < port.getWidthInside(); i++) {
                for (int k = 0; k < rate; k++) {
                    Token token = new IntToken(tokens[i][k]);
                    port.send(i, token);
                }
            }

        } else if (type == BaseType.DOUBLE) {

            double[][] tokens = (double[][]) outputTokens;
            for (int i = 0; i < port.getWidthInside(); i++) {
                for (int k = 0; k < rate; k++) {
                    Token token = new DoubleToken(tokens[i][k]);
                    port.send(i, token);
                }
            }

        } else if (type == PointerToken.POINTER) {

            int[][] tokens = (int[][]) outputTokens;
            for (int i = 0; i < port.getWidthInside(); i++) {
                for (int k = 0; k < rate; k++) {
                    Token token = new PointerToken(tokens[i][k]);
                    port.send(i, token);
                }
            }

        } else if (type == BaseType.BOOLEAN) {

            boolean[][] tokens = (boolean[][]) outputTokens;
            for (int i = 0; i < port.getWidthInside(); i++) {
                for (int k = 0; k < rate; k++) {
                    Token token = new BooleanToken(tokens[i][k]);
                    port.send(i, token);
                }
            }

        } else {
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        // FIXME
        //double time = getDirector().getModelTime().getDoubleValue();
        if ((periodControl.getWidth() > 0) && periodControl.hasToken(0)) {
            Token in = periodControl.get(0);
            period.setToken(in);
        }

        super.fire();
    }
View Full Code Here

     * @exception IllegalActionException If there are errors in obtaining
     *  the receivers of this actor.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        Token token = null;
        Receiver[][] inputReceivers = input.getReceivers();

        if (inputReceivers.length == 0) {
            _continueIterations = false;
        }
View Full Code Here

     * @exception IllegalActionException If there are errors in obtaining
     *  the receivers of this actor.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        Token token = null;
        Receiver[][] inputReceivers = input.getReceivers();

        if (inputReceivers.length == 0) {
            _continueIterations = false;
        }
View Full Code Here

        if (q2Length.hasToken(0)) {
            _q2Length = ((IntToken) q2Length.get(0)).intValue();
        }

        if (input.hasToken(0)) {
            Token pkt = input.get(0);
            double r = Math.random();
            int min = ((IntToken) minMark.getToken()).intValue();
            int max = ((IntToken) maxMark.getToken()).intValue();
            double l = 0.0;
View Full Code Here

        if (q2_len.hasToken(0)) {
            _q2len = ((IntToken) q2_len.get(0)).intValue();
        }

        if (pkt_in.hasToken(0)) {
            Token pkt = pkt_in.get(0);

            if (_q1len > _q2len) {
                q2_out.broadcast(pkt);
            } else {
                q1_out.broadcast(pkt);
View Full Code Here

     @exception IllegalActionException If the transaction fails (e.g.
     *   the data type is incompatible).
     */
    public void put(HashMap data) throws RemoteException,
            IllegalActionException {
        Token token = (Token) data.keySet().iterator().next();
        LinkedList idsList = (LinkedList) data.get(token);

        if (VERBOSE) {
            System.out.println("Received data. Token: " + token.toString()
                    + " ids: " + idsList);
        }

        for (Iterator ids = idsList.iterator(); ids.hasNext();) {
            Integer id = (Integer) ids.next();
View Full Code Here

        if (input.hasToken(0)) {
            if (_queue.size() < c) {
                _queue.add(input.get(0));
            } else {
                Token token = (Token) _queue.removeFirst();
                _queue.add(input.get(0));
                dropped.broadcast(token);
            }
        } else {
            output.broadcast((Token) _queue.removeFirst());
View Full Code Here

        if (_parserScope == null) {
            _parserScope = new ScheduleScope();
        }

        Token result = _parseTreeEvaluator
                .evaluateParseTree(node, _parserScope);
        return result;
    }
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.