Package jsl.simulation
Class Executive
- java.lang.Object
-
- jsl.simulation.Executive
-
- All Implemented Interfaces:
ObservableIfc,IterativeProcessIfc,GetNameIfc,IdentityIfc
public class Executive extends java.lang.Object implements IdentityIfc, ObservableIfc, IterativeProcessIfc
The Executive controls the execution of events, permits the scheduling of events, updates the current time, and manages conditional actions. The Executive uses an instance of a class that extends IterativeProcess to control its execution. The Executive uses an instance of a class that implements the CalendarIfc interface to manage the time ordered execution of events. The Executive uses an instance of a ConditionalActionProcessor to manage the execution of ConditionalActions. The event calendar and attached conditional actions are cleared after the initialize() method is called The Executive can be pre-loaded with events and conditional actions prior to invoking the run() method if and only if the initialize() method had already been called. If the run() method is called without calling initialize() the calendar and conditional actions are cleared. If an ending event is not scheduled using the scheduleEndEvent() method and no real clock time execution limit has been set, then a default message will be sent to JSL.LOGGER.warning(). This message can be turned off by calling setTerminationWarningMessageOption(false)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classExecutive.EventExecutionProcess
-
Field Summary
Fields Modifier and Type Field Description static intAFTER_EVENTUsed to indicate to observers that an event will be executedstatic intAFTER_EXECUTIONUsed when observers are notified after all events are executedstatic intBEFORE_EVENTUsed to indicate to observers that an event will be executedstatic intINITIALIZEDUsed when observers are notified of initializationprotected Executive.EventExecutionProcessmyEventExecutionProcessControls the execution of events over timeprotected ObservableComponentmyObservableComponentAllows the object to be observed
-
Constructor Summary
Constructors Constructor Description Executive()Executive(java.lang.String name, CalendarIfc c)Executive(CalendarIfc c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(ObserverIfc observer)Allows the adding (attaching) of an observer to the observableprotected voidafterExecution()This method is called after executing all events when ending the iterative process.booleanallStepsCompleted()The iterative process may end by a variety of means, this method checks if the iterative process ended because it ran all of its stepsprotected voidbeforeExecutingAnyEvents()This method is called before any events are executed and after initializing the iterative process.voidcancel(JSLEvent e)Tells the event calendar to cancel the provided event.voidchangePriority(ConditionalAction action, int priority)booleancontains(ObserverIfc observer)Returns true if the observer is already attachedintcountObservers()Returns how many observers are currently observing the observablevoiddeleteObserver(ObserverIfc observer)Allows the deletion (removing) of an observer from the observablevoiddeleteObservers()Deletes all the observers from the observablevoidend()The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first.voidend(java.lang.String msg)The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first.protected voidexecute(JSLEvent event)Executes the provided eventvoidexecuteAllEvents()voidexecuteNextEvent()Causes the next event to be executed if it existsbooleanexecutionTimeExceeded()The iterative process may end by a variety of means, this method checks if the iterative process ended because it timed outdoublegetActualEndingTime()The simulated time that the Executive actually endedlonggetBeginExecutionTime()Returns system time in milliseconds that the iterative process startedjava.util.Optional<ExecutiveTraceReport>getDefaultExecutiveTraceReport()Returns the default event trace report or null if it has not yet been turned on.longgetElapsedExecutionTime()Gets the clock time in milliseconds since the iterative process was initializedJSLEventgetEndEvent()Returns the Executive's end event if scheduledlonggetEndExecutionTime()Returns system time in milliseconds that the iterative process endedintgetId()Returns the id for this objectJSLEventgetLastExecutedEvent()Returns a reference to the last executed event or null if no events have been executed or no more eventsIPLogReportgetLogReport()Returns a reference to the current log report.longgetMaximumAllowedExecutionTime()Returns maximum (real) clock time allocated for the iterative processbooleangetMaxScanFlag()intgetMaxScans()java.lang.StringgetName()Gets the name.doublegetNumberEventsScheduled()Gets the number of events currently scheduleddoublegetNumberEventsScheduledDuringExecution()Gets the number of events that were scheduled during the executionlonggetNumberStepsCompleted()Returns the number of steps completed since the iterative process was last initializedintgetObserverState()Can be used by observers to check what occurreddoublegetScheduledEndTime()Returns the time the execution was scheduled to endbooleangetStoppingFlag()Returns the stopping flagjava.lang.StringgetStoppingMessage()A string message for why stop() was called.booleangetTerminationWarningMessageOption()doublegetTime()Returns the current simulated time as a doubledoublegetTotalNumberEventsExecuted()Gets the total number of events executedbooleanhasNextEvent()Checks to see if the event calendar has another eventvoidinitialize()Initialize the executive, making it ready to run events This clears any events in the calendar and prepares for executionprotected voidinitializeCalendar()Tells the event calendar to clear all the events.booleanisCompleted()booleanisCreated()Checks if the iterative process is in the created state.booleanisDone()A flag to indicate whether the iterative process is done A iterative process can be done if: 1) it ran all of its steps 2) it was ended by a client prior to completing all of its steps 3) it ended because it exceeded its maximum allowable execution time before completing all of its steps.booleanisEmpty()Allows a check of the event calendar to see if it is empty, i.e.booleanisEndConditionMet()booleanisEnded()Checks if the iterative process is in the ended state After the iterative process has been ended this method will return truebooleanisEndEventScheduled()Returns true if an event has been scheduled to stop execution at getTimeHorizon()booleanisExecutionTimeExceeded()Returns if the elapsed execution time exceeds the maximum time allowed.booleanisInitialized()Checks if the iterative process is in the initialized state After the iterative process has been initialized this method will return truebooleanisRunning()An iterative process is running if it is been told to run (i.e.booleanisRunningStep()Indicates that the iterative process is currently running an individual stepbooleanisStepCompleted()Checks if the iterative process is in the completed step state After the iterative process has successfully completed a step this method will return truebooleanisTimedOut()booleanisUnfinished()The iterative process may end by a variety of means, this method checks if the iterative process ended but was unfinished, not all steps completedbooleannoStepsExecuted()Indicates that the iterative process ended because of no stepsprotected voidnotifyObservers(JSLEvent e)JSLEventpeekNextEvent()Returns a reference to the next event or null if no event exists.protected voidperformCPhase()voidregister(ConditionalAction action)voidregister(ConditionalAction action, int priority)<T> voidreschedule(JSLEvent<T> event, double time)This method allows a previously *executed* event to be reused The event must have already been removed from the calendar through the natural execute event mechanism and have been executed.voidrun()Runs all of the steps of the iterative process.voidrunNext()Runs the next step in the iterative processprotected voidschedule(JSLEvent e)JSLEventscheduleEndEvent(double time, ModelElement theElement)Schedules the ending of the executive at the provided time<T> JSLEvent<T>scheduleEvent(EventActionIfc<T> listener, double time, int priority, T message, java.lang.String name, ModelElement theElementScheduling)Creates an event and schedules it onto the event calendarprotected voidsetConditionalActionProcessor(ConditionalActionProcessor p)voidsetMaximumExecutionTime(long milliseconds)Set the maximum allotted (suggested) execution (real) clock for the entire iterative process.voidsetMaxScanFlag(boolean flag)voidsetMaxScans(int max)voidsetName(java.lang.String str)Sets the nameprotected voidsetSimulation(Simulation simulation)Used internally by Simulation to assign itself to the ExecutivevoidsetTerminationWarningMessageOption(boolean flag)False turns off the messagevoidstop()This sets a flag to indicate to the process that is should stop after the next step is completed.voidstop(java.lang.String msg)This sets a flag to indicate to the process that is should stop after the next step is completed.booleanstoppedByCondition()The iterative process may end by a variety of means, this method checks if the iterative process ended because it was stoppedjava.lang.StringtoString()voidturnOffDefaultEventTraceReport()Removes the default ExecutiveTraceReport as an observer of the Executive and sets it to null.voidturnOffLogReport()Turns off log reporting.voidturnOnDefaultEventTraceReport()This method creates an instance of the default ExecutiveTraceReport and tells it to observe the scheduler.voidturnOnDefaultEventTraceReport(java.lang.String name)This method creates an instance of the default ExecutiveTraceReport and tells it to observe the scheduler.voidturnOnLogReport(java.nio.file.Path pathToFile)Turns on the log report.voidturnOnTimer(long milliseconds)This method will cause the a timer to start allowing a TimerTask to be scheduled.voidunregister(ConditionalAction action)voidunregisterAllActions()booleanwillTerminate()If the Executive has an end event or maximum allowed execution time, then return true
-
-
-
Field Detail
-
AFTER_EXECUTION
public static final int AFTER_EXECUTION
Used when observers are notified after all events are executed
-
INITIALIZED
public static final int INITIALIZED
Used when observers are notified of initialization
-
BEFORE_EVENT
public static final int BEFORE_EVENT
Used to indicate to observers that an event will be executed
-
AFTER_EVENT
public static final int AFTER_EVENT
Used to indicate to observers that an event will be executed
-
myObservableComponent
protected ObservableComponent myObservableComponent
Allows the object to be observed
-
myEventExecutionProcess
protected Executive.EventExecutionProcess myEventExecutionProcess
Controls the execution of events over time
-
-
Constructor Detail
-
Executive
public Executive()
-
Executive
public Executive(CalendarIfc c)
-
Executive
public Executive(java.lang.String name, CalendarIfc c)
-
-
Method Detail
-
setSimulation
protected final void setSimulation(Simulation simulation)
Used internally by Simulation to assign itself to the Executive- Parameters:
simulation- the simulation to set
-
getName
public final java.lang.String getName()
Gets the name.- Specified by:
getNamein interfaceGetNameIfc- Returns:
- The name of object.
-
getId
public final int getId()
Returns the id for this object- Specified by:
getIdin interfaceIdentityIfc- Returns:
- the id
-
setName
public final void setName(java.lang.String str)
Sets the name- Parameters:
str- The name as a string.
-
getTerminationWarningMessageOption
public final boolean getTerminationWarningMessageOption()
- Returns:
- true if the flag permits the message to be printed
-
setTerminationWarningMessageOption
public final void setTerminationWarningMessageOption(boolean flag)
False turns off the message- Parameters:
flag- true means off
-
getObserverState
public final int getObserverState()
Can be used by observers to check what occurred- Returns:
- an integer representation of the observer state
-
deleteObservers
public final void deleteObservers()
Description copied from interface:ObservableIfcDeletes all the observers from the observable- Specified by:
deleteObserversin interfaceObservableIfc
-
deleteObserver
public final void deleteObserver(ObserverIfc observer)
Description copied from interface:ObservableIfcAllows the deletion (removing) of an observer from the observable- Specified by:
deleteObserverin interfaceObservableIfc- Parameters:
observer- the observer to delete
-
countObservers
public final int countObservers()
Description copied from interface:ObservableIfcReturns how many observers are currently observing the observable- Specified by:
countObserversin interfaceObservableIfc- Returns:
- number of observers
-
addObserver
public final void addObserver(ObserverIfc observer)
Description copied from interface:ObservableIfcAllows the adding (attaching) of an observer to the observable- Specified by:
addObserverin interfaceObservableIfc- Parameters:
observer- the observer to attach
-
contains
public boolean contains(ObserverIfc observer)
Description copied from interface:ObservableIfcReturns true if the observer is already attached- Specified by:
containsin interfaceObservableIfc- Parameters:
observer- the observer to check- Returns:
- true if attached
-
turnOnLogReport
public void turnOnLogReport(java.nio.file.Path pathToFile)
Description copied from interface:IterativeProcessIfcTurns on the log report. This report yields a text file of the state changes for the iterative process- Specified by:
turnOnLogReportin interfaceIterativeProcessIfc- Parameters:
pathToFile- specifies a prefix name for the report
-
turnOffLogReport
public void turnOffLogReport()
Description copied from interface:IterativeProcessIfcTurns off log reporting.- Specified by:
turnOffLogReportin interfaceIterativeProcessIfc
-
notifyObservers
protected final void notifyObservers(JSLEvent e)
-
getScheduledEndTime
public final double getScheduledEndTime()
Returns the time the execution was scheduled to end- Returns:
- the scheduled end time or Double.POSITIVE_INFINITY
-
reschedule
public final <T> void reschedule(JSLEvent<T> event, double time)
This method allows a previously *executed* event to be reused The event must have already been removed from the calendar through the natural execute event mechanism and have been executed. NOTE: If an event is canceled it remains in the scheduler until its originally scheduled event time. Then and only then does it become unscheduled at which time the event can be rescheduled. If a client needs to reschedule a canceled event prior to the originally scheduled event time, then just use scheduleEvent() to make a new event.- Type Parameters:
T- the type of the event message- Parameters:
event- The event that needs rescheduling, cannot be null and cannot already be scheduledtime- represents the inter-event time, i.e. the interval from the current time to when the event will need to occur. Cannot be negative
-
scheduleEvent
public final <T> JSLEvent<T> scheduleEvent(EventActionIfc<T> listener, double time, int priority, T message, java.lang.String name, ModelElement theElementScheduling)
Creates an event and schedules it onto the event calendar- Type Parameters:
T- the type of the event message- Parameters:
listener- represents an ActionListener that will handle the change of state logic, cannot be nulltime- represents the inter-event time, i.e. the interval from the current time to when the event will need to occur, Cannot be negativepriority- is used to influence the ordering of eventsmessage- is a generic Object that may represent data to be transmitted with the event, may be nullname- the name of the event, can be nulltheElementScheduling- the element doing the scheduling, cannot be null- Returns:
- a valid JSLEvent
-
cancel
public final void cancel(JSLEvent e)
Tells the event calendar to cancel the provided event. The event must have been scheduled otherwise an IllegalArgumentException is thrown.- Parameters:
e- A reference to the event to be canceled.
-
isEmpty
public final boolean isEmpty()
Allows a check of the event calendar to see if it is empty, i.e. it does not have any more events. Note: Depending on how the event calendar handles canceled events, canceled events may or may not be removed. In the default, canceled events are not removed from the calendar, until after their event time has occurred.- Returns:
- True is empty, False is not empty
-
getTime
public final double getTime()
Returns the current simulated time as a double- Returns:
- Simulated time as a double
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representing the Executive.
-
getNumberEventsScheduled
public final double getNumberEventsScheduled()
Gets the number of events currently scheduled- Returns:
- number currently scheduled
-
getNumberEventsScheduledDuringExecution
public final double getNumberEventsScheduledDuringExecution()
Gets the number of events that were scheduled during the execution- Returns:
- number during the execution
-
getTotalNumberEventsExecuted
public final double getTotalNumberEventsExecuted()
Gets the total number of events executed- Returns:
- the total number of events executed
-
getActualEndingTime
public double getActualEndingTime()
The simulated time that the Executive actually ended- Returns:
- the simulated time that the Executive actually ended
-
isEndEventScheduled
public final boolean isEndEventScheduled()
Returns true if an event has been scheduled to stop execution at getTimeHorizon()- Returns:
- true if scheduled
-
hasNextEvent
public final boolean hasNextEvent()
Checks to see if the event calendar has another event- Returns:
- true if it has another event
-
peekNextEvent
public final JSLEvent peekNextEvent()
Returns a reference to the next event or null if no event exists. Does not remove or execute the event. The event remains at the "top" of the calendar.- Returns:
- a reference to the next event
-
getLastExecutedEvent
public final JSLEvent getLastExecutedEvent()
Returns a reference to the last executed event or null if no events have been executed or no more events- Returns:
- the last event executed
-
initialize
public final void initialize()
Initialize the executive, making it ready to run events This clears any events in the calendar and prepares for execution- Specified by:
initializein interfaceIterativeProcessIfc
-
executeNextEvent
public final void executeNextEvent()
Causes the next event to be executed if it exists
-
executeAllEvents
public final void executeAllEvents()
-
end
public final void end()
Description copied from interface:IterativeProcessIfcThe iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first. If this method is called the iterative process will stop processing (terminate) before the next step and not process the next step in the process. The current step will be completed. This method can be used to stop the process at an arbitrary step. Once stopped, the process must be restarted.- Specified by:
endin interfaceIterativeProcessIfc
-
end
public final void end(java.lang.String msg)
Description copied from interface:IterativeProcessIfcThe iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first. If this method is called the iterative process will stop processing (terminate) before the next step and not process the next step in the process. The current step will be completed. This method can be used to stop the process at an arbitrary step. Once stopped, the process must be restarted.- Specified by:
endin interfaceIterativeProcessIfc- Parameters:
msg- an option message to indicate the reason for stopping
-
isUnfinished
public final boolean isUnfinished()
Description copied from interface:IterativeProcessIfcThe iterative process may end by a variety of means, this method checks if the iterative process ended but was unfinished, not all steps completed- Specified by:
isUnfinishedin interfaceIterativeProcessIfc- Returns:
- true if the process is not finished
-
isTimedOut
public final boolean isTimedOut()
-
isStepCompleted
public final boolean isStepCompleted()
Description copied from interface:IterativeProcessIfcChecks if the iterative process is in the completed step state After the iterative process has successfully completed a step this method will return true- Specified by:
isStepCompletedin interfaceIterativeProcessIfc- Returns:
- true if the iterative process completed the step
-
isRunning
public final boolean isRunning()
Description copied from interface:IterativeProcessIfcAn iterative process is running if it is been told to run (i.e. runNext()) but has not yet been told to end().- Specified by:
isRunningin interfaceIterativeProcessIfc- Returns:
- true if running
-
isInitialized
public final boolean isInitialized()
Description copied from interface:IterativeProcessIfcChecks if the iterative process is in the initialized state After the iterative process has been initialized this method will return true- Specified by:
isInitializedin interfaceIterativeProcessIfc- Returns:
- true if initialized
-
isCreated
public final boolean isCreated()
Description copied from interface:IterativeProcessIfcChecks if the iterative process is in the created state. If the iterative process is in the created state this method will return true- Specified by:
isCreatedin interfaceIterativeProcessIfc- Returns:
- true if in the created state
-
isEnded
public final boolean isEnded()
Description copied from interface:IterativeProcessIfcChecks if the iterative process is in the ended state After the iterative process has been ended this method will return true- Specified by:
isEndedin interfaceIterativeProcessIfc- Returns:
- true if ended
-
isEndConditionMet
public final boolean isEndConditionMet()
-
isDone
public final boolean isDone()
Description copied from interface:IterativeProcessIfcA flag to indicate whether the iterative process is done A iterative process can be done if: 1) it ran all of its steps 2) it was ended by a client prior to completing all of its steps 3) it ended because it exceeded its maximum allowable execution time before completing all of its steps. 4) its end condition was satisfied- Specified by:
isDonein interfaceIterativeProcessIfc- Returns:
- true if done
-
isCompleted
public final boolean isCompleted()
-
getMaximumAllowedExecutionTime
public final long getMaximumAllowedExecutionTime()
Description copied from interface:IterativeProcessIfcReturns maximum (real) clock time allocated for the iterative process- Specified by:
getMaximumAllowedExecutionTimein interfaceIterativeProcessIfc- Returns:
- the number as long representing milliseconds
-
setMaximumExecutionTime
public final void setMaximumExecutionTime(long milliseconds)
Description copied from interface:IterativeProcessIfcSet the maximum allotted (suggested) execution (real) clock for the entire iterative process. This is a suggested time because the execution time requirement is only checked after the completion of an individual step After it is discovered that cumulative time for executing the step has exceeded the maximum time, then the iterative process will be ended (perhaps) not completing other steps.- Specified by:
setMaximumExecutionTimein interfaceIterativeProcessIfc- Parameters:
milliseconds- the time
-
getEndExecutionTime
public final long getEndExecutionTime()
Description copied from interface:IterativeProcessIfcReturns system time in milliseconds that the iterative process ended- Specified by:
getEndExecutionTimein interfaceIterativeProcessIfc- Returns:
- the number as a long
-
getElapsedExecutionTime
public final long getElapsedExecutionTime()
Description copied from interface:IterativeProcessIfcGets the clock time in milliseconds since the iterative process was initialized- Specified by:
getElapsedExecutionTimein interfaceIterativeProcessIfc- Returns:
- a long representing the elapsed time
-
getBeginExecutionTime
public final long getBeginExecutionTime()
Description copied from interface:IterativeProcessIfcReturns system time in milliseconds that the iterative process started- Specified by:
getBeginExecutionTimein interfaceIterativeProcessIfc- Returns:
- the number as a long
-
getStoppingMessage
public final java.lang.String getStoppingMessage()
Description copied from interface:IterativeProcessIfcA string message for why stop() was called.- Specified by:
getStoppingMessagein interfaceIterativeProcessIfc- Returns:
- the message
-
turnOnDefaultEventTraceReport
public final void turnOnDefaultEventTraceReport()
This method creates an instance of the default ExecutiveTraceReport and tells it to observe the scheduler.
-
turnOnDefaultEventTraceReport
public final void turnOnDefaultEventTraceReport(java.lang.String name)
This method creates an instance of the default ExecutiveTraceReport and tells it to observe the scheduler.- Parameters:
name- specifies a prefix name for the report
-
turnOffDefaultEventTraceReport
public final void turnOffDefaultEventTraceReport()
Removes the default ExecutiveTraceReport as an observer of the Executive and sets it to null.
-
getDefaultExecutiveTraceReport
public final java.util.Optional<ExecutiveTraceReport> getDefaultExecutiveTraceReport()
Returns the default event trace report or null if it has not yet been turned on.- Returns:
- the ExecutiveTraceReport
-
unregisterAllActions
public final void unregisterAllActions()
-
unregister
public void unregister(ConditionalAction action)
-
setMaxScans
public final void setMaxScans(int max)
-
setMaxScanFlag
public final void setMaxScanFlag(boolean flag)
-
register
public final void register(ConditionalAction action, int priority)
-
register
public final void register(ConditionalAction action)
-
getMaxScans
public final int getMaxScans()
-
getMaxScanFlag
public final boolean getMaxScanFlag()
-
changePriority
public final void changePriority(ConditionalAction action, int priority)
-
stop
public final void stop()
Description copied from interface:IterativeProcessIfcThis sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.- Specified by:
stopin interfaceIterativeProcessIfc
-
stop
public final void stop(java.lang.String msg)
Description copied from interface:IterativeProcessIfcThis sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.- Specified by:
stopin interfaceIterativeProcessIfc- Parameters:
msg- A string to represent the reason for the stopping
-
execute
protected void execute(JSLEvent event)
Executes the provided event- Parameters:
event- represents the next event to execute or null
-
performCPhase
protected void performCPhase()
-
setConditionalActionProcessor
protected void setConditionalActionProcessor(ConditionalActionProcessor p)
-
schedule
protected void schedule(JSLEvent e)
-
scheduleEndEvent
public final JSLEvent scheduleEndEvent(double time, ModelElement theElement)
Schedules the ending of the executive at the provided time- Parameters:
time- the time of the ending event, must be > 0theElement- the associated model element- Returns:
- the scheduled event
-
getEndEvent
public final JSLEvent getEndEvent()
Returns the Executive's end event if scheduled- Returns:
- The Executive's end event if scheduled, or null if not
-
isExecutionTimeExceeded
public boolean isExecutionTimeExceeded()
Description copied from interface:IterativeProcessIfcReturns if the elapsed execution time exceeds the maximum time allowed. Only true if the maximum was set and elapsed time is greater than or equal to getMaximumAllowedExecutionTime()- Specified by:
isExecutionTimeExceededin interfaceIterativeProcessIfc- Returns:
- true if the execution time exceeds getMaximumAllowedExecutionTime()
-
getNumberStepsCompleted
public long getNumberStepsCompleted()
Description copied from interface:IterativeProcessIfcReturns the number of steps completed since the iterative process was last initialized- Specified by:
getNumberStepsCompletedin interfaceIterativeProcessIfc- Returns:
- the number of steps completed
-
getLogReport
public IPLogReport getLogReport()
Description copied from interface:IterativeProcessIfcReturns a reference to the current log report.- Specified by:
getLogReportin interfaceIterativeProcessIfc- Returns:
- The log report
-
turnOnTimer
public void turnOnTimer(long milliseconds)
Description copied from interface:IterativeProcessIfcThis method will cause the a timer to start allowing a TimerTask to be scheduled. This method causes a print to console task to be run which prints the elapsed time since initializing the iterative process.- Specified by:
turnOnTimerin interfaceIterativeProcessIfc- Parameters:
milliseconds- the time for the timer
-
allStepsCompleted
public boolean allStepsCompleted()
Description copied from interface:IterativeProcessIfcThe iterative process may end by a variety of means, this method checks if the iterative process ended because it ran all of its steps- Specified by:
allStepsCompletedin interfaceIterativeProcessIfc- Returns:
- true if all completed
-
executionTimeExceeded
public boolean executionTimeExceeded()
Description copied from interface:IterativeProcessIfcThe iterative process may end by a variety of means, this method checks if the iterative process ended because it timed out- Specified by:
executionTimeExceededin interfaceIterativeProcessIfc- Returns:
- true if exceeded
-
stoppedByCondition
public boolean stoppedByCondition()
Description copied from interface:IterativeProcessIfcThe iterative process may end by a variety of means, this method checks if the iterative process ended because it was stopped- Specified by:
stoppedByConditionin interfaceIterativeProcessIfc- Returns:
- true if it was stopped via stop()
-
runNext
public void runNext()
Description copied from interface:IterativeProcessIfcRuns the next step in the iterative process- Specified by:
runNextin interfaceIterativeProcessIfc
-
run
public void run()
Description copied from interface:IterativeProcessIfcRuns all of the steps of the iterative process. If the iterative process has not been initialized, then it will automatically be initialized. After attempting to run the steps, the process will be in the end() state. The process may or may not complete all of its steps.- Specified by:
runin interfaceIterativeProcessIfc
-
getStoppingFlag
public boolean getStoppingFlag()
Description copied from interface:IterativeProcessIfcReturns the stopping flag- Specified by:
getStoppingFlagin interfaceIterativeProcessIfc- Returns:
- true if the process has been told to stop via stop()
-
isRunningStep
public boolean isRunningStep()
Description copied from interface:IterativeProcessIfcIndicates that the iterative process is currently running an individual step- Specified by:
isRunningStepin interfaceIterativeProcessIfc- Returns:
- true if the step is in progress
-
noStepsExecuted
public boolean noStepsExecuted()
Description copied from interface:IterativeProcessIfcIndicates that the iterative process ended because of no steps- Specified by:
noStepsExecutedin interfaceIterativeProcessIfc- Returns:
- True if no steps are executed
-
beforeExecutingAnyEvents
protected void beforeExecutingAnyEvents()
This method is called before any events are executed and after initializing the iterative process. It can be used to insert behavior after initializing
-
afterExecution
protected void afterExecution()
This method is called after executing all events when ending the iterative process. It can be used to insert behavior after the executive ends
-
initializeCalendar
protected void initializeCalendar()
Tells the event calendar to clear all the events. Resets the simulation time to 0.0. Resets the event identification counter. Unregisters all actions Notifies observers of initialization
-
willTerminate
public final boolean willTerminate()
If the Executive has an end event or maximum allowed execution time, then return true- Returns:
- true if the executive has an end event or max allowed execution time
-
-