|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.actor.AbstractReceiver
ptolemy.actor.Mailbox
ptolemy.domains.ct.kernel.CTReceiver
public class CTReceiver
The receiver for the continuous-time and mixed-signal domain. The receiver can be of one of the two types: CONTINUOUS and DISCRETE. Conceptually, a CONTINUOUS CTReceiver contains a sample of a continuous signal at a particular time (defined by the CTDirector). Thus, there is one and only one token at all time in a CONTINUOUS CTReceiver. A DISCRETE CTReceiver contains a discrete event. Thus a DISCRETE CTReceiver may be empty if an event is not present.
The receiver is implemented as a Mailbox of capacity one. Any token put in the receiver overwrites any token previously present in the receiver. As a consequence, hasRoom() method always returns true.
The behavior of the get() method depends on the type of the receiver. If it is CONTINUOUS, then get() only reads the value. Consecutive calls on the get method will return the same token if the put method has not been called. For a CONTINUOUS CTReceiver, hasToken() will always return true after the first put() has been called. For a DISCRETE CTReceiver, get() will return and destroy the token, thus the token can only be retrived once. Therefore after the consumption, the hasToken() method will return false, until a token is put into this receiver.
| Green (yuhong) |
| Green (liuj) |
| Nested Class Summary | |
|---|---|
static class |
CTReceiver.SignalType
Inner class used for the static enumeration of indicators of signal types. |
| Field Summary | |
|---|---|
private CTReceiver.SignalType |
_type
|
static CTReceiver.SignalType |
CONTINUOUS
Signal type: CONTINUOUS. |
static CTReceiver.SignalType |
DISCRETE
Signal type: DISCRETE. |
static CTReceiver.SignalType |
UNKNOWN
Signal type: UNKNOWN. |
| Fields inherited from class ptolemy.actor.Mailbox |
|---|
_token |
| Constructor Summary | |
|---|---|
CTReceiver()
Construct an empty CTReceiver with no container. |
|
CTReceiver(IOPort container)
Construct an empty CTReceiver with the specified container. |
|
| Method Summary | |
|---|---|
Token |
get()
Return the contained token if it is not null. |
CTReceiver.SignalType |
getSignalType()
Return the signal type of this receiver. |
boolean |
hasRoom()
Return true, since the new token will overwrite the old one. |
void |
put(Token token)
Put a token into this receiver. |
void |
reset()
Reset this receiver so that it contains a zero-valued token of the same type as whatever token is currently in the receiver, if there is one. |
void |
setSignalType(CTReceiver.SignalType type)
Set the signal type of this receiver. |
| Methods inherited from class ptolemy.actor.Mailbox |
|---|
clear, elementList, hasRoom, hasToken, hasToken |
| 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 |
|---|
public static final CTReceiver.SignalType CONTINUOUS
public static final CTReceiver.SignalType DISCRETE
public static final CTReceiver.SignalType UNKNOWN
private CTReceiver.SignalType _type
| Constructor Detail |
|---|
public CTReceiver()
public CTReceiver(IOPort container)
throws IllegalActionException
container - The port that contains the receiver.
IllegalActionException - If this receiver cannot be
contained by the proposed container.| Method Detail |
|---|
public Token get()
throws NoTokenException
get in interface Receiverget in class MailboxNoTokenException - If the receiver contains null.
InvalidStateException - If this method is called and
the signal type of this receiver is UNKNOWN.public CTReceiver.SignalType getSignalType()
setSignalType(ptolemy.domains.ct.kernel.CTReceiver.SignalType)public boolean hasRoom()
hasRoom in interface ReceiverhasRoom in class Mailbox
public void put(Token token)
throws NoRoomException
put in interface Receiverput in class Mailboxtoken - The token to be put into this receiver.
NoRoomException - Not thrown in this base class.
public void reset()
throws IllegalActionException
reset in interface Receiverreset in class AbstractReceiverIllegalActionException - If reset() is not supported by
the domain.public void setSignalType(CTReceiver.SignalType type)
type - The SignalType to set to the receiver.getSignalType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||