Class PeriodicTimeModel
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.extendedkernel.libs.timemodel.PeriodicTimeModel
-
- All Implemented Interfaces:
ITimeModel
public final class PeriodicTimeModel extends Object implements ITimeModel
A time model using a period and a phase shift to determine the next time stamp.- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description PeriodicTimeModel(long period, long phaseShift, SimulationTimeStamp initialTime)
Builds a periodic time model having a specific period and phase shift.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimulationTimeStamp
getNextTime(SimulationTimeStamp currentTime)
Gets the time stamp following a specific time stamp in this model.long
getPeriod()
Gets the period of the time model.long
getPhaseShift()
Gets the phase shift of the time model.
-
-
-
Constructor Detail
-
PeriodicTimeModel
public PeriodicTimeModel(long period, long phaseShift, SimulationTimeStamp initialTime)
Builds a periodic time model having a specific period and phase shift.- Parameters:
period
- The period of the time model. This value has to be strictly positive.phaseShift
- The phase shift of the time model.initialTime
- The initial time stamp of the simulation. This value cannot benull
.- Throws:
IllegalArgumentException
- If an argument is invalid.
-
-
Method Detail
-
getPeriod
public long getPeriod()
Gets the period of the time model. This value has to be strictly positive.- Returns:
- The period of the time model. This value has to be strictly positive.
-
getPhaseShift
public long getPhaseShift()
Gets the phase shift of the time model.- Returns:
- The phase shift of the time model.
-
getNextTime
public SimulationTimeStamp getNextTime(SimulationTimeStamp currentTime)
Gets the time stamp following a specific time stamp in this model.Note: for simulation consistency reasons, this method has to be deterministic: calling twice this method with the same parameter has to produce the same output.
- Specified by:
getNextTime
in interfaceITimeModel
- Parameters:
currentTime
- The time stamp for which this method computes a successor.- Returns:
- The time stamp following the
currentTime
time stamp.
-
-