Class TimedActionListener

  • All Implemented Interfaces:
    java.lang.Comparable<TimedActionListener>

    public abstract class TimedActionListener
    extends java.lang.Object
    implements java.lang.Comparable<TimedActionListener>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_PRIORITY
      Represents the default priority for the action DEFAULT_PRIORITY = 10.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimedActionListener​(TimedAction timedAction)
      Create and attach the TimedActionListener to the supplied TimedAction
      TimedActionListener​(TimedAction timedAction, int priority)
      Create and attach the TimedActionListener to the supplied TimedAction
      TimedActionListener​(TimedAction timedAction, int priority, java.lang.String name)
      Create and attach the TimedActionListener to the supplied TimedAction
      TimedActionListener​(TimedAction timedAction, java.lang.String name)
      Create and attach the TimedActionListener to the supplied TimedAction
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void action​(JSLEvent event)
      Must be overridden to provide logic associated with the action
      int compareTo​(TimedActionListener listener)
      Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.
      boolean getCallActionFlag()
      Indicates whether or not the listener will be called when its TimedAction occurs
      int getId()
      Gets the the id assigned to the event by the scheduler.
      java.lang.String getName()
      Gets the name of the event
      int getPriority()
      Gets the priority of the event
      protected TimedAction getTimedAction()  
      void setCallActionFlag​(boolean flag)
      If the flag is false, the listener will not be called by its TimedAction, but it will not be removed(detached) from the TimedAction
      protected void setId​(int id)
      Sets the id of the event, package scope because only the Scheduler should be setting the id
      void setName​(java.lang.String name)
      Sets the name
      protected void setTimedAction​(TimedAction timedAction)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_PRIORITY

        public static final int DEFAULT_PRIORITY
        Represents the default priority for the action DEFAULT_PRIORITY = 10. Lower priority goes first. All integer priority numbers can be used to set the priority of a listener.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TimedActionListener

        public TimedActionListener​(TimedAction timedAction)
        Create and attach the TimedActionListener to the supplied TimedAction
        Parameters:
        timedAction -
      • TimedActionListener

        public TimedActionListener​(TimedAction timedAction,
                                   java.lang.String name)
        Create and attach the TimedActionListener to the supplied TimedAction
        Parameters:
        timedAction -
        name -
      • TimedActionListener

        public TimedActionListener​(TimedAction timedAction,
                                   int priority)
        Create and attach the TimedActionListener to the supplied TimedAction
        Parameters:
        timedAction -
        priority -
      • TimedActionListener

        public TimedActionListener​(TimedAction timedAction,
                                   int priority,
                                   java.lang.String name)
        Create and attach the TimedActionListener to the supplied TimedAction
        Parameters:
        timedAction -
        priority -
        name -
    • Method Detail

      • getName

        public final java.lang.String getName()
        Gets the name of the event
        Returns:
        The name of the event
      • setName

        public final void setName​(java.lang.String name)
        Sets the name
        Parameters:
        name -
      • getPriority

        public final int getPriority()
        Gets the priority of the event
        Returns:
        An int representing the priority. Lower is better.
      • getId

        public final int getId()
        Gets the the id assigned to the event by the scheduler. No two events have the same id.
        Returns:
        A long representing the id
      • getCallActionFlag

        public final boolean getCallActionFlag()
        Indicates whether or not the listener will be called when its TimedAction occurs
        Returns:
      • setCallActionFlag

        public final void setCallActionFlag​(boolean flag)
        If the flag is false, the listener will not be called by its TimedAction, but it will not be removed(detached) from the TimedAction
        Parameters:
        flag -
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setId

        protected final void setId​(int id)
        Sets the id of the event, package scope because only the Scheduler should be setting the id
        Parameters:
        id - Provided by the Scheduler class
      • setTimedAction

        protected final void setTimedAction​(TimedAction timedAction)
        Parameters:
        timedAction -
      • getTimedAction

        protected final TimedAction getTimedAction()
        Returns:
      • action

        protected abstract void action​(JSLEvent event)
        Must be overridden to provide logic associated with the action
        Parameters:
        event -
      • compareTo

        public int compareTo​(TimedActionListener listener)
        Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object. Natural ordering: priority, then order of creation Lower priority, lower order of creation goes first Throws ClassCastException if the specified object's type prevents it from begin compared to this object. Throws RuntimeException if the id's of the objects are the same, but the references are not when compared with equals. Note: This class may have a natural ordering that is inconsistent with equals.
        Specified by:
        compareTo in interface java.lang.Comparable<TimedActionListener>
        Parameters:
        listener - The listener to compare this listener to
        Returns:
        Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.