public class AlgebraicLoopReceiver extends AbstractReceiver
At first, an instance of this class has status absent, unless it has a defaultValue parameter. The clear() method makes the status absent. The put() method makes the status present, and provides a value. The reset() method reverts the status to absent or to the default value if there is one.
The isKnown() method and hasRoom() methods always return true.
| Red (eal) |
| Yellow (eal) |
| Constructor and Description |
|---|
AlgebraicLoopReceiver()
Construct an AlgebraicLoopReceiver with unknown status.
|
AlgebraicLoopReceiver(AlgebraicLoopDirector director)
Construct an AlgebraicLoopReceiver with unknown status.
|
| Modifier and Type | Method and Description |
|---|---|
protected Token |
_getUpdatedValue()
If this receiver is a break variable, then return the stored
updated value.
|
protected void |
_setInitialValue(Token initialValue)
Indicate to this receiver that it is a break variable and
set its initial value.
|
void |
clear()
Set the status of this receiver to be absent.
|
Token |
get()
Return the contained Token.
|
boolean |
hasRoom()
Return true.
|
boolean |
hasRoom(int numberOfTokens)
Return true.
|
boolean |
hasToken()
Return true if the status is present.
|
boolean |
hasToken(int numberOfTokens)
Return true if the argument is 1 and this mailbox is not empty,
and otherwise return false.
|
void |
put(Token token)
If the specified token is non-null, then
set the status of this receiver to present, and to contain the
specified token.
|
void |
reset()
Clear stored tokens.
|
elementList, getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, setContainer, toStringpublic AlgebraicLoopReceiver()
public AlgebraicLoopReceiver(AlgebraicLoopDirector director)
director - The director of this receiver.public void clear()
throws IllegalActionException
clear in interface Receiverclear in class AbstractReceiverIllegalActionException - Always thrown.public Token get() throws NoTokenException
get in interface Receiverget in class AbstractReceiverNoTokenException - If this receiver is absent.public boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class AbstractReceiverpublic boolean hasRoom(int numberOfTokens)
hasRoom in interface ReceiverhasRoom in class AbstractReceivernumberOfTokens - Ignored in this base class.public boolean hasToken()
hasToken in interface ReceiverhasToken in class AbstractReceiverpublic boolean hasToken(int numberOfTokens)
throws java.lang.IllegalArgumentException
hasToken in interface ReceiverhasToken in class AbstractReceivernumberOfTokens - The number of tokens to get from 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 void put(Token token) throws IllegalActionException
put in interface Receiverput in class AbstractReceivertoken - The token to be put into this receiver.java.lang.IllegalArgumentException - If the argument is null.IllegalActionException - If a token
is present and cannot be compared to the specified token.public void reset()
reset in interface Receiverreset in class AbstractReceiverprotected Token _getUpdatedValue()
protected void _setInitialValue(Token initialValue)
initialValue - The initial value.