public class FSMReceiver extends AbstractReceiver
Constructor and Description |
---|
FSMReceiver()
Construct an empty receiver with no container.
|
FSMReceiver(IOPort container)
Construct an empty receiver with the specified container.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear this receiver of any contained token and set the known
status to true.
|
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 Token.
|
Token[] |
getArray(int numberOfTokens)
If the argument is 1, there is a token, and the status is known,
then return an array containing the one token.
|
boolean |
hasRoom()
Return true.
|
boolean |
hasRoom(int numberOfTokens)
Return true if the argument is 1, and otherwise return false.
|
boolean |
hasToken()
Return true if this mailbox is not empty.
|
boolean |
hasToken(int numberOfTokens)
Return true if the argument is 1 and this receiver is not empty,
and otherwise return false.
|
boolean |
isKnown()
Return whether the state of the receiver is known.
|
void |
put(Token token)
Put a token into this receiver.
|
void |
putArray(Token[] tokenArray,
int numberOfTokens)
If the argument has one token, then put that token in
the receiver.
|
void |
reset()
Set the receiver to unknown.
|
getContainer, getCurrentTime, getModelTime, putArrayToAll, putToAll, setContainer, toString
public FSMReceiver()
public FSMReceiver(IOPort container) throws IllegalActionException
container
- The container.IllegalActionException
- If the container does
not accept this receiver.public void clear()
clear
in interface Receiver
clear
in class AbstractReceiver
public java.util.List<Token> elementList() throws IllegalActionException
elementList
in interface Receiver
elementList
in class AbstractReceiver
IllegalActionException
- If the status is unknown.public Token get() throws NoTokenException
get
in interface Receiver
get
in class AbstractReceiver
NoTokenException
- If this receiver is empty or unknownpublic Token[] getArray(int numberOfTokens) throws NoTokenException
getArray
in interface Receiver
getArray
in class AbstractReceiver
numberOfTokens
- The number of tokens to get.NoTokenException
- If the status is unknown, if there is
no token, or if the argument is not 1.public boolean hasRoom()
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
public boolean hasRoom(int numberOfTokens) throws java.lang.IllegalArgumentException
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
numberOfTokens
- The number of tokens to put into the receiver.java.lang.IllegalArgumentException
- If the argument is not positive.
This is a runtime exception, so it does not need to be declared
explicitly.public boolean hasToken()
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
InternalErrorException
- If the status is not known.public boolean hasToken(int numberOfTokens) throws java.lang.IllegalArgumentException
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
numberOfTokens
- The number of tokens to get from the receiver.InternalErrorException
- If the status is not known.java.lang.IllegalArgumentException
- If the argument is not positive.
This is a runtime exception, so it does not need to be declared
explicitly.public boolean isKnown()
isKnown
in interface Receiver
isKnown
in class AbstractReceiver
clear()
,
put(Token)
public void put(Token token) throws NoRoomException
put
in interface Receiver
put
in class AbstractReceiver
token
- The token to be put into the mailbox.NoRoomException
- If this mailbox is not empty.public void putArray(Token[] tokenArray, int numberOfTokens) throws NoRoomException, IllegalActionException
putArray
in interface Receiver
putArray
in class AbstractReceiver
tokenArray
- The array containing tokens to put into this
receiver.numberOfTokens
- The number of elements of the token
array to put into this receiver.NoRoomException
- If the token array cannot be put.IllegalActionException
- If the token is not acceptable
to one of the ports (e.g., wrong type).public void reset() throws IllegalActionException
reset
in interface Receiver
reset
in class AbstractReceiver
IllegalActionException
- If reset() is not supported by
the domain.