Class SimuTimer<T extends Comparable<? super T>>

java.lang.Object
madkit.simulation.scheduler.SimuTimer<T>
Type Parameters:
T - the type used for modeling the time
Direct Known Subclasses:
DateBasedTimer, TickBasedTimer

public class SimuTimer<T extends Comparable<? super T>> extends Object
Class representing time in a simulation.
Since:
MaDKit 6.0
  • Constructor Details

    • SimuTimer

      public SimuTimer(T startTime, T endTime)
      Creates a new timer.
      Parameters:
      startTime - time at which the simulation should start
      endTime - time at which the simulation should end
  • Method Details

    • hasReachedEndTime

      public boolean hasReachedEndTime()
      Checks if this timer has reached its end time.
      Returns:
      true if the current time has reached the end time.
    • getTimeLabel

      public Label getTimeLabel()
      Returns a label synchronized with the current time.
      Returns:
      a label to be used in UI
    • setTimeFormat

      public void setTimeFormat(String format)
      Sets the formatting of the current time as specified in Formatter.
      Parameters:
      format - a printf-style format string
    • getCurrentTime

      public T getCurrentTime()
      Returns the current time object
      Returns:
      the currentTime
    • setCurrentTime

      public void setCurrentTime(T currentTime)
      Sets the current time object
      Parameters:
      currentTime - the currentTime to set
    • getEndTime

      public T getEndTime()
      Returns the ending time object
      Returns:
      the endTime
    • setEndTime

      public void setEndTime(T endTime)
      Sets the ending time object
      Parameters:
      endTime - the endTime to set
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class Object
      Returns:
      the string
    • reset

      public void reset()
      Resets the timer to its initial time.
    • getStartTime

      public T getStartTime()
      Returns the starting time
      Returns:
      the starting time
    • setStartTime

      public void setStartTime(T startTime)
      Sets the starting time
      Parameters:
      startTime - the startTime to set