Class GRReceiver

  • All Implemented Interfaces:
    Receiver

    public class GRReceiver
    extends Mailbox
    The receiver for the GR domain. This receiver is a mailbox with capacity one, and any token put in the receiver overwrites any token previously present in the receiver. As a consequence, the hasRoom() method always returns true. The get() method will consume the token if there exists one. After the consumption, the hasToken() method will return false, until a token is put into this receiver.
    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    C. Fong
    See Also:
    Mailbox
    Pt.AcceptedRating:
    yellow (vogel)
    Pt.ProposedRating:
    yellow (chf)
    • Constructor Detail

      • GRReceiver

        public GRReceiver()
        Construct an empty GRReceiver with no container.
      • GRReceiver

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

      • hasRoom

        public boolean hasRoom()
        Return true, since the new token will override the old one.
        Specified by:
        hasRoom in interface Receiver
        Overrides:
        hasRoom in class Mailbox
        Returns:
        True.
      • put

        public void put​(Token token)
                 throws NoRoomException
        Put a token into this receiver. If the argument is null, then this receiver will not contain a token after this method returns. If the receiver already has a token, then the new token will override the old token, and the old token will be lost.
        Specified by:
        put in interface Receiver
        Overrides:
        put in class Mailbox
        Parameters:
        token - The token to be put into this receiver.
        Throws:
        NoRoomException - Not thrown in this base class