Package ptolemy.data

Examples of ptolemy.data.Token


                changeMade = true;
                continue;
            }

            if ((port.getWidth() > 0) && port.hasToken(0)) {
                Token token = port.get(0);

                if (_model != null) {
                    Attribute attribute = _model.getAttribute(port.getName());

                    // Use the token directly rather than a string if possible.
                    if (attribute instanceof Variable) {
                        if (_debugging) {
                            _debug("** Transferring input to parameter: "
                                    + port.getName());
                        }

                        ((Variable) attribute).setToken(token);
                        changeMade = true;
                    } else if (attribute instanceof Settable) {
                        if (_debugging) {
                            _debug("** Transferring input as string to parameter: "
                                    + port.getName());
                        }

                        ((Settable) attribute).setExpression(token.toString());
                        changeMade = true;
                    }
                }
            }
        }
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)) {
            Token in = input.get(0);

            if (_frame != null) {
                List tokens = new LinkedList();
                tokens.add(in);
                _effigy.setTokens(tokens);
View Full Code Here

        if ((director.getExecutionPhase() == CTExecutionPhase.GENERATING_EVENTS_PHASE)
                && hasCurrentEvent()) {
            for (int i = 0; i < Math.min(input.getWidth(), output.getWidth()); i++) {
                if (input.hasToken(i)) {
                    Token token = input.get(i);
                    output.send(i, token);

                    if (_debugging) {
                        _debug(getFullName(), " sends event: " + token
                                + " to channel " + i + ", at: "
View Full Code Here

                output.broadcast(input.get(0));
            } else {
                // FIXME: it now only considers one input port for data and the
                // function only has one argument.  how to resolve type and type
                // signature?
                Token in = input.get(0);
                Token[] argList = new Token[] { in };
                Token t = _function.apply(argList);
                output.broadcast(t);
            }
        }
    }
View Full Code Here

        while (ports.hasNext()) {
            TypedIOPort port = (TypedIOPort) ports.next();
            arguments[i++] = port.get(0);
        }

        Token t = functionValue.apply(arguments);
        output.broadcast(t);
    }
View Full Code Here

            String label = (String) labels[i];
            Attribute attribute = model.getAttribute(label);

            // Use the token directly rather than a string if possible.
            if (attribute != null) {
                Token token = args.get(label);

                if (attribute instanceof Variable) {
                    ((Variable) attribute).setToken(token);
                } else if (attribute instanceof Settable) {
                    ((Settable) attribute).setExpression(token.toString());
                }
            }
        }
    }
View Full Code Here

                // if nothing is connected to the port on the
                // inside.
                try {
                    if (port.isKnown(i)) {
                        if (port.hasToken(i)) {
                            Token t = port.get(i);

                            if (_debugging) {
                                _debug(getName(), "transferring input from "
                                        + port.getName());
                            }
View Full Code Here

            for (int i = 0; i < port.getWidthInside(); i++) {
                try {
                    ArrayList list = new ArrayList();

                    while (port.isKnownInside(i) && port.hasTokenInside(i)) {
                        Token t = port.getInside(i);
                        list.add(t);
                    }

                    if (list.size() != 0) {
                        Token[] tokens = (Token[]) list.toArray(new Token[list
View Full Code Here

            Type type = ((ArrayType) getType()).getElementType();

            if (type.equals(token.getType())) {
                return token;
            } else {
                Token newToken = type.convert(token);
                return newToken;
            }
        }
View Full Code Here

                }

                for (int j = 0; j < farReceivers[channelIndex].length; j++) {
                    TypedIOPort port = (TypedIOPort) farReceivers[channelIndex][j]
                            .getContainer();
                    Token newToken = port.convert(token);
                    farReceivers[channelIndex][j].put(newToken);
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
                // NOTE: This may occur if the channel index is out of range.
                // This is allowed, just do nothing.
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.