Package ptolemy.domains.tester.kernel
Class TesterDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.domains.tester.kernel.TesterDirector
-
- All Implemented Interfaces:
java.lang.Cloneable,Executable,Initializable,Changeable,Debuggable,DebugListener,Derivable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
public class TesterDirector extends Director
This director does not execute a model, but instead looks for attributes contained by the model at the same level of the hierarchy as this director that implement the Testable interface. If the train parameter is false, it invokes the test() method on them, and otherwise, it invokes the train() method on them. It does everything in preinitialize(). It first invokes preinitialize() on all contained actors, and then runs test() or train() on all contained Testable attributes. If any of those throws an exception, then preinitialize() throws an exception.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Christopher Brooks, Dai Bui, Edward A. Lee, Ben Lickly
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description ParametertrainingModeIndicator of whether to invoke train() or test() on the Testable objects.-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description TesterDirector(CompositeEntity container, java.lang.String name)Construct a director.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInitializable(Initializable initializable)Do nothing.voidfire()Do nothing.voidinitialize()Do nothing.booleanpostfire()Return false, indicating that we are done.booleanprefire()Return true.voidpreinitialize()Override the base class to first invoke preinitialize() on all contained actors and then invoke either test() or train() on all Testable attributes.booleantransferInputs(IOPort port)Do nothing.booleantransferOutputs(IOPort port)Do nothing.voidwrapup()Do nothing.-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, attributeChanged, clone, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, invalidateSchedule, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, newReceiver, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, suspend, terminate, transferOutputs
-
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Field Detail
-
trainingMode
public Parameter trainingMode
Indicator of whether to invoke train() or test() on the Testable objects. This defaults to false which means test().
-
-
Constructor Detail
-
TesterDirector
public TesterDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a director.- Parameters:
container- The container.name- The name.- Throws:
IllegalActionException- If the base class throws it.NameDuplicationException- If the base class throws it.
-
-
Method Detail
-
addInitializable
public void addInitializable(Initializable initializable)
Do nothing.- Specified by:
addInitializablein interfaceInitializable- Overrides:
addInitializablein classDirector- Parameters:
initializable- The object whose methods should be invoked.- See Also:
Director.removeInitializable(Initializable),CompositeActor.addPiggyback(Executable)
-
fire
public void fire()
Do nothing.- Specified by:
firein interfaceExecutable- Overrides:
firein classDirector
-
initialize
public void initialize()
Do nothing.- Specified by:
initializein interfaceInitializable- Overrides:
initializein classDirector
-
postfire
public boolean postfire()
Return false, indicating that we are done.- Specified by:
postfirein interfaceExecutable- Overrides:
postfirein classDirector- Returns:
- True to continue execution, and false otherwise.
-
prefire
public boolean prefire()
Return true.- Specified by:
prefirein interfaceExecutable- Overrides:
prefirein classDirector- Returns:
- True.
-
preinitialize
public void preinitialize() throws IllegalActionExceptionOverride the base class to first invoke preinitialize() on all contained actors and then invoke either test() or train() on all Testable attributes.- Specified by:
preinitializein interfaceInitializable- Overrides:
preinitializein classDirector- Throws:
IllegalActionException- If the superclass throws it.
-
transferInputs
public boolean transferInputs(IOPort port)
Do nothing.- Overrides:
transferInputsin classDirector- Parameters:
port- The port to transfer tokens from.- Returns:
- True if at least one data token is transferred.
-
transferOutputs
public boolean transferOutputs(IOPort port)
Do nothing.- Overrides:
transferOutputsin classDirector- Parameters:
port- The port to transfer tokens from.- Returns:
- True if at least one data token is transferred.
-
wrapup
public void wrapup()
Do nothing.- Specified by:
wrapupin interfaceInitializable- Overrides:
wrapupin classDirector
-
-