public class TDLReceiver extends AbstractReceiver implements StateReceiver
| Constructor and Description |
|---|
TDLReceiver()
Construct an empty TDLReceiver with no container.
|
TDLReceiver(IOPort container)
Construct an empty TDLReceiver with the specified container.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear this receiver of any contained tokens.
|
void |
copyTokensTo(TDLReceiver newReceiver)
Copy tokens to another receiver.
|
java.util.List<Token> |
elementList()
Return a list with the token currently in the receiver, or
an empty list if there is no such token.
|
Token |
get()
Get the contained and available token, i.e., get the last token that has
been put into the receiver before the last update.
|
Token |
getTok()
access method for the token, for testing purposes.
|
boolean |
hasRoom()
Return true, since writing to this receiver is always allowed.
|
boolean |
hasRoom(int numberOfTokens)
Return true, since writing to this receiver is always allowed.
|
boolean |
hasToken()
Return true if there is a token available.
|
boolean |
hasToken(int numberOfTokens)
Return true if the receiver has at least one token available.
|
void |
init(Token token)
Set the initial value of the receiver.
|
void |
put(Token token)
Put a token into this receiver.
|
Token |
remove()
Get the contained and available token, i.e., get the last token that has
been put into the receiver before the last update and reset the _token
only.
|
void |
reset()
Reset the receiver by removing all tokens from the receiver.
|
void |
update()
Update the receiver by making the last token that has been passed to
put() available to get().
|
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, setContainer, toStringpublic TDLReceiver()
public TDLReceiver(IOPort container) throws IllegalActionException
container - The container.IllegalActionException - If the container does not accept this receiver.public void clear()
clear in interface Receiverclear in class AbstractReceiverpublic java.util.List<Token> elementList()
elementList in interface ReceiverelementList in class AbstractReceiverpublic Token get() throws NoTokenException
get in interface Receiverget in class AbstractReceiverNoTokenException - If no token is available.public boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class AbstractReceiverpublic final boolean hasRoom(int numberOfTokens)
hasRoom in interface ReceiverhasRoom in class AbstractReceivernumberOfTokens - The size of tokens to be written to the receiver.public boolean hasToken()
hasToken in interface ReceiverhasToken in class AbstractReceiverpublic final boolean hasToken(int numberOfTokens)
hasToken in interface ReceiverhasToken in class AbstractReceivernumberOfTokens - The number of tokens available in this receiver.public void put(Token token) throws NoRoomException
Note that putting a null into this receiver will leave the receiver empty after update. The receiver does not check against this but expects that IOPort will always put non-null tokens into receivers.
put in interface Receiverput in class AbstractReceivertoken - The token to be put into this receiver.NoRoomException - Not thrown in this base class.public Token remove() throws NoTokenException
NoTokenException - If no token is available.public void reset()
reset in interface Receiverreset in class AbstractReceiverpublic void update()
public void init(Token token)
token - The initial token.public Token getTok()
public void copyTokensTo(TDLReceiver newReceiver)
newReceiver - Receiver that gets the copied tokens.