|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.AbstractReceiver
ptolemy.domains.giotto.kernel.GiottoReceiver
public class GiottoReceiver
A receiver for the Giotto domain. It uses double-buffering. An actor may write to a receiver using put at any time. However, a new token will only be available to get if update has been called before. The update method makes the token from the last put invocation available to get. The GiottoDirector delays calls to update according to the Giotto semantics.
GiottoDirector
Yellow (liuj) |
Yellow (cm) |
Field Summary | |
---|---|
private Token |
_nextToken
|
private Token |
_token
|
Constructor Summary | |
---|---|
GiottoReceiver()
Construct an empty GiottoReceiver with no container. |
|
GiottoReceiver(IOPort container)
Construct an empty GiottoReceiver with the specified container. |
Method Summary | |
---|---|
void |
clear()
Clear this receiver of any contained tokens. |
java.util.List<Token> |
elementList()
Return a list with the token currently in the receiver, or an empty list if there is no such token. |
Token |
get()
Get the contained and available token, i.e., get the last token that has been put into the receiver before the last update. |
boolean |
hasRoom()
Return true, since writing to this receiver is always allowed. |
boolean |
hasRoom(int numberOfTokens)
Return true, since writing to this receiver is always allowed. |
boolean |
hasToken()
Return true if there is a token available. |
boolean |
hasToken(int numberOfTokens)
Return true if the receiver has at least one token available. |
void |
put(Token token)
Put a token into this receiver. |
Token |
remove()
Get the contained and available token, i.e., get the last token that has been put into the receiver before the last update and reset the _token only. |
void |
reset()
Reset the receiver by removing all tokens from the receiver. |
void |
update()
Update the receiver by making the last token that has been passed to put() available to get(). |
Methods inherited from class ptolemy.actor.AbstractReceiver |
---|
getArray, getContainer, getCurrentTime, getModelTime, isKnown, putArray, putArrayToAll, putToAll, setContainer, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Token _nextToken
private Token _token
Constructor Detail |
---|
public GiottoReceiver()
public GiottoReceiver(IOPort container) throws IllegalActionException
container
- The container.
IllegalActionException
- If the container does
not accept this receiver.Method Detail |
---|
public void clear()
clear
in interface Receiver
clear
in class AbstractReceiver
public java.util.List<Token> elementList()
elementList
in interface Receiver
elementList
in class AbstractReceiver
public Token get() throws NoTokenException
get
in interface Receiver
get
in class AbstractReceiver
NoTokenException
- If no token is available.public boolean hasRoom()
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
public final boolean hasRoom(int numberOfTokens)
hasRoom
in interface Receiver
hasRoom
in class AbstractReceiver
numberOfTokens
- The size of tokens to be written to the receiver.
public boolean hasToken()
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
public final boolean hasToken(int numberOfTokens)
hasToken
in interface Receiver
hasToken
in class AbstractReceiver
numberOfTokens
- The number of tokens available in this receiver.
public void put(Token token) throws NoRoomException
Note that putting a null into this receiver will leave the receiver empty after update. The receiver does not check against this but expects that IOPort will always put non-null tokens into receivers.
put
in interface Receiver
put
in class AbstractReceiver
token
- The token to be put into this receiver.
NoRoomException
- Not thrown in this base class.public Token remove() throws NoTokenException
NoTokenException
- If no token is available.public void reset()
reset
in interface Receiver
reset
in class AbstractReceiver
public void update()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |