Class DelayedEvent

java.lang.Object
cl.netswitch.lib.server.DelayedEvent
All Implemented Interfaces:
Comparable<Delayed>, Delayed

public abstract class DelayedEvent extends Object implements Delayed
Implements the logic common to all delayed events.
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    Compares this DelayedEvent with the specified object for order.
    abstract void
    Dispatched this DelayedEvent to the target listener.
    final boolean
    equals(Object that)
    Indicates whether some other object is "equal to" this DelayedEvent.
    final long
    Returns the remaining delay in the given time unit.
    final int
    Returns a hash code value of this DelayedEvent.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getDelay

      public final long getDelay(TimeUnit unit)
      Returns the remaining delay in the given time unit.
      Specified by:
      getDelay in interface Delayed
      Parameters:
      unit - the required time unit of the output
      Returns:
      the remaining delay in the given time unit.
      Throws:
      NullPointerException - if unit is null.
    • hashCode

      public final int hashCode()
      Returns a hash code value of this DelayedEvent.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value of this DelayedEvent.
    • equals

      public final boolean equals(Object that)
      Indicates whether some other object is "equal to" this DelayedEvent.
      Overrides:
      equals in class Object
      Parameters:
      that - the object to compare to this object (can be null).
      Returns:
      true if this delayed runnable equals that.
    • compareTo

      public final int compareTo(Delayed other)
      Compares this DelayedEvent with the specified object for order.
      Specified by:
      compareTo in interface Comparable<Delayed>
      Parameters:
      other - the object to compare to this DelayedEvent.
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Throws:
      NullPointerException - if other is null.
    • dispatch

      public abstract void dispatch() throws Exception
      Dispatched this DelayedEvent to the target listener.
      Throws:
      Exception - if an error occurs.