public class CIReceiver extends AbstractReceiver
| Red (liuxj) |
| Yellow (liuxj) |
| Constructor and Description |
|---|
CIReceiver(CIDirector director)
Construct an empty receiver.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear this receiver.
|
Token |
get()
Get a token from this receiver.
|
boolean |
hasRoom()
Return true.
|
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.
|
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.
|
elementList, getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArrayToAll, putToAll, reset, setContainer, toStringpublic CIReceiver(CIDirector director)
director - The director that creates this receiver.public void clear()
clear in interface Receiverclear in class AbstractReceiverpublic Token get() throws NoTokenException
get in interface Receiverget in class AbstractReceiverNoTokenException - If there is no token.public boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class AbstractReceiverpublic boolean hasRoom(int numberOfTokens)
hasRoom in interface ReceiverhasRoom in class AbstractReceivernumberOfTokens - The number of tokens to put into this receiver.public boolean hasToken()
hasToken in interface ReceiverhasToken in class AbstractReceiverpublic boolean hasToken(int numberOfTokens)
hasToken in interface ReceiverhasToken in class AbstractReceivernumberOfTokens - The number of tokens desired.public void put(Token token) throws NoRoomException
put in interface Receiverput in class AbstractReceivertoken - The token to put into the receiver, or null to put no token.NoRoomException - If there is no room in the receiver.public void putArray(Token[] tokenArray, int numberOfTokens) throws NoRoomException
putArray in interface ReceiverputArray in class AbstractReceivertokenArray - 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.