gov.sns.ca.correlator
Class ChannelCorrelator

java.lang.Object
  |
  +--gov.sns.tools.correlator.Correlator
        |
        +--gov.sns.ca.correlator.ChannelCorrelator
Direct Known Subclasses:
OrbitCorrelator

public class ChannelCorrelator
extends Correlator

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.


Field Summary
 
Fields inherited from class gov.sns.tools.correlator.Correlator
_binTimespan, correlationTester, localCenter
 
Constructor Summary
ChannelCorrelator(double aBinTimespan)
          Creates new ChannelCorrelator
ChannelCorrelator(double aBinTimespan, CorrelationFilter aFilter)
          Creates new ChannelCorrelator.
 
Method Summary
 void addChannel(Channel channel)
          Add a channel to monitor.
 void addChannel(Channel channel, RecordFilter recordFilter)
          Add a channel to monitor.
 void addChannel(Channel channel, java.lang.String channelId)
          Add a channel to monitor.
 void addChannel(Channel channel, java.lang.String channelId, RecordFilter recordFilter)
          Add a channel to monitor.
 void addChannel(java.lang.String channelId)
          Add a channel to monitor.
 void addChannel(java.lang.String channelId, RecordFilter recordFilter)
          Add a channel to monitor.
 java.util.Collection inactiveChannelsByName()
          Get the names of channels that are not being monitored due to connection or monitor failure or simply not monitoried.
protected  SourceAgent newSourceAgent(java.lang.Object source, java.lang.String sourceName, RecordFilter recordFilter)
          Overrides the parent method to create and return a ChannelAgent as a source agent for this correlator.
 int numActiveChannels()
          Get the number of actively monitored channels.
 int numInactiveChannels()
          Get the number of channels that are inactive due to connection or monitor failure or simply not monitored.
 void removeAllChannels()
          Remove all registered channels.
 void removeChannel(Channel channel)
          Stop managing the specified channel.
 void removeChannel(java.lang.String channelId)
          Stop managing the specified channel
 
Methods inherited from class gov.sns.tools.correlator.Correlator
addListener, addSource, addSource, binTimespan, dispose, fetchCorrelationWithTimeout, getNamesOfSources, getSourceAgents, hasSource, isRunning, monitorWithTimeout, numSources, pulseMonitorWithTimeout, registerEvents, removeAllSources, removeListener, removeSource, setBinTimespan, setCorrelationFilter, startMonitoring, stopMonitoring
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelCorrelator

public ChannelCorrelator(double aBinTimespan)
Creates new ChannelCorrelator


ChannelCorrelator

public ChannelCorrelator(double aBinTimespan,
                         CorrelationFilter aFilter)
Creates new ChannelCorrelator.

Parameters:
aBinTimespan - The time resolution for accepting two events as correlated.
aFilter - A filter to apply to the correlation.
Method Detail

newSourceAgent

protected SourceAgent newSourceAgent(java.lang.Object source,
                                     java.lang.String sourceName,
                                     RecordFilter recordFilter)
Overrides the parent method to create and return a ChannelAgent as a source agent for this correlator.

Specified by:
newSourceAgent in class Correlator
Parameters:
source - The new source 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 java.util.Collection inactiveChannelsByName()
Get the names of channels that are not being monitored due to connection or monitor failure or simply not monitoried.

Returns:
The collection of names of channels that are not active.

addChannel

public void addChannel(java.lang.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(java.lang.String channelId,
                             RecordFilter 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 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,
                             java.lang.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,
                             java.lang.String channelId,
                             RecordFilter 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.
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(java.lang.String channelId)
Stop managing the specified channel


removeAllChannels

public void removeAllChannels()
Remove all registered channels.