|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.actor.AbstractReceiver
ptolemy.domains.de.kernel.DEReceiver
public class DEReceiver
An implementation of the ptolemy.actor.Receiver interface for the DE domain.
The put() method stores the given token in this receiver and posts a trigger event to the director. The director is responsible to dequeue that trigger event and invoke the actor that contains this receiver. The get() method returns the first available token from the receiver.
Before firing an actor, the director is expected to put at least one token into at least one of the receivers contained by the actor.
| Yellow (hyzheng) |
| Green (hyzheng) |
| Field Summary | |
|---|---|
private DEDirector |
_director
|
protected long |
_directorVersion
The version of the workspace of container, used for caching by _getDirector(). |
protected java.util.LinkedList |
_tokens
List for storing tokens. |
| Constructor Summary | |
|---|---|
DEReceiver()
Construct an empty DEReceiver with no container. |
|
DEReceiver(IOPort container)
Construct an empty DEReceiver with the specified container. |
|
| Method Summary | |
|---|---|
private DEDirector |
_getDirector()
Return the director that created this receiver. |
void |
clear()
Clear this receiver of any contained tokens. |
java.util.List<Token> |
elementList()
Return a list with tokens that are currently in the receiver available for get() or getArray(), beginning with the oldest one. |
Token |
get()
Get the first token from the receiver. |
boolean |
hasRoom()
Return true, indicating that there is always room. |
boolean |
hasRoom(int tokens)
Return true if the receiver has room for putting the given number of tokens into it (via the put() method). |
boolean |
hasToken()
Return true if there is at least one token available to the get() method. |
boolean |
hasToken(int numberOfTokens)
Return true if there are numberOfTokens tokens tokens available to the get() method. |
void |
put(Token token)
Put a token into this receiver and post a trigger event to the director. |
| Methods inherited from class ptolemy.actor.AbstractReceiver |
|---|
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, reset, setContainer, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected long _directorVersion
protected java.util.LinkedList _tokens
private DEDirector _director
| Constructor Detail |
|---|
public DEReceiver()
public DEReceiver(IOPort container)
throws IllegalActionException
container - The container.
IllegalActionException - If the container does
not accept this receiver.| Method Detail |
|---|
public void clear()
clear in interface Receiverclear in class AbstractReceiverpublic java.util.List<Token> elementList()
elementList in interface ReceiverelementList in class AbstractReceiver
public Token get()
throws NoTokenException
get in interface Receiverget in class AbstractReceiverNoTokenException - If there are no more tokens. This is
a runtime exception, so it need not to be declared explicitly.public final boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class AbstractReceiverpublic boolean hasRoom(int tokens)
hasRoom in interface ReceiverhasRoom in class AbstractReceivertokens - An int indicating the number of spaces available.
public boolean hasToken()
hasToken in interface ReceiverhasToken in class AbstractReceiverpublic boolean hasToken(int numberOfTokens)
hasToken in interface ReceiverhasToken in class AbstractReceivernumberOfTokens - An int indicating how many tokens are needed.
public void put(Token token)
put in interface Receiverput in class AbstractReceivertoken - The token to be put, or null to put no token.
private DEDirector _getDirector()
throws IllegalActionException
IllegalActionException - If there is no container port, or
if the port has no container actor, or if the actor has no director,
or if the director is not an instance of DEDirector.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||