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: GRReceiver.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- C. Fong
- See Also:
Mailbox
- Accepted Rating:
- Proposed Rating:
Constructor Summary |
GRReceiver()
Construct an empty GRReceiver with no container. |
GRReceiver(IOPort container)
Construct an empty GRReceiver with the specified container. |
Method Summary |
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.AbstractReceiver |
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, reset, setContainer, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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.
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