Class EventQueue

  • All Implemented Interfaces:
    AnnotationListener

    public class EventQueue
    extends Object
    implements AnnotationListener
    A queue that ensures that events are added to the annotations one at a time. This is to prevent race conditions
    Author:
    sjb90
    • Field Detail

      • SLEEP_TIME

        public static final long SLEEP_TIME
        a constant defining the amount of time to sleep for
        See Also:
        Constant Field Values
      • m_Annotations

        protected AudioAnnotations m_Annotations
        the annotations we add the steps to
      • m_Runnable

        protected adams.flow.core.RunnableWithLogging m_Runnable
        the runable we use for the internal thread
      • m_Playing

        protected boolean m_Playing
        a flag that says if we're paused or not
    • Constructor Detail

      • EventQueue

        public EventQueue()
        Constructs a queue that adds steps to a annotations.
    • Method Detail

      • resetAnnotations

        public void resetAnnotations()
        Resets the annotations to an empty one. Clears the queue so any left over steps are not added mistakenly to the new annotations.
      • getAnnotations

        public AudioAnnotations getAnnotations()
        A getter for the annotations EventQueue adds steps to
        Returns:
        The annotations we've been adding steps to
      • loadAnnotations

        public void loadAnnotations​(AudioAnnotations annotations)
        Loads a saved annotations EventQueue adds steps to. Clears the steps queue so any remaining steps are not mistakenly added to the newly loaded queue.
        Parameters:
        annotations - The annotations we're loading in
      • clearQueue

        protected void clearQueue()
      • start

        protected void start()
      • toSpreadSheet

        public adams.data.spreadsheet.SpreadSheet toSpreadSheet()
        Turns the inner annotations into a spreadsheet.
        Returns:
        the spread sheet object
      • cleanUp

        public void cleanUp()
        Cleans up any loose ends