public class TimeCompare extends DEActor
input1
or at input2
, the event is consumed. The
value that the event carries is insignificant, but the time stamp of the event
is recorded in a local list. Time stamps received at the two input ports are
stored in two different lists. Every time when both lists have data, the
difference between the top elements of the lists is obtained, and is sent to
the output port. This done by subtracting the time stamp of every top event in
the list for input2
with the time stamp of every top event in the
list for input1
.
This actor could potentially consume an infinite amount of memory if the arrival rates of events at the two input ports are different, because one of the lists keeps growing.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
TypedIOPort |
input1
The first input port.
|
TypedIOPort |
input2
The second input port.
|
Parameter |
nonnegative
A boolean parameter to decide whether inputs at input2 should be ignored
if they lead to negative outputs.
|
TypedIOPort |
output
The output port to which difference values are sent.
|
_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 |
---|
TimeCompare(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone(Workspace workspace)
Clone this actor into the specified workspace.
|
void |
fire()
Fire this actor once.
|
void |
initialize()
Initialize this actor.
|
boolean |
prefire()
Return ture if this actor can fire.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_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, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort input1
public TypedIOPort input2
public Parameter nonnegative
public TypedIOPort output
public TimeCompare(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the cloned object.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.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If thrown when trying to consume input
events or produce output events.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- Never thrown.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If thrown when trying to decide
whether the input ports have token or not.