Package jsl.simulation
Class ModelElement.EventScheduler<T>
- java.lang.Object
-
- jsl.simulation.ModelElement.EventScheduler<T>
-
- Type Parameters:
T
- the type associated carrying the messages on the event
- All Implemented Interfaces:
ModelElement.EventBuilderIfc<T>
,ModelElement.TimeUnitIfc<T>
- Enclosing class:
- ModelElement
protected final class ModelElement.EventScheduler<T> extends java.lang.Object implements ModelElement.EventBuilderIfc<T>, ModelElement.TimeUnitIfc<T>
Uses the builder pattern to create and schedule the event and the action associated carrying the event
-
-
Constructor Summary
Constructors Constructor Description EventScheduler(EventActionIfc<T> action)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSLEvent<T>
days()
Creates and schedules the event associated carrying the model interpreting the event time in daysModelElement.EventBuilderIfc<T>
havingPriority(int priority)
Sets the scheduling priority of the event, lower is fasterJSLEvent<T>
hours()
Creates and schedules the event associated carrying the model interpreting the event time in hoursModelElement.TimeUnitIfc<T>
in(double time)
Sets the time of the event being built to current time + timeModelElement.TimeUnitIfc<T>
in(GetValueIfc value)
Sets the time of the event being built to current time + value.getValue()JSLEvent<T>
milliseconds()
Creates and schedules the event associated carrying the model interpreting the event time in millisecondsJSLEvent<T>
minutes()
Creates and schedules the event associated carrying the model interpreting the event time in minutesModelElement.EventBuilderIfc<T>
name(java.lang.String name)
Sets the name of the event being builtJSLEvent<T>
now()
Causes the event that is being built to be scheduled at the current simulation time (no time offset)JSLEvent<T>
seconds()
Creates and schedules the event associated carrying the model interpreting the event time in secondsJSLEvent<T>
units()
Creates and schedules the event reactingWith the base time timeUnits associated carrying the modelJSLEvent<T>
weeks()
Creates and schedules the event associated carrying the model interpreting the event time in weeksModelElement.EventBuilderIfc<T>
withMessage(T message)
An object of type T that is attached to the event
-
-
-
Constructor Detail
-
EventScheduler
public EventScheduler(EventActionIfc<T> action)
-
-
Method Detail
-
now
public final JSLEvent<T> now()
Description copied from interface:ModelElement.EventBuilderIfc
Causes the event that is being built to be scheduled at the current simulation time (no time offset)- Specified by:
now
in interfaceModelElement.EventBuilderIfc<T>
- Returns:
- the event that was scheduled
-
in
public final ModelElement.TimeUnitIfc<T> in(GetValueIfc value)
Description copied from interface:ModelElement.EventBuilderIfc
Sets the time of the event being built to current time + value.getValue()- Specified by:
in
in interfaceModelElement.EventBuilderIfc<T>
- Parameters:
value
- an object that can compute the time via getValue()- Returns:
- the builder
-
in
public final ModelElement.TimeUnitIfc<T> in(double time)
Description copied from interface:ModelElement.EventBuilderIfc
Sets the time of the event being built to current time + time- Specified by:
in
in interfaceModelElement.EventBuilderIfc<T>
- Parameters:
time
- the time until the event should occur- Returns:
- the builder
-
name
public final ModelElement.EventBuilderIfc<T> name(java.lang.String name)
Description copied from interface:ModelElement.EventBuilderIfc
Sets the name of the event being built- Specified by:
name
in interfaceModelElement.EventBuilderIfc<T>
- Parameters:
name
- the name of the event- Returns:
- the builder
-
withMessage
public final ModelElement.EventBuilderIfc<T> withMessage(T message)
Description copied from interface:ModelElement.EventBuilderIfc
An object of type T that is attached to the event- Specified by:
withMessage
in interfaceModelElement.EventBuilderIfc<T>
- Parameters:
message
- the message to attach- Returns:
- the builder
-
havingPriority
public final ModelElement.EventBuilderIfc<T> havingPriority(int priority)
Description copied from interface:ModelElement.EventBuilderIfc
Sets the scheduling priority of the event, lower is faster- Specified by:
havingPriority
in interfaceModelElement.EventBuilderIfc<T>
- Parameters:
priority
- the priority- Returns:
- the builder
-
days
public final JSLEvent<T> days()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in days- Specified by:
days
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
minutes
public final JSLEvent<T> minutes()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in minutes- Specified by:
minutes
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
hours
public final JSLEvent<T> hours()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in hours- Specified by:
hours
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
seconds
public final JSLEvent<T> seconds()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in seconds- Specified by:
seconds
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
weeks
public final JSLEvent<T> weeks()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in weeks- Specified by:
weeks
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
milliseconds
public final JSLEvent<T> milliseconds()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event associated carrying the model interpreting the event time in milliseconds- Specified by:
milliseconds
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
units
public final JSLEvent<T> units()
Description copied from interface:ModelElement.TimeUnitIfc
Creates and schedules the event reactingWith the base time timeUnits associated carrying the model- Specified by:
units
in interfaceModelElement.TimeUnitIfc<T>
- Returns:
- the event that was scheduled
-
-