Class 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 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 be null.
        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 interface ITimeModel
        Parameters:
        currentTime - The time stamp for which this method computes a successor.
        Returns:
        The time stamp following the currentTime time stamp.