public class ApplyFilterOverArray extends TypedAtomicActor implements ExecutionListener
Instead of outputting all the satisfied elements in the input array, the parameter maxOutputLength can be used to specify how many elements this actor should only output. If the specified length is larger than the number of satisfied elements, it will ignore the specified length and only output all the satisfied elements.
FIXME: what should be the correct behavior if there are not enough elements to output?
FIXME: make a convention, say when the maxOutputLength is -1, for output all the satisfied elements? FIXME: should add a ModelToken and an input port for receiving the filter model. Create a composite actor for providing a ModelToken from its inside model.
ModelReference
Red (ellen_zh) |
Yellow (ellen_zh) |
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected NamedObj |
_model
The model.
|
TypedIOPort |
inputArray
The input port for an input array.
|
Parameter |
maxOutputLength
The max amount of elements in the output array.
|
FileParameter |
modelFileOrURL
The file name or URL of the filter model.
|
TypedIOPort |
outputArray
The output port for output the filtered array.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
ApplyFilterOverArray(CompositeEntity container,
java.lang.String name)
Construct a ApplyFilterOverArray with a name and a container.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeChanged(Attribute attribute)
Override the base class to open the model specified if the
attribute is modelFileOrURL, or for other parameters, to cache
their values.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
executionError(Manager manager,
java.lang.Throwable throwable)
React to the fact that execution has failed by unregistering
as an execution listener and by allowing subsequent executions.
|
void |
executionFinished(Manager manager)
React to the fact that execution is finished by unregistering
as an execution listener and by allowing subsequent executions.
|
void |
fire()
Execute the filter model on each input array element until it gets
as many elements as specified by the maxOutputLength parameter.
|
void |
managerStateChanged(Manager manager)
Report in debugging statements that the manager state has changed.
|
boolean |
postfire()
Remove this class from the manager's list of execution listeners.
|
void |
stop()
Override the base class to call stop() on the referenced model.
|
void |
stopFire()
Override the base class to call stopFire() on the referenced model.
|
void |
terminate()
Override the base class to call terminate() on the referenced model.
|
void |
wrapup()
Report an exception if it occurred in a background run.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, prefire
addInitializable, initialize, preinitialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort inputArray
public TypedIOPort outputArray
public Parameter maxOutputLength
public FileParameter modelFileOrURL
protected NamedObj _model
public ApplyFilterOverArray(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor.IllegalActionException
- If the container is incompatible
with this actor.NameDuplicationException
- If the name coincides with
an actor already in the container.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void executionError(Manager manager, java.lang.Throwable throwable)
executionError
in interface ExecutionListener
manager
- The manager controlling the execution.throwable
- The throwable to report.public void executionFinished(Manager manager)
executionFinished
in interface ExecutionListener
manager
- The manager controlling the execution.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there is no director, or if
the director's action methods throw it.public void managerStateChanged(Manager manager)
managerStateChanged
in interface ExecutionListener
manager
- The manager controlling the execution.Manager.getState()
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If removing the execution listener
throws it, or if thrown by the superclass.
is not valid.public void stop()
stop
in interface Executable
stop
in class AtomicActor<TypedIOPort>
public void stopFire()
stopFire
in interface Executable
stopFire
in class AtomicActor<TypedIOPort>
public void terminate()
terminate
in interface Executable
terminate
in class AtomicActor<TypedIOPort>
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there is no director, or if
a background run threw an exception.