Class TickBasedTimer

java.lang.Object
madkit.simulation.scheduler.SimuTimer<BigDecimal>
madkit.simulation.scheduler.TickBasedTimer

public class TickBasedTimer extends SimuTimer<BigDecimal>
A timer based on ticks for simulation purposes. This class extends the SimuTimer class and uses BigDecimal for tick values.
  • Constructor Details

    • TickBasedTimer

      public TickBasedTimer(BigDecimal initialTick, BigDecimal endTick)
      Constructs a TickBasedTimer with the specified initial and end tick values.
      Parameters:
      initialTick - the initial tick value
      endTick - the end tick value
    • TickBasedTimer

      public TickBasedTimer()
      Constructs a TickBasedTimer with an initial tick value of BigDecimal.ZERO.
    • TickBasedTimer

      public TickBasedTimer(BigDecimal initialTick)
      Constructs a TickBasedTimer with the specified initial tick value and an end tick value of Double.MAX_VALUE.
      Parameters:
      initialTick - the initial tick value
  • Method Details

    • incrementCurrentTick

      public void incrementCurrentTick(double delta)
      Increments the current tick by the specified delta value.
      Parameters:
      delta - the amount to increment the current tick by
    • incrementCurrentTick

      public void incrementCurrentTick(BigDecimal delta)
      Increments the current tick by the specified delta value.
      Parameters:
      delta - the amount to increment the current tick by
    • addDeltaTime

      public void addDeltaTime(BigDecimal delta)
      Adds the specified delta time to the current tick. Shortcut for setCurrentTick(getCurrentTick().add(delta));
      Parameters:
      delta - specifies how much time should be added
    • addOneTimeUnit

      public void addOneTimeUnit()
      Adds one time unit to the current tick.