@Deprecated public class SysMLADirector extends ProcessDirector
Version A of a SysML director. This version is inspired by a subset of the semantics of IBM Rational's Rhapsody SysML tool. In this MoC, each actor executes in its own thread (corresponding to an "active object" in SysML). Inputs provided to an input port (by the thread of another actor) are put into a single queue belonging to the destination actor. The thread for the destination actor retrieves the first input in the queue and uses it to set the value of exactly one input port. All other input ports are marked absent. The actor then fires, possibly producing one or more outputs which are directed to their destination actors.
When multiple actors send tokens to an actor, whether to the same port or to distinct ports, this MoC is nondeterministic. The order in which the tokens are processed will depend on the happenstances of scheduling, since the tokens are put into a single queue in the order in which they arrive.
In this MoC, we assume that an actor iterates within its thread only if either it has called fireAt() to request a future firing (or a re-firing at the current time), or it has at least one event in its input queue. Thus, the actor's thread will block until one of those conditions is satisfied.
When all threads are blocked, then if at least one has called fireAt() to request a future firing, then this director will advance model time to the smallest time of such a request, and then again begin executing actors until they all block.
When all actors are blocked, and none has called fireAt(), the model terminates.
Modifier and Type | Class and Description |
---|---|
class |
SysMLADirector.SysMLAReceiver
Deprecated.
Variant of a Mailbox that overrides the put() method to
divert the input to the queue associated with the actor
and then provides a method to really put a token into
a receiver.
|
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
activeObjects
Deprecated.
If true, then every actor executes in its own thread.
|
_newActorThreadList, _notDone
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
_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 |
---|
SysMLADirector(CompositeEntity container,
java.lang.String name)
Deprecated.
Construct a director in the given container with the given name.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
_areThreadsDeadlocked()
Deprecated.
Override the base class to return true if all active threads are blocked.
|
protected void |
_clearReceivers(Actor actor)
Deprecated.
Clear all the input receivers for the specified actor.
|
protected Time |
_earliestNextFiringTime()
Deprecated.
Return the earliest time that any actor has requested
a refiring.
|
protected boolean |
_isFlowPort(IOPort port)
Deprecated.
Return true if the specified port is a flow port.
|
protected boolean |
_iterateActorOnce(Actor actor)
Deprecated.
Iterate the specified actor once.
|
protected ProcessThread |
_newProcessThread(Actor actor,
ProcessDirector director)
Deprecated.
Create a new ProcessThread for controlling the actor that
is passed as a parameter of this method.
|
protected boolean |
_resolveDeadlock()
Deprecated.
Return true indicating that deadlock has been resolved
and that execution should continue.
|
protected Time |
_runToCompletion(Actor actor)
Deprecated.
Iterate the specified actor until its input queue
is empty and any pending fireAt() time requests
are in the future.
|
java.lang.Object |
clone(Workspace workspace)
Deprecated.
Clone the director into the specified workspace.
|
void |
fire()
Deprecated.
Start a new iteration (at a new time, presumably) and either
run the actors to completion in order of creation or
wait until a deadlock is detected, depending on activeObjects.
|
Time |
fireAt(Actor actor,
Time time,
int microstep)
Deprecated.
Override the base class to make a local record of the requested
firing.
|
void |
initialize()
Deprecated.
Invoke the initialize() method of ProcessDirector.
|
void |
initialize(Actor actor)
Deprecated.
Initialize the given actor.
|
Receiver |
newReceiver()
Deprecated.
Return a new receiver SysMLAReceiver.
|
boolean |
postfire()
Deprecated.
Return false if a stop has been requested or if
the model has reached deadlock.
|
boolean |
prefire()
Deprecated.
Override the base class to set time to match environment
time if this director is embedded.
|
void |
stop()
Deprecated.
Request that the director cease execution altogether.
|
boolean |
transferInputs(IOPort port)
Deprecated.
Transfer at most one token from an input
port of the container to the ports
it is connected to on the inside.
|
void |
transferOutputs()
Deprecated.
For all inputs in the input queue of the container of this
actor, put the input token into the inside of the corresponding
output port and then transfer outputs from that port.
|
void |
wrapup()
Deprecated.
If activeObjects is true, then delegate to the superclass;
otherwise, invoke the wrapup() method of all the actors contained in the
director's container.
|
_areAllThreadsStopped, _getActiveThreadsCount, _getBlockedThreadsCount, _getStoppedThreadsCount, _requestFinishOnReceivers, addThread, finish, isStopFireRequested, isThreadActive, preinitialize, removeThread, stopFire, terminate, threadBlocked, threadHasPaused, threadHasResumed, threadUnblocked, transferOutputs
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, attributeChanged, createSchedule, defaultDependency, delayDependency, elapsedTimeSinceStart, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelNextIterationTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, invalidateResolvedTypes, invalidateSchedule, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, suggestedModalModelDirectors, supportMultirateFiring, suspend
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_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
public Parameter activeObjects
public SysMLADirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of the director.name
- Name of this director.IllegalActionException
- If the director is not compatible
with the specified container. Thrown in derived classes.NameDuplicationException
- If the container not a
CompositeActor and the name collides with an entity in the container.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class ProcessDirector
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- 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 ProcessDirector
IllegalActionException
- If a derived class throws it.public Time fireAt(Actor actor, Time time, int microstep) throws IllegalActionException
fireAt
in class Director
actor
- The actor scheduled to be fired.time
- The requested time.microstep
- The requested microstep.IllegalActionException
- If there is an executive director
and it throws it. Derived classes may choose to throw this
exception for other reasons.Director.fireAtCurrentTime(Actor)
,
Director.fireContainerAt(Time)
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class Director
IllegalActionException
- If the initialize() method of one
of the deeply contained actors throws it.public void initialize(Actor actor) throws IllegalActionException
initialize
in class ProcessDirector
actor
- The actor that is to be initialized.IllegalActionException
- If the actor is not
acceptable to the domain. Not thrown in this base class.public Receiver newReceiver()
newReceiver
in class Director
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class ProcessDirector
IllegalActionException
- If a derived class throws it.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class ProcessDirector
IllegalActionException
- Not thrown in this base class.public void stop()
stop
in interface Executable
stop
in class ProcessDirector
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class ProcessDirector
port
- The port.IllegalActionException
- If transfer fails.public void transferOutputs() throws IllegalActionException
transferOutputs
in class Director
IllegalActionException
- If the transfer fails.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class ProcessDirector
IllegalActionException
- If the wrapup() method of
one of the associated actors throws it.protected boolean _areThreadsDeadlocked()
_areThreadsDeadlocked
in class ProcessDirector
protected void _clearReceivers(Actor actor) throws IllegalActionException
actor
- The actor.IllegalActionException
- If the receivers can't be cleared.protected Time _earliestNextFiringTime()
protected boolean _iterateActorOnce(Actor actor) throws IllegalActionException
actor
- The actor to iterate.IllegalActionException
- If the actor throws it.protected Time _runToCompletion(Actor actor) throws IllegalActionException
actor
- The actor to run.IllegalActionException
- If the actor throws it.protected boolean _isFlowPort(IOPort port)
port
- The port.protected ProcessThread _newProcessThread(Actor actor, ProcessDirector director) throws IllegalActionException
_newProcessThread
in class ProcessDirector
actor
- The actor that the created ProcessThread will
control.director
- The director that manages the model that the
created thread is associated with.IllegalActionException
- If creating a new ProcessThread
throws it.protected boolean _resolveDeadlock() throws IllegalActionException
_resolveDeadlock
in class ProcessDirector
IllegalActionException
- Not thrown in this class.