public class TMReceiver extends AbstractReceiver
TMDirector
Constructor and Description |
---|
TMReceiver()
Construct an empty TMReceiver with no container.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_triggerEvent(Token token)
Make a token available to the get() method.
|
void |
clear()
Clear this receiver of any contained tokens.
|
java.util.List<Token> |
elementList()
Return a list with the tokens currently in the receiver, or
an empty list if there are no such tokens.
|
Token |
get()
Get a token from the receiver.
|
TMDirector |
getDirector()
Return the director that created this receiver.
|
boolean |
hasRoom()
Return true, indicating that there is always room.
|
boolean |
hasRoom(int tokens)
Return true, indicating that there is always room for any number
of tokens.
|
boolean |
hasToken()
Return true if there is at least one token available to the
get() method.
|
boolean |
hasToken(int numberOfTokens)
Return true if there are numberOfTokens
tokens available to the get() method.
|
void |
put(Token token)
Put a token into this receiver.
|
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, reset, setContainer, toString
public void clear()
clear
in interface Receiver
clear
in class AbstractReceiver
public java.util.List<Token> elementList()
elementList
in interface Receiver
elementList
in class AbstractReceiver
public Token get() throws NoTokenException
get
in interface Receiver
get
in class AbstractReceiver
NoTokenException
- Not thrown in this base class.public TMDirector getDirector() throws IllegalActionException
IllegalActionException
- If there is no container port, or
if the port has no container actor, or if the actor has no director,
or if the director is not an instance of TMDirector.public final boolean hasRoom()
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
public final boolean hasRoom(int tokens)
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
tokens
- The number of tokens, currently ignored.public final boolean hasToken()
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
public final boolean hasToken(int numberOfTokens)
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
numberOfTokens
- The number of tokens, currently ignored.public void put(Token token)
put
in interface Receiver
put
in class AbstractReceiver
token
- The token to be put, or null to put no token.protected void _triggerEvent(Token token)
token
- The token to make available to get().