Package madkit.kernel
Interface Scheduler.SimulationTime
- Enclosing class:
- Scheduler
public static interface Scheduler.SimulationTime
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds one time unit to the simulation current timedefault LocalDateTime
Gets the current datedefault BigDecimal
Gets the current tickdefault ChronoUnit
Gets the default temporal unit which will be used byaddOneTimeUnit()
andincrementCurrentDate(long)
in a date-based modedefault BigDecimal
returns the tick for which the simulation should end.boolean
Checks if the simulation has reached the specified end timedefault void
incrementCurrentDate
(long amountToAdd) default void
incrementCurrentDate
(long amountToAdd, ChronoUnit unit) Shortcut forsetCurrentDate(getCurrentDate().plus(amountToAdd, unit));
default void
incrementCurrentTick
(double delta) Shortcut forsetCurrentTick(getCurrentTick().add(BigDecimal.valueOf(delta)));
default void
incrementCurrentTick
(BigDecimal delta) Shortcut forsetCurrentTick(getCurrentTick().add(delta));
default void
setCurrentDate
(LocalDateTime date) Shortcut forsetCurrentDate(getCurrentDate().plus(amountToAdd, unit));
default void
setCurrentTick
(double value) Shortcut forsetCurrentTick(BigDecimal.valueOf(value));
default void
setCurrentTick
(BigDecimal value) Sets the current tick a the simulation to the specified valuedefault void
Sets the default temporal unit which will be used byaddOneTimeUnit()
andincrementCurrentDate(long)
in a date-based modedefault void
setEndDate
(LocalDateTime endDate) Sets the date at which the simulation should stopdefault void
setEndTick
(BigDecimal endTick) Sets the tick at which the simulation should end
-
Field Details
-
TICK_BASED_MODE_REQUIRED
- See Also:
-
DATE_BASED_MODE_REQUIRED
- See Also:
-
-
Method Details
-
setCurrentTick
Sets the current tick a the simulation to the specified value- Parameters:
value
-
-
setCurrentTick
default void setCurrentTick(double value) Shortcut forsetCurrentTick(BigDecimal.valueOf(value));
- Parameters:
value
- specifies the current tick value
-
setCurrentDate
Shortcut forsetCurrentDate(getCurrentDate().plus(amountToAdd, unit));
- Parameters:
date
- the date to set as current date
-
getCurrentTick
Gets the current tick- Returns:
- the current tick of the simulation
-
getCurrentDate
Gets the current date- Returns:
- the current date of the simulation
-
addOneTimeUnit
void addOneTimeUnit()Adds one time unit to the simulation current time -
hasReachedEndTime
boolean hasReachedEndTime()Checks if the simulation has reached the specified end time- Returns:
true
if the simulation should be stopped.
-
incrementCurrentTick
Shortcut forsetCurrentTick(getCurrentTick().add(delta));
- Parameters:
delta
- specifies how much time should be added
-
incrementCurrentTick
default void incrementCurrentTick(double delta) Shortcut forsetCurrentTick(getCurrentTick().add(BigDecimal.valueOf(delta)));
- Parameters:
delta
- specifies how much time should be added
-
incrementCurrentDate
Shortcut forsetCurrentDate(getCurrentDate().plus(amountToAdd, unit));
- Parameters:
amountToAdd
- the amount of the unit to add to the result, may be negativeunit
- the unit of the amount to add, not null
-
incrementCurrentDate
default void incrementCurrentDate(long amountToAdd) - Parameters:
amountToAdd
- the amount of default temporal unit to add- See Also:
-
setDefaultTemporalUnit
Sets the default temporal unit which will be used byaddOneTimeUnit()
andincrementCurrentDate(long)
in a date-based mode- Parameters:
unit
- a temporal unit as defined inChronoUnit
-
getDefaultTemporalUnit
Gets the default temporal unit which will be used byaddOneTimeUnit()
andincrementCurrentDate(long)
in a date-based mode -
getEndTick
returns the tick for which the simulation should end.- Returns:
- the endTick
-
setEndTick
Sets the tick at which the simulation should end- Parameters:
endTick
- the endTick to set
-
setEndDate
Sets the date at which the simulation should stop- Parameters:
endDate
- the date at which the simulation should stop
-