Package jsl.modeling.elements
Interface EventGeneratorIfc
-
- All Known Implementing Classes:
EntityGenerator
,EntityProcessGenerator
,EventGenerator
,JobGenerator
,NHPPEventGenerator
public interface EventGeneratorIfc
An interface to define how event generators operate. The primary sub-class is EventGenerator. Of particular note is the use of initial parameters:initial time of first event
initial time between events
initial maximum number of events
initial ending time
These parameters control the initial state of the generator at the start of each replication. The generator is re-initialized to these values at the start of each replication. There are also parameters for each of these that can be changed during a replication. The effect of that change is only within the current replication.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
getEndingTime()
Gets the currently planned ending time of the generator.double
getInitialEndingTime()
Returns the ending time that is to be used when the generator is initialized for each replication.long
getInitialMaximumNumberOfEvents()
Returns the maximum number of events that is used for initializing each replicationRandomIfc
getInitialTimeBetweenEvents()
Returns the time between events used to initialize each replicationRandomIfc
getInitialTimeUntilFirstEvent()
Gets the RandomIfc that will be used at the beginning of each replication to generate the time until the first eventlong
getMaximumNumberOfEvents()
Gets the maximum number of actions for the generator.long
getNumberOfEventsGenerated()
Gets the number of events that have been generated by the generatorboolean
getStartOnInitializeFlag()
This flag indicates whether or not the generator will automatically start at the beginning of a replication when initialized.RandomIfc
getTimeBetweenEvents()
Gets the random source controlling the time between eventsboolean
isEventPending()
boolean
isGeneratorDone()
This method checks to see if the generator is done.boolean
isGeneratorStarted()
boolean
isSuspended()
Indicates whether or not the generator has been suspendedvoid
resume()
Resume the generation of events according to the time between event distribution.void
setEndingTime(double endingTime)
Sets the ending time for generating events for the current replication.void
setInitialEndingTime(double initialEndingTime)
This value is used to set the ending time for generating actions for each replication.void
setInitialMaximumNumberOfEvents(long initialMaxNumEvents)
Sets the the maximum number of events to be used to initialize each replication.void
setInitialTimeBetweenEvents(RandomIfc initialTimeBtwEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication.void
setInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc initialTimeBtwEvents, long initialMaxNumEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication.void
setInitialTimeUntilFirstEvent(RandomIfc initialTimeUntilFirst)
Sets the RandomIfc representing the time until the first event that is used at the beginning of each replication to generate the time until the first event.void
setMaximumNumberOfEvents(long maxNum)
Sets the maximum number of events for the generator.void
setStartOnInitializeFlag(boolean flag)
Sets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initializedvoid
setTimeBetweenEvents(RandomIfc timeUntilNext)
Sets the time between event random source.void
setTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Sets the time between events and the maximum number of events for the generator.void
suspend()
Suspends the generation of events and cancels the next scheduled event from the generatorvoid
turnOffGenerator()
This method turns the generator off, the next scheduled generation event will NOT occur, i.e.void
turnOnGenerator()
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started 0.0 time units after the call If this method is used when the generator is already started it does nothing.void
turnOnGenerator(double t)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started t time units after the call If this method is used when the generator is already started it does nothing.void
turnOnGenerator(RandomIfc r)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started r.getValue() time units after the call If this method is used when the generator is already started it does nothing.
-
-
-
Method Detail
-
turnOnGenerator
void turnOnGenerator(double t)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started t time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.- Parameters:
t
- The time until the generator should be turned on
-
turnOnGenerator
void turnOnGenerator(RandomIfc r)
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started r.getValue() time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.- Parameters:
r
- The time until the generator should be turned on
-
turnOnGenerator
void turnOnGenerator()
If the generator was not started upon initialization at the beginning of a replication, then this method can be used to start the generator The generator will be started 0.0 time units after the call If this method is used when the generator is already started it does nothing. If this method is used after the generator is done it does nothing. If this method is used after the generator has been suspended it does nothing. Use suspend() and resume() to suspend and resume a generator that has already been started.
-
turnOffGenerator
void turnOffGenerator()
This method turns the generator off, the next scheduled generation event will NOT occur, i.e. this method will also cancel a previously scheduled generation event if one exists. No future events will be scheduled after turning off the generator
-
isGeneratorStarted
boolean isGeneratorStarted()
- Returns:
- true if the generator has been started (turned on) either automatically or manually
-
getStartOnInitializeFlag
boolean getStartOnInitializeFlag()
This flag indicates whether or not the generator will automatically start at the beginning of a replication when initialized. By default this option is true.- Returns:
- true if on
-
setStartOnInitializeFlag
void setStartOnInitializeFlag(boolean flag)
Sets the flag that indicates whether or not the generator will automatically start at the beginning of a replication when initialized- Parameters:
flag
- true indicates automatic start
-
suspend
void suspend()
Suspends the generation of events and cancels the next scheduled event from the generator
-
isSuspended
boolean isSuspended()
Indicates whether or not the generator has been suspended- Returns:
- true if generator is suspended
-
resume
void resume()
Resume the generation of events according to the time between event distribution.
-
isGeneratorDone
boolean isGeneratorDone()
This method checks to see if the generator is done. In other words, if it has been turned off.- Returns:
- True means that it is done.
-
getMaximumNumberOfEvents
long getMaximumNumberOfEvents()
Gets the maximum number of actions for the generator. This is set by the supplied maxNum upon creation of the generator. This implies that it will be the same for every simulation replication.- Returns:
- A long representing the maximum number of actions for the generator.
-
setTimeBetweenEvents
void setTimeBetweenEvents(RandomIfc timeUntilNext)
Sets the time between event random source. Must not always evaluate to 0.0, if the current setting of the maximum number of events is infinite (Long.MAX_VALUE)- Parameters:
timeUntilNext
- time until the next event
-
getTimeBetweenEvents
RandomIfc getTimeBetweenEvents()
Gets the random source controlling the time between events- Returns:
- the random source controlling the time between events
-
setMaximumNumberOfEvents
void setMaximumNumberOfEvents(long maxNum)
Sets the maximum number of events for the generator. Must not be infinite (Long.MAX_VALUE) if the current time between events is 0.0- Parameters:
maxNum
- maximum number of events
-
setTimeBetweenEvents
void setTimeBetweenEvents(RandomIfc timeBtwEvents, long maxNumEvents)
Sets the time between events and the maximum number of events for the generator. These two parameters are dependent. The time between events cannot always evaluate to 0.0 if the maximum number of events is infinite (Long.MAX_VALUE). This method only changes these parameters for the current replication. The changes take effect when the next event is generated. If current number of events that have been generated is greater than or equal to the supplied maximum number of events, the generator will be turned off.- Parameters:
timeBtwEvents
- the time between eventsmaxNumEvents
- the maximum number of events
-
setInitialTimeBetweenEventsAndMaxNumEvents
void setInitialTimeBetweenEventsAndMaxNumEvents(RandomIfc initialTimeBtwEvents, long initialMaxNumEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication. These parameters are dependent. The time between events cannot evaluate to a constant value of 0.0 if the maximum number of events is infinite (Long.MAX_VALUE)- Parameters:
initialTimeBtwEvents
- the initial time between eventsinitialMaxNumEvents
- the initial maximum number of events
-
setInitialTimeUntilFirstEvent
void setInitialTimeUntilFirstEvent(RandomIfc initialTimeUntilFirst)
Sets the RandomIfc representing the time until the first event that is used at the beginning of each replication to generate the time until the first event. This change becomes effective at the beginning of the next replication to execute- Parameters:
initialTimeUntilFirst
- , The supplied RandomIfc, cannot be null
-
getInitialTimeUntilFirstEvent
RandomIfc getInitialTimeUntilFirstEvent()
Gets the RandomIfc that will be used at the beginning of each replication to generate the time until the first event- Returns:
- RandomIfc that will be used at the beginning of each replication to generate the time until the first event
-
setEndingTime
void setEndingTime(double endingTime)
Sets the ending time for generating events for the current replication. A new ending time will be applied to the generator. If this change results in an ending time that is less than the current time, the generator will be turned off- Parameters:
endingTime
- the ending time for generating events
-
getEndingTime
double getEndingTime()
Gets the currently planned ending time of the generator.- Returns:
- A double representing the ending time.
-
setInitialEndingTime
void setInitialEndingTime(double initialEndingTime)
This value is used to set the ending time for generating actions for each replication. Changing this variable during a replication cause the next replication to use this value for its ending time.- Parameters:
initialEndingTime
- value is used to set the initial ending time for generating actions
-
getInitialEndingTime
double getInitialEndingTime()
Returns the ending time that is to be used when the generator is initialized for each replication.- Returns:
- Returns the initial ending time that is to be used when the generator
-
getNumberOfEventsGenerated
long getNumberOfEventsGenerated()
Gets the number of events that have been generated by the generator- Returns:
- the number of events that have been generated
-
getInitialTimeBetweenEvents
RandomIfc getInitialTimeBetweenEvents()
Returns the time between events used to initialize each replication- Returns:
- the initial time between events
-
getInitialMaximumNumberOfEvents
long getInitialMaximumNumberOfEvents()
Returns the maximum number of events that is used for initializing each replication- Returns:
- the initial maximum number of events
-
setInitialTimeBetweenEvents
void setInitialTimeBetweenEvents(RandomIfc initialTimeBtwEvents)
Sets the time between events and the maximum number of events to be used to initialize each replication. The time between events cannot evaluate to a constant value of 0.0. The maximum number of events is kept at its current value, which by default is Long.Max_Value- Parameters:
initialTimeBtwEvents
- the time between events
-
setInitialMaximumNumberOfEvents
void setInitialMaximumNumberOfEvents(long initialMaxNumEvents)
Sets the the maximum number of events to be used to initialize each replication. The time between events cannot evaluate to a constant value of 0.0 if the maximum number of events is infinite (Long.MAX_VALUE). Uses the current value for initial time between events- Parameters:
initialMaxNumEvents
- the the maximum number of events
-
isEventPending
boolean isEventPending()
- Returns:
- true if an event is scheduled to occur for the generator
-
-