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.
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, toString
public AlgebraicLoopReceiver()
public AlgebraicLoopReceiver(AlgebraicLoopDirector director)
director
- The director of this receiver.public void clear() throws IllegalActionException
clear
in interface Receiver
clear
in class AbstractReceiver
IllegalActionException
- Always thrown.public Token get() throws NoTokenException
get
in interface Receiver
get
in class AbstractReceiver
NoTokenException
- If this receiver is absent.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
- Ignored in this base class.public boolean hasToken()
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
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.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 Receiver
put
in class AbstractReceiver
token
- 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 Receiver
reset
in class AbstractReceiver
protected Token _getUpdatedValue()
protected void _setInitialValue(Token initialValue)
initialValue
- The initial value.