public class TestAbstractReceiver extends AbstractReceiver
Constructor and Description |
---|
TestAbstractReceiver(IOPort container)
Construct an empty receiver with the specified container.
|
Modifier and Type | Method and Description |
---|---|
Token |
get()
Get a token from this receiver.
|
boolean |
hasRoom()
Return true if the receiver has room to put a token into it
(via the put() method).
|
boolean |
hasRoom(int numberOfTokens)
Return true if the receiver has room to put the specified number of
tokens into it (via the put() method).
|
boolean |
hasToken()
Return true if the receiver contains a token that can be obtained
by calling the get() method.
|
boolean |
hasToken(int numberOfTokens)
Return true if the receiver contains the specified number of tokens.
|
boolean |
isKnown()
Return true.
|
void |
put(Token token)
Put the specified token into this receiver.
|
clear, elementList, getArray, getContainer, getCurrentTime, getModelTime, putArray, putArrayToAll, putToAll, reset, setContainer, toString
public TestAbstractReceiver(IOPort container) throws IllegalActionException
container
- The container of the receiver.IllegalActionException
- If the container does
not accept this receiver.public Token get() throws NoTokenException
get
in interface Receiver
get
in class AbstractReceiver
NoTokenException
- If there is no token.public boolean hasRoom()
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
public boolean hasRoom(int numberOfTokens)
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
numberOfTokens
- The number of tokens to put into this receiver.public boolean hasToken()
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
public boolean hasToken(int numberOfTokens)
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
numberOfTokens
- The number of tokens desired.public boolean isKnown()
isKnown
in interface Receiver
isKnown
in class AbstractReceiver
public void put(Token token) throws NoRoomException, IllegalActionException
put
in interface Receiver
put
in class AbstractReceiver
token
- The token to put into the receiver.NoRoomException
- If there is no room in the receiver.IllegalActionException
- If the put fails
(e.g. because of incompatible types).