|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface for objects that can hold tokens. An implementation of this interface has two key methods: put() and get(). The put() method deposits a token into the receiver. The get() method retrieves a token that has been put. The order of the retrieved tokens depends on specific implementations, and does not necessarily match the order in which tokens have been put.
All implementations of this interface must follow these rules, regardless of the number of threads that are accessing the receiver:
Objects that implement this interface can only be contained by an instance of IOPort.
Token
| Green (bart) |
| Green (eal) |
| Method Summary | |
void |
clear()
Clear this receiver of any contained tokens. |
Token |
get()
Get a token from this receiver. |
Token[] |
getArray(int numberOfTokens)
Get an array of tokens from this receiver. |
IOPort |
getContainer()
Return the container of this receiver, or null if there is none. |
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 if this receiver has known state; that is, the tokens in this receiver are known, or this receiver is known not to contain any tokens. |
void |
put(Token token)
Put the specified token into this receiver. |
void |
putArray(Token[] tokenArray,
int numberOfTokens)
Put a portion of the specified token array into this receiver. |
void |
setContainer(IOPort port)
Set the container. |
| Method Detail |
public void clear()
throws IllegalActionException
IllegalActionException - If clear() is not supported by
the domain.
public Token get()
throws NoTokenException
NoTokenException - If there is no token.
public Token[] getArray(int numberOfTokens)
throws NoTokenException
numberOfTokens - The number of tokens to get in the
returned array.
NoTokenException - If there are not numberOfTokens
tokens.public IOPort getContainer()
public boolean hasRoom()
public boolean hasRoom(int numberOfTokens)
numberOfTokens - The number of tokens to put into this receiver.
public boolean hasToken()
public boolean hasToken(int numberOfTokens)
numberOfTokens - The number of tokens desired.
public boolean isKnown()
public void put(Token token)
throws NoRoomException
token - The token to put into the receiver.
NoRoomException - If there is no room in the receiver.
public void putArray(Token[] tokenArray,
int numberOfTokens)
throws NoRoomException
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.
public void setContainer(IOPort port)
throws IllegalActionException
port - The container.
IllegalActionException - If the container is not of
an appropriate subclass of IOPort for the particular receiver
implementation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||