ptolemy.actor.lib.hoc
Class IterateOverArray.IterateDirector

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.Director
              extended by ptolemy.actor.lib.hoc.IterateOverArray.IterateDirector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Executable, Initializable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
Enclosing class:
IterateOverArray

private class IterateOverArray.IterateDirector
extends Director

This is a specialized director that fires 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
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  boolean _postfireReturns
           
 
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
IterateOverArray.IterateDirector(CompositeEntity container, java.lang.String name)
          Create a new instance of the director for IterateOverArray.
 
Method Summary
 void fire()
          Invoke iterations on the contained actor of the container of this director repeatedly until either it runs out of input data or prefire() returns false.
 Receiver newReceiver()
          Return a new instance of QueueReceiver.
 boolean postfire()
          Override the base class to return the logical AND of what the base class postfire() method returns and the flag set in fire().
 boolean transferInputs(IOPort port)
          Transfer data from an input port of the container to the ports it is connected to on the inside.
 boolean transferOutputs(IOPort port)
          Transfer data from the inside receivers of an output port of the container to the ports it is connected to on the outside.
 
Methods inherited from class ptolemy.actor.Director
_description, _fireContainerAt, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, attributeChanged, createSchedule, defaultDependency, finish, fireAt, fireAt, fireAtCurrentTime, getCausalityInterface, getCurrentTime, getErrorTolerance, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, initialize, invalidateResolvedTypes, invalidateSchedule, isFireFunctional, isStopRequested, isStrict, iterate, prefire, preinitialize, preinitialize, removeInitializable, requestInitialization, setContainer, setCurrentTime, setModelTime, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, terminate, 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 ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_postfireReturns

private boolean _postfireReturns
Constructor Detail

IterateOverArray.IterateDirector

public IterateOverArray.IterateDirector(CompositeEntity container,
                                        java.lang.String name)
                                 throws IllegalActionException,
                                        NameDuplicationException
Create a new instance of the director for IterateOverArray.

Parameters:
container - The container for the director.
name - The name of the director.
Throws:
IllegalActionException - Not thrown in this base class.
NameDuplicationException - Not thrown in this base class.
Method Detail

fire

public void fire()
          throws IllegalActionException
Invoke iterations on the contained actor of the container of this director repeatedly until either it runs out of input data or prefire() returns false. If postfire() of the actor returns false, then set a flag indicating to postfire() of this director to return false.

Specified by:
fire in interface Executable
Overrides:
fire in class Director
Throws:
IllegalActionException - If any called method of of the contained actor throws it, or if the contained actor is not opaque.

newReceiver

public Receiver newReceiver()
Return a new instance of QueueReceiver.

Overrides:
newReceiver in class Director
Returns:
A new instance of QueueReceiver.
See Also:
QueueReceiver

postfire

public boolean postfire()
                 throws IllegalActionException
Override the base class to return the logical AND of what the base class postfire() method returns and the flag set in fire(). As a result, this will return false if any contained actor returned false in its postfire() method.

Specified by:
postfire in interface Executable
Overrides:
postfire in class Director
Returns:
True to continue execution, and false otherwise.
Throws:
IllegalActionException - Not thrown in this base class.

transferInputs

public boolean transferInputs(IOPort port)
                       throws IllegalActionException
Transfer data from an input port of the container to the ports it is connected to on the inside. This method extracts tokens from the input array and provides them sequentially to the corresponding ports of the contained actor.

Overrides:
transferInputs in class Director
Parameters:
port - The port to transfer tokens from.
Returns:
True if at least one data token is transferred.
Throws:
IllegalActionException - Not thrown in this base class.

transferOutputs

public boolean transferOutputs(IOPort port)
                        throws IllegalActionException
Transfer data from the inside receivers of an output port of the container to the ports it is connected to on the outside. This method packages the available tokens into a single array.

Overrides:
transferOutputs in class Director
Parameters:
port - The port to transfer tokens from.
Returns:
True if at least one data token is transferred.
Throws:
IllegalActionException - Not thrown in this base class.
See Also:
IOPort.transferOutputs()