|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.actor.lib.hoc.RealTimeComposite.RealTimeDirector
private class RealTimeComposite.RealTimeDirector
This is a specialized director that defers firing of the contained actors until real-time matches the time stamp of provided inputs. It does this in a separate thread that blocks until the times match, then transfers the input tokens that arrived with that time stamp and fires the contained actors in the order in which they appear in the actor list repeatedly until either there is no more input data for the actor or the prefire() method of the actor returns false. If postfire() of any actor returns false, then postfire() of this director will return false, requesting a halt to execution of the model.
Nested Class Summary | |
---|---|
private class |
RealTimeComposite.RealTimeDirector.RealTimeThread
This the thread that executed the actors. |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private java.util.List<RealTimeComposite.QueuedToken> |
_inputTokens
List of input events in the current iteration. |
private java.lang.Thread |
_thread
The thread that executes the contained actors. |
Fields inherited from class ptolemy.actor.Director |
---|
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
RealTimeComposite.RealTimeDirector(CompositeEntity container,
java.lang.String name)
Create a new instance of the director for RealTimeComposite. |
Method Summary | |
---|---|
void |
fire()
If current model time of the environment matches the time at which outputs that have been queued should be produced, then produce them. |
Time |
fireAt(Actor actor,
Time time)
Delegate by calling fireAt() on the director of the container's container. |
Time |
fireAtCurrentTime(Actor actor)
Fire the specified actor at the first opportunity and then pass the request up to the executive director. |
Time |
getModelTime()
Return the current time of the enclosing actor if the delay is zero. |
void |
initialize()
Start the associated thread. |
Receiver |
newReceiver()
Return a new instance of QueueReceiver. |
boolean |
postfire()
Send all the collected tokens to the queue for consumption by the associated thread, if there is an associated thread. |
boolean |
prefire()
Clear the list of input events for this iteration and return true if the associated thread is alive, if delay is not 0.0. |
void |
stop()
Override the base class to post a "stop frame" on the queue if there is an associated thread. |
boolean |
transferInputs(IOPort port)
Record data from the specified input port for transfer to the queue used to communicate these data to the associated thread. |
boolean |
transferOutputs(IOPort port)
If real time is less than or equal to the current model time of the environment, then produce the outputs immediately at the current model time. |
void |
wrapup()
Override the base class to wait until the associated thread terminates and then call super.wrapup(). |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.List<RealTimeComposite.QueuedToken> _inputTokens
private java.lang.Thread _thread
Constructor Detail |
---|
public RealTimeComposite.RealTimeDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container for the director.name
- The name of the director.
IllegalActionException
- Not thrown in this base class.
NameDuplicationException
- Not thrown in this base class.Method Detail |
---|
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class Director
IllegalActionException
- If production of an output
fails (e.g. type error).public Time fireAt(Actor actor, Time time) throws IllegalActionException
fireAt
in class Director
actor
- The actor requesting firing.time
- The time at which to fire.
IllegalActionException
- If there is an executive director
and it throws it. Derived classes may choose to throw this
exception for other reasons.Director.fireAtCurrentTime(Actor)
public Time fireAtCurrentTime(Actor actor) throws IllegalActionException
fireAtCurrentTime
in class Director
actor
- The actor requesting firing (ignored).
IllegalActionException
- If this method is called
before the model is running.Director.fireAt(Actor, Time)
public Time getModelTime()
getModelTime
in class Director
Director.setModelTime(Time)
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class Director
IllegalActionException
- If the initialize() method of
one of the associated actors throws it.public Receiver newReceiver()
newReceiver
in class Director
QueueReceiver
public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class Director
IllegalActionException
- Not thrown in this base class.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class Director
IllegalActionException
- Not thrown in this base class.public void stop()
stop
in interface Executable
stop
in class Director
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class Director
port
- The port to transfer tokens from.
IllegalActionException
- If reading the inputs fails.public boolean transferOutputs(IOPort port) throws IllegalActionException
transferOutputs
in class Director
port
- The port to transfer tokens from.
IllegalActionException
- If reading the inputs fails.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class Director
IllegalActionException
- If the wrapup() method of
one of the associated actors throws it.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |