Package ptolemy.domains.gr.kernel
Class GRReceiver
- java.lang.Object
-
- ptolemy.actor.AbstractReceiver
-
- ptolemy.actor.Mailbox
-
- ptolemy.domains.gr.kernel.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 Summary
Constructors Constructor Description GRReceiver()
Construct an empty GRReceiver with no container.GRReceiver(IOPort container)
Construct an empty GRReceiver with the specified container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasRoom()
Return true, since the new token will override the old one.void
put(Token token)
Put a token into this receiver.-
Methods inherited from class ptolemy.actor.Mailbox
clear, elementList, get, hasRoom, hasToken, hasToken
-
Methods inherited from class ptolemy.actor.AbstractReceiver
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, reset, setContainer, toString
-
-
-
-
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.
-
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 interfaceReceiver
- Overrides:
put
in classMailbox
- Parameters:
token
- The token to be put into this receiver.- Throws:
NoRoomException
- Not thrown in this base class
-
-