Class MetroIIPtidesReceiver

  • All Implemented Interfaces:
    Receiver

    public class MetroIIPtidesReceiver
    extends DEReceiver
    Receivers in the Ptides domain use a timed queue to sort events in the receivers. Tokens are stored in the receiver as a pair of token and tag, to help methods such as hasToken() to indicate whether there is a token of the requested tag. This receiver is needed because events can be processed out of timestamp order, thus tokens are transmitted between actors out of timestamp order. Some of this code is copied from PtidesReceiver written by Patricia Derler, since we want to have a sorted list of events at each receiver. However we still want to extend DEReceiver so that the structure is uniform in that PtidesBasicDirector extends DEDirector, and PtidesBasicReceiver extends DEReceiver.

    This class is identical to PtidesReceiver except Ptides directors are mapped to MetroIIPtidesDirector.

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Jia Zou, Slobodan Matic, Liangpeng Guo
    Pt.AcceptedRating:
    Red (jiazou)
    Pt.ProposedRating:
    Yellow (jiazou)
    • Constructor Detail

      • MetroIIPtidesReceiver

        public MetroIIPtidesReceiver()
        Construct an empty queue with no container.
      • MetroIIPtidesReceiver

        public MetroIIPtidesReceiver​(IOPort container)
                              throws IllegalActionException
        Construct an empty queue with the specified IOPort container.
        Parameters:
        container - The IOPort that contains this receiver.
        Throws:
        IllegalActionException - If this receiver cannot be contained by the proposed container.
    • Method Detail

      • put

        public void put​(Token token)
                 throws IllegalActionException
        Wrap the token in an DETokenEvent and post the trigger event to the director. The director will be responsible to dequeue the trigger event at the correct timestamp and microstep and invoke the corresponding actor whose input port contains this receiver. This receiver may contain more than one events.
        Specified by:
        put in interface Receiver
        Overrides:
        put in class DEReceiver
        Parameters:
        token - The token to be put, or null to not put a token.
        Throws:
        IllegalActionException
      • putToReceiver

        public void putToReceiver​(Token token)
        Actually put the token into this receiver. This method should be called by the director when to token is ready to be processed by the actor where this receiver resides.
        Parameters:
        token - The token to be put to this receiver, or null to put no token.
      • remove

        public void remove​(Token token)
        Remove the token from the list of stored tokens. This is only used to remove tokens that were stored temporarily in the receiver to check whether the actor's prefire returns true.
        Parameters:
        token - The token to be removed.