Package ptolemy.data

Examples of ptolemy.data.Token


            RendezvousReceiver next = (RendezvousReceiver) zeroInDegreeIterator
                    .next();
            zeroInDegreeIterator.remove();

            if (next._symmetricPutReceivers != null) {
                Token token = next._token;
                Receiver[][] putReceivers = next._symmetricPutReceivers;

                // Delete the out-edges.
                if (next._getConditional) {
                    for (int i = 0; i < putReceivers.length; i++) {
View Full Code Here


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

                NamedObj nextDestination = (NamedObj) destinations.next();

                // Need to get the next channel even if it's not used.
                Integer channel = (Integer) channels.next();
                ASTPtRootNode parseTree = (ASTPtRootNode) parseTrees.next();
                Token token;

                // In MultirateFSMDirector, the initial transition from
                // the initial state is taken during preinitialize() if
                // the initial state does not have a refinement, therefore
                // _scope need to be initialized here. -- Gang
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();

        if (payload.hasToken(0)) {
            Token inputValue = payload.get(0);

            if (_debugging) {
                _debug("Input data received: " + inputValue.toString());
            }

            if (properties.hasToken(0)) {
                Token propertiesValue = properties.get(0);

                // The following will throw an exception if the value is
                // not a RecordToken.
                output.outsideTransmitProperties.setToken(propertiesValue);
            } else {
View Full Code Here

            throws IllegalActionException {
        double range = Double.POSITIVE_INFINITY;
        boolean rangeIsSet = false;

        if (properties != null) {
            Token field = properties.get("range");

            if (field instanceof ScalarToken) {
                // NOTE: This may throw a NotConvertibleException, if,
                // example, a Complex or a Long is given.
                range = ((ScalarToken) field).doubleValue();
                rangeIsSet = true;
            }
        }

        if (!rangeIsSet) {
            // Type constraints in the constructor make the casts safe.
            RecordToken defaultPropertiesValue = (RecordToken) defaultProperties
                    .getToken();

            // Type of the field must be convertible to double, but
            // need not actually be a double.
            ScalarToken field = (ScalarToken) defaultPropertiesValue
                    .get("range");
            range = field.doubleValue();
        }

        boolean result = (_distanceBetween(source, destination) <= range);

        if (result) {
View Full Code Here

                double timeValue = getDirector().getModelTime()
                        .getDoubleValue();
                Token[] values = { new ArrayToken(locationArray),
                        new DoubleToken(timeValue), new IntToken(0) };
                Token result = new RecordToken(labels, values);

                output.send(0, result);
            } else {
                // It is the pursuer. Send its parent info to the pursuer.
                if (_timeValue > 0.0) {
                    String[] labels = { "location", "time", "depth" };

                    Token[] values = { new ArrayToken(_parentLocation),
                            new DoubleToken(_timeValue),
                            new IntToken(_parentDepth) };
                    Token result = new RecordToken(labels, values);

                    output.send(0, result);
                }
            }
        }
View Full Code Here

        if (temporaryAttribute == null) {
            return 1;
        } else if (temporaryAttribute instanceof Variable) {
            Variable weightAttribute = (Variable) temporaryAttribute;
            Token weightToken = weightAttribute.getToken();

            if (weightToken instanceof ScalarToken) {
                ScalarToken weightScalarToken = (ScalarToken) weightToken;
                return weightScalarToken.intValue();
            }
View Full Code Here

     *   to this container.
     */
    public void attributeChanged(Attribute attribute)
            throws IllegalActionException {
        if (attribute == defaultProperties) {
            Token value = defaultProperties.getToken();

            if ((value != null) && !(value instanceof RecordToken)) {
                throw new IllegalActionException(this,
                        "Expected a record for defaultProperties but got: "
                                + value);
View Full Code Here

     */
    public RecordToken transformProperties(RecordToken properties,
            WirelessIOPort source, WirelessIOPort destination)
            throws IllegalActionException {
        RecordToken result = properties;
        Token defaultPropertiesValue = defaultProperties.getToken();

        if (defaultPropertiesValue instanceof RecordToken) {
            if (properties != null) {
                result = RecordToken.merge(properties,
                        (RecordToken) defaultPropertiesValue);
View Full Code Here

        if (token != null) {
            if (receiver.hasRoom()) {
                WirelessIOPort destination = (WirelessIOPort) receiver
                        .getContainer();
                Token newToken = destination.convert(token);

                // Transform the properties.
                Token transformedProperties = transformProperties(properties,
                        sender, destination);
                receiver.put(newToken, transformedProperties);
                // Notify any channel listeners after the transmission occurs.
                channelNotify(properties, token, sender, destination);
            }
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.