Class PeriodicPoster<T>

java.lang.Object
xal.tools.correlator.PeriodicPoster<T>
All Implemented Interfaces:
ActionListener, EventListener

public class PeriodicPoster<T> extends Object implements ActionListener
PerodicPoster is an auxiliary class for posting correlations periodically. Unlike the TimedBroadcaster, it strictly only posts the most recent best correlation within a given time interval. Other correlations within that same time period will be dropped. The poster will repeat forever until it is stopped.
Author:
tap
  • Constructor Details

    • PeriodicPoster

      public PeriodicPoster(Correlator<?,T,? extends SourceAgent<T>> aCorrelator, double period)
      Creates a new instance of PeriodicPoster
      Parameters:
      aCorrelator - The correlator providing the correlations.
      period - The posting period.
  • Method Details

    • getCorrelator

      public Correlator<?,T,? extends SourceAgent<T>> getCorrelator()
      Get the associated correlator
      Returns:
      the correlator providing the correlations.
    • getPeriod

      public double getPeriod()
      Get the timer period
      Returns:
      The timer period.
    • setPeriod

      public void setPeriod(double period)
      Set the timer period
      Parameters:
      period - The new timer period.
    • isRunning

      public boolean isRunning()
      Determine if the poster is running
      Returns:
      true if the poster is running and false if not.
    • start

      public void start()
      Start the timer
    • stop

      public void stop()
      Stop posting
    • restart

      public void restart()
      Restart posting
    • dispose

      public void dispose()
      Dispose of the poster
    • addCorrelationNoticeListener

      public void addCorrelationNoticeListener(CorrelationNotice<T> listener)
      Add the listener of re-broadcast correlation notices.
      Parameters:
      listener - A listener of the correlation notice.
    • removeCorrelationNoticeListener

      public void removeCorrelationNoticeListener(CorrelationNotice<T> listener)
      Remove the listener of re-broadcast correlations
      Parameters:
      listener - A listener of the correlation notice.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Implement ActionListener interface to rebroadcast the best correlation.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - The timer event indicating that it is time to post a correlation.