|
||||||||||
| 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
An implementation of the ptolemy.actor.Receiver interface for the DE domain. Tokens that are put into this receiver logically have time stamps. If the time stamp is not explicitly given using the setDelay() method, then it is assumed to be the current time (which is maintained by the director). The put() method sends the specified token to the director, which returns it to this receiver (via the protected method _triggerEvent()) when current time matches the time stamp of the token. The get() method returns only tokens that the director has so returned. Thus, when a token is put into the receiver using put(), it does not become immediately available to the get() method.
By default, the time stamp of a token is the current time of the director when put() is called. To specify a time stamp in the future, call setDelay() prior to calling put(). This should be done in a synchronized manner, since there could be multiple thread running in this domain.
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.
| Green (cxh) |
| Green (liuj) |
| Constructor Summary | |
DEReceiver()
Construct an empty DEReceiver with no container. |
|
DEReceiver(IOPort container)
Construct an empty DEReceiver with the specified container. |
|
| Method Summary | |
protected void |
_triggerEvent(Token token)
Make a token available to the get() method. |
void |
clear()
Clear this receiver of any contained tokens. |
Token |
get()
Get a token from the receiver. |
DEDirector |
getDirector()
Return the director that created this 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 are tokens 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. |
void |
put(Token token,
double time)
Put a token into this receiver with a future time stamp. |
void |
setDelay(double delay)
Set the delay for the next call to put(). |
| Methods inherited from class ptolemy.actor.AbstractReceiver |
getArray, getContainer, getCurrentTime, isKnown, putArray, setContainer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 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 be declared explicitly.
public 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.public final boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class AbstractReceiverpublic boolean hasRoom(int tokens)
hasRoom in interface ReceiverhasRoom in class AbstractReceivertokens - 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)
put in interface Receiverput in class AbstractReceivertoken - The token to be put.
public void put(Token token,
double time)
throws IllegalActionException
token - The token to be put.time - The time stamp of the token
IllegalActionException - If time is less than the
current time of the director, or no director is available.
public void setDelay(double delay)
throws IllegalActionException
delay - The delay.
IllegalActionException - If the delay is negative.protected void _triggerEvent(Token token)
token - The token to make available to get().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||