Package xal.ca.correlator
Class ChannelCorrelator
java.lang.Object
xal.tools.correlator.Correlator<Channel,ChannelTimeRecord,ChannelAgent>
xal.ca.correlator.ChannelCorrelator
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
-
Field Summary
Fields inherited from class xal.tools.correlator.Correlator
binTimespan, correlationTester, localCenter
-
Constructor Summary
ConstructorsConstructorDescriptionChannelCorrelator
(double aBinTimespan) Creates new ChannelCorrelatorChannelCorrelator
(double aBinTimespan, CorrelationFilter<ChannelTimeRecord> aFilter) Creates new ChannelCorrelator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChannel
(String channelId) Add a channel to monitor.final void
addChannel
(String channelId, RecordFilter<ChannelTimeRecord> recordFilter) Add a channel to monitor.final void
addChannel
(Channel channel) Add a channel to monitor.final void
addChannel
(Channel channel, String channelId) Add a channel to monitor.final void
addChannel
(Channel channel, String channelId, RecordFilter<ChannelTimeRecord> recordFilter) Add a channel to monitor.final void
addChannel
(Channel channel, RecordFilter<ChannelTimeRecord> recordFilter) Add a channel to monitor.Get the names of channels that are not being monitored due to connection or monitor failure or simply not monitored.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.int
Get the number of actively monitored channels.int
Get the number of channels that are inactive due to connection or monitor failure or simply not monitored.void
Remove all registered channels.void
removeChannel
(String channelId) Stop managing the specified channelvoid
removeChannel
(Channel channel) Stop managing the specified channel.Methods inherited from class xal.tools.correlator.Correlator
addListener, addSource, addSource, binTimespan, dispose, fetchCorrelationWithTimeout, getNamesOfSources, getSourceAgents, hasSource, isRunning, monitorWithTimeout, numSources, pulseMonitorWithTimeout, registerEvents, removeAllSources, removeListener, removeSource, setBinTimespan, setCorrelationFilter, startMonitoring, stopMonitoring
-
Constructor Details
-
ChannelCorrelator
public ChannelCorrelator(double aBinTimespan) Creates new ChannelCorrelator- Parameters:
aBinTimespan
- timespan for the bins
-
ChannelCorrelator
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 classCorrelator<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
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
Add a channel to monitor. If we already monitor a channel, do nothing.- Parameters:
channelId
- The PV name to monitor.
-
addChannel
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
Add a channel to monitor. If we already monitor a channel, do nothing.- Parameters:
channel
- The channel to monitor for correlations.
-
addChannel
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
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
Stop managing the specified channel.- Parameters:
channel
- The channel we are requesting to stop monitoring and correlating.
-
removeChannel
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.
-