Package ptolemy.actor.lib
Class RunningMinimum
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable,Actor,Executable,FiringsRecordable,Initializable,TypedActor,Changeable,Debuggable,DebugListener,Derivable,Instantiable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
public class RunningMinimum extends Transformer
Output the minimum value seen since the start of execution of the model. On each firing, this actor consumes exactly one scalar token at its input port. The value of the token is compared to the minimum value maintained since the start of the execution. The lesser of the two is output to the output port in the same firing, and the minimum value is set with that greater value in postfire().- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.lib.Transformer
input, output
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
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 RunningMinimum(CompositeEntity container, java.lang.String name)Construct an actor with the specified container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<Inequality>_customTypeConstraints()Set input ≤ output, input ≤ Scalar.protected java.util.Set<Inequality>_defaultTypeConstraints()Eliminate default constraints.java.lang.Objectclone(Workspace workspace)Clone this actor into the specified workspace.voidfire()Consume a token at the input port, and produce the greater of that value and the maintained minimum value to the output port.voidinitialize()Initialize the maintained minimum value to be null so it will be set with the first input at the input port.booleanpostfire()Commit the minimum value observed since the start of execution to the minimum field to be compared with later inputs.booleanprefire()Return true if the prefire() method of the superclass returns true, and there is at least one token at the input port.-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, 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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
RunningMinimum
public RunningMinimum(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct an actor with the specified container and name.- Parameters:
container- The composite actor to contain this one.name- The name of this actor.- Throws:
IllegalActionException- If the entity cannot be contained by the proposed container.NameDuplicationException- If the container already has an actor with this name.
-
-
Method Detail
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone this actor into the specified workspace. The new actor is not added to the directory of that workspace (you must do this yourself if you want it there). The result is a new actor with the same ports as the original, but no connections and no container. A container must be set before much can be done with this actor.- Overrides:
clonein classTypedAtomicActor- Parameters:
workspace- The workspace for the cloned object.- Returns:
- A new ComponentEntity.
- Throws:
java.lang.CloneNotSupportedException- If cloned ports cannot have as their container the cloned entity (this should not occur), or if one of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String),NamedObj.setDeferringChangeRequests(boolean)
-
fire
public void fire() throws IllegalActionExceptionConsume a token at the input port, and produce the greater of that value and the maintained minimum value to the output port.- Specified by:
firein interfaceExecutable- Overrides:
firein classAtomicActor<TypedIOPort>- Throws:
IllegalActionException- If getting token from input or sending token to output throws it.
-
initialize
public void initialize() throws IllegalActionExceptionInitialize the maintained minimum value to be null so it will be set with the first input at the input port.- Specified by:
initializein interfaceInitializable- Overrides:
initializein classAtomicActor<TypedIOPort>- Throws:
IllegalActionException- If the initialize() method of the superclass throws it.
-
postfire
public boolean postfire() throws IllegalActionExceptionCommit the minimum value observed since the start of execution to the minimum field to be compared with later inputs.- Specified by:
postfirein interfaceExecutable- Overrides:
postfirein classAtomicActor<TypedIOPort>- Returns:
- True if execution can continue into the next iteration.
- Throws:
IllegalActionException- If the postfire() method of the superclass throws it.
-
prefire
public boolean prefire() throws IllegalActionExceptionReturn true if the prefire() method of the superclass returns true, and there is at least one token at the input port.- Specified by:
prefirein interfaceExecutable- Overrides:
prefirein classAtomicActor<TypedIOPort>- Returns:
- True if this actor is ready for firing, false otherwise.
- Throws:
IllegalActionException- If the prefire() method of the superclass throws it.
-
_defaultTypeConstraints
protected java.util.Set<Inequality> _defaultTypeConstraints()
Eliminate default constraints.- Overrides:
_defaultTypeConstraintsin classTypedAtomicActor- Returns:
- null
-
_customTypeConstraints
protected java.util.Set<Inequality> _customTypeConstraints()
Set input ≤ output, input ≤ Scalar. If backward type inference is enabled and input has no declared type, also set input ≥output.- Overrides:
_customTypeConstraintsin classTypedAtomicActor- Returns:
- A set of inequality constraints.
-
-