Class ProcessCommand
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.processview.description.ProcessCommand
-
- All Implemented Interfaces:
ObservableIfc
,GetNameIfc
,IdentityIfc
public abstract class ProcessCommand extends SchedulingElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ProcessCommand.ResumeListener
This class listens for the resumption event and then resumes the process executor-
Nested classes/interfaces inherited from class jsl.simulation.ModelElement
ModelElement.EventBuilderIfc<T>, ModelElement.EventScheduler<T>, ModelElement.ModelElementComparator, ModelElement.RequestBuilder, ModelElement.RequestDurationIfc, ModelElement.RequestTimeIfc, ModelElement.RequestUsingIfc, ModelElement.TimedUpdateEventAction, ModelElement.TimeUnitIfc<T>, ModelElement.WarmUpEventAction
-
-
Field Summary
-
Fields inherited from class jsl.simulation.ModelElement
AFTER_EXPERIMENT, AFTER_REPLICATION, BEFORE_EXPERIMENT, BEFORE_REPLICATION, CONDITIONAL_ACTION_REGISTRATION, DEFAULT_TIMED_EVENT_PRIORITY, INITIALIZED, MONTE_CARLO, myAfterExperimentOption, myAfterReplicationOption, myBeforeExperimentOption, myBeforeReplicationOption, myInitializationOption, myLengthOfWarmUp, myModelElements, myMonteCarloOption, myObservableComponent, myReplicationEndedOption, myTimedUpdateActionListener, myTimedUpdateEvent, myTimedUpdateInterval, myTimedUpdateOption, myTimedUpdatePriority, myWarmUpActionListener, myWarmUpEvent, myWarmUpIndicator, myWarmUpOption, myWarmUpPriority, NONE, REMOVED_FROM_MODEL, REPLICATION_ENDED, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIMED_UPDATE, UPDATE, WARMUP
-
-
Constructor Summary
Constructors Constructor Description ProcessCommand(ModelElement parent)
ProcessCommand(ModelElement parent, java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addAfterExecutionListener(ProcessCommandListenerIfc listener)
Adds a listener to be called after the execution of the commandvoid
addBeforeExecutionListener(ProcessCommandListenerIfc listener)
Adds a listener to be called prior to the execution of the commandabstract void
execute()
The execute method is responsible for executing the commandprotected void
execute(ProcessExecutor processExecutor)
The execute method is responsible for executing the commandProcessDescription
getProcessDescription()
Returns a reference to the process description that this command is withinprotected ProcessExecutor
getProcessExecutor()
Gets a reference to the process executor that is currently executing this commandprotected EventActionIfc
getResumeListener()
Gets a reference to the ActionListener to resume this commandprotected void
notifyAfterExecutionListeners()
Notifies the before execution listenersprotected void
notifyBeforeExecutionListeners()
Notifies the before execution listenersvoid
removeAfterExecutionListener(ProcessCommandListenerIfc listener)
Removes the listener that is called after the execution of the commandvoid
removeBeforeExecutionListener(ProcessCommandListenerIfc listener)
Removes the listener that is called prior to the execution of the commandprotected void
scheduleResume(ProcessExecutor processExecutor, double time, int priority, java.lang.String eventName)
This method uses the event scheduling mechanism to schedule the resumption of the process executorprotected void
setProcessDescription(ProcessDescription processDescription)
Sets the process description that this command currently is inprotected void
setProcessExecutor(ProcessExecutor processExecutor)
Sets the process executor that is currently executing the command-
Methods inherited from class jsl.simulation.SchedulingElement
cancelEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent
-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication, afterReplication_, asString, beforeExperiment, beforeExperiment_, beforeReplication, beforeReplication_, buildEventGenerator, cancelTimedUpdateEvent, cancelWarmUpEvent, changeParentModelElement, checkForAfterExperiment, checkForAfterReplication, checkForBeforeExperiment, checkForBeforeReplication, checkForConditionalActionRegistration, checkForInitialize, checkForMonteCarlo, checkForRemoveFromModel, checkForReplicationEnded, checkForTimedUpdate, checkForUpdate, checkForWarmUp, checkObserverState, checkWarmUpOption, clearModelElementObservers, contains, countObservers, createEntity, createEntity, createQObject, day, deleteObserver, deleteObserverFromModelElements, deleteObservers, findModelElementWithWarmUpEvent, getAfterExperimentOption, getAfterReplicationOption, getAllCounters, getAllModelElements, getAllRandomElements, getAllResponseVariables, getAllVariables, getBeforeExperimentOption, getBeforeReplicationOption, getChildModelElementIterator, getCurrentReplicationNumber, getDefaultEntityType, getExecutive, getExperiment, getId, getInitializationOption, getInitializationOrderAsString, getLeftPreOrderTraversalCount, getLengthOfWarmUp, getModel, getModelElementCompartor, getModelElementsAsString, getModelElementsAsString, getModelElementsAsString, getMonteCarloOption, getName, getNumberOfModelElements, getObserverState, getParentModelElement, getPreviousObserverState, getReplicationEndedOption, getRightPreOrderTraversalCount, getSimulation, getSpatialModel, getStringLabel, getThisElementsCounters, getThisElementsModelElements, getThisElementsRandomVariables, getThisElementsResponseVariables, getThisElementsVariables, getTime, getTimedUpdateInterval, getTimedUpdateOption, getUpdateNotificationFlag, getVariable, getWarmUpEventTime, getWarmUpOption, hour, indent, initialize, initialize_, isTimedUpdateEventScheduled, isWarmedUp, isWarmUpEventScheduled, isWarmUpScheduled, millisecond, minute, montecarlo, montecarlo_, notifyAfterExperimentObservers, notifyAfterReplicationObservers, notifyBeforeExperimentObservers, notifyBeforeReplicationObservers, notifyConditionalActionRegistrationObservers, notifyInitializationObservers, notifyMonteCarloObservers, notifyObservers, notifyObservers, notifyRemovingFromModelObservers, notifyReplicationEndedObservers, notifyTimedUpdateObservers, notifyUpdateObservers, notifyWarmUpObservers, registerConditionalActions, registerConditionalActions_, removedFromModel, removeFromModel, replicationEnded, replicationEnded_, schedule, second, seize, setAfterExperimentOption, setAfterExperimentOptionForModelElements, setAfterReplicationOption, setAfterReplicationOptionForModelElements, setBeforeExperimentOption, setBeforeExperimentOptionForModelElements, setBeforeReplicationOption, setBeforeReplicationOptionForModelElements, setInitializationOption, setInitializationOptionForModelElements, setLengthOfWarmUp, setModel, setMonteCarloOption, setMonteCarloOptionForModelElements, setName, setObserverState, setParentModelElement, setReplicationEndedOption, setReplicationEndedOptionForModelElements, setSpatialModel, setStringLabel, setTimedUpdateInterval, setTimedUpdateOption, setTimedUpdateOptionForModelElements, setUpdateNotificationFlag, setWarmUpOption, setWarmUpOptionForModelElements, stopExecutive, stopExecutive, timedUpdate, timedUpdate_, toString, update, useControls, warmUp, warmUp_, week
-
-
-
-
Constructor Detail
-
ProcessCommand
public ProcessCommand(ModelElement parent)
- Parameters:
parent
- the parent of the model element
-
ProcessCommand
public ProcessCommand(ModelElement parent, java.lang.String name)
- Parameters:
parent
- the parent of the model elementname
- the name for the model element
-
-
Method Detail
-
execute
public abstract void execute()
The execute method is responsible for executing the command
-
getProcessDescription
public ProcessDescription getProcessDescription()
Returns a reference to the process description that this command is within- Returns:
- A reference to the process description for this command
-
addBeforeExecutionListener
public final void addBeforeExecutionListener(ProcessCommandListenerIfc listener)
Adds a listener to be called prior to the execution of the command- Parameters:
listener
- the listener to add
-
removeBeforeExecutionListener
public final void removeBeforeExecutionListener(ProcessCommandListenerIfc listener)
Removes the listener that is called prior to the execution of the command- Parameters:
listener
- the listener to remove
-
addAfterExecutionListener
public final void addAfterExecutionListener(ProcessCommandListenerIfc listener)
Adds a listener to be called after the execution of the command- Parameters:
listener
- the listener to add
-
removeAfterExecutionListener
public final void removeAfterExecutionListener(ProcessCommandListenerIfc listener)
Removes the listener that is called after the execution of the command- Parameters:
listener
- the listener to remove
-
setProcessDescription
protected void setProcessDescription(ProcessDescription processDescription)
Sets the process description that this command currently is in- Parameters:
processDescription
- The ProcessDescription
-
execute
protected final void execute(ProcessExecutor processExecutor)
The execute method is responsible for executing the command- Parameters:
processExecutor
- , a reference to the process executor that is currently executing the command
-
setProcessExecutor
protected final void setProcessExecutor(ProcessExecutor processExecutor)
Sets the process executor that is currently executing the command- Parameters:
processExecutor
- The ProcessExecutor
-
getProcessExecutor
protected final ProcessExecutor getProcessExecutor()
Gets a reference to the process executor that is currently executing this command- Returns:
- A reference to the process executor.
-
getResumeListener
protected final EventActionIfc getResumeListener()
Gets a reference to the ActionListener to resume this command- Returns:
- A reference to the ActionListener
-
scheduleResume
protected final void scheduleResume(ProcessExecutor processExecutor, double time, int priority, java.lang.String eventName)
This method uses the event scheduling mechanism to schedule the resumption of the process executor- Parameters:
processExecutor
- the executortime
- the time untilpriority
- the priorityeventName
- the name of the event
-
notifyBeforeExecutionListeners
protected final void notifyBeforeExecutionListeners()
Notifies the before execution listeners
-
notifyAfterExecutionListeners
protected final void notifyAfterExecutionListeners()
Notifies the before execution listeners
-
-