Class Clock

java.lang.Object
me.autobot.lib.math.Clock

public class Clock extends Object
Used to keep track of time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new clock object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    elapsed(long time)
    Check if the given time has elapsed.
    boolean
    elapsedSince(long time)
    Check if the given time has elapsed since the last time it was triggered.
    long
    Check how long it has been since the clock was created.
    void
    setPaused(boolean paused)
    Sets if the timer is paused.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Clock

      public Clock()
      Creates a new clock object.
  • Method Details

    • getTimeElapsed

      public long getTimeElapsed()
      Check how long it has been since the clock was created.
      Returns:
      The time elapsed in milliseconds.
    • elapsed

      public boolean elapsed(long time)
      Check if the given time has elapsed.
      Parameters:
      time - The time to check.
      Returns:
      Whether the time has elapsed.
    • elapsedSince

      public boolean elapsedSince(long time)
      Check if the given time has elapsed since the last time it was triggered.
      Parameters:
      time - The time to check.
      Returns:
      Whether the time has elapsed.
    • setPaused

      public void setPaused(boolean paused)
      Sets if the timer is paused.
      Parameters:
      paused - Whether the timer is paused.