Class ChannelCorrelator


public class ChannelCorrelator extends Correlator<Channel,ChannelTimeRecord,ChannelAgent>
ChannelCorrelator is a subclass of the Correlator specifically for correlating channel monitor events. It adds convenience methods that make it easier to add channels as sources. It implements newSourceAgent() to generate a ChannelAgent as a source agent. The Correlator is the class that is used to setup monitoring of correlated events. It is the sole entry point to the outside world. When correlations are found, the Correlator broadcasts the correlation. Note that all time is in seconds unless otherwise stated.
Author:
tap
  • Constructor Details

    • ChannelCorrelator

      public ChannelCorrelator(double aBinTimespan)
      Creates new ChannelCorrelator
      Parameters:
      aBinTimespan - timespan for the bins
    • ChannelCorrelator

      public ChannelCorrelator(double aBinTimespan, CorrelationFilter<ChannelTimeRecord> aFilter)
      Creates new ChannelCorrelator.
      Parameters:
      aBinTimespan - The time resolution for accepting two events as correlated.
      aFilter - A filter to apply to the correlation.
  • Method Details

    • newSourceAgent

      protected ChannelAgent newSourceAgent(Channel channel, String sourceName, RecordFilter<ChannelTimeRecord> recordFilter)
      Overrides the parent method to create and return a ChannelAgent as a source agent for this correlator.
      Specified by:
      newSourceAgent in class Correlator<Channel,ChannelTimeRecord,ChannelAgent>
      Parameters:
      channel - The new channel to monitor and correlate.
      sourceName - The name to be associated with the source.
      recordFilter - The filter to apply to the source's records.
    • numActiveChannels

      public int numActiveChannels()
      Get the number of actively monitored channels.
      Returns:
      The number of actively monitored channels.
    • numInactiveChannels

      public int numInactiveChannels()
      Get the number of channels that are inactive due to connection or monitor failure or simply not monitored.
      Returns:
      The number of channels that are inactive.
    • inactiveChannelsByName

      public Collection<String> inactiveChannelsByName()
      Get the names of channels that are not being monitored due to connection or monitor failure or simply not monitored.
      Returns:
      The collection of names of channels that are not active.
    • addChannel

      public void addChannel(String channelId)
      Add a channel to monitor. If we already monitor a channel, do nothing.
      Parameters:
      channelId - The PV name to monitor.
    • addChannel

      public final void addChannel(String channelId, RecordFilter<ChannelTimeRecord> recordFilter)
      Add a channel to monitor. If we already monitor a channel, do nothing. The record filter is used to determine whether or not to accept the reading of the specified channel when the event is handled.
      Parameters:
      channelId - The PV name to monitor.
      recordFilter - The filter to apply to the channel's records.
    • addChannel

      public final void addChannel(Channel channel)
      Add a channel to monitor. If we already monitor a channel, do nothing.
      Parameters:
      channel - The channel to monitor for correlations.
    • addChannel

      public final void addChannel(Channel channel, RecordFilter<ChannelTimeRecord> recordFilter)
      Add a channel to monitor. If we already monitor a channel, do nothing. The record filter is used to determine whether or not to accept the reading of the specified channel when the event is handled.
      Parameters:
      channel - The channel to monitor for correlations.
      recordFilter - The filter to apply to the channel's records.
    • addChannel

      public final void addChannel(Channel channel, String channelId)
      Add a channel to monitor. If we already monitor a channel, do nothing. This method allows channels to be specified with an alternate id than the default one.
      Parameters:
      channel - The channel to monitor for correlations.
      channelId - A unique identifier of the channel.
    • addChannel

      public final void addChannel(Channel channel, String channelId, RecordFilter<ChannelTimeRecord> recordFilter)
      Add a channel to monitor. If we already monitor a channel, do nothing. The record filter is used to determine whether or not to accept the reading of the specified channel when the event is handled. This method allows channels to be specified with an alternate id than the default one.
      Parameters:
      channel - The channel to monitor for correlations.
      channelId - ID to associate with the channel.
      recordFilter - The filter to apply to the channel's records.
    • removeChannel

      public void removeChannel(Channel channel)
      Stop managing the specified channel.
      Parameters:
      channel - The channel we are requesting to stop monitoring and correlating.
    • removeChannel

      public void removeChannel(String channelId)
      Stop managing the specified channel
      Parameters:
      channelId - The id of the channel we are requesting to stop monitoring and correlating.
    • removeAllChannels

      public void removeAllChannels()
      Remove all registered channels.