gov.sns.tools.correlator
Class Correlation

java.lang.Object
  |
  +--gov.sns.tools.correlator.Correlation

public class Correlation
extends java.lang.Object

Correlation is a generic container of correlated records.


Constructor Summary
Correlation(java.util.Map newRecordTable, UnivariateStatistics newTimeStatistics)
          Creates new Correlation
 
Method Summary
 boolean contains(Correlation correlation)
          Check whether this correlation contains all of the records of a specified correlation.
 java.lang.Object getRecord(java.lang.String name)
          Get the record identified by the source name (same one registered with the correlator).
 java.util.Collection getRecords()
          Get a collection of the records in the correlation.
 boolean isCorrelated(java.lang.String sourceName)
          Check if the named source is among the correlated.
 java.util.Date meanDate()
          Convenience method to get a Java date for a given time stamp by averaging the dates of the records.
 double meanTimeInSeconds()
          Average time of the time stamps from the records in seconds since the Java epoch
 java.util.Collection names()
          Get the collection of names each of which identifies a record.
 int numRecords()
          Get the number of records correlated.
 java.lang.String toString()
          String representation of the correlation useful for printing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Correlation

public Correlation(java.util.Map newRecordTable,
                   UnivariateStatistics newTimeStatistics)
Creates new Correlation

Method Detail

isCorrelated

public boolean isCorrelated(java.lang.String sourceName)
Check if the named source is among the correlated.

Parameters:
sourceName - A name uniquely identifying a source (and record)
Returns:
true if the sourceName identifies a record in this correlation and false otherwise.

numRecords

public int numRecords()
Get the number of records correlated.

Returns:
the number of records correlated.

names

public java.util.Collection names()
Get the collection of names each of which identifies a record.

Returns:
The collection of names for correlated records.

getRecords

public final java.util.Collection getRecords()
Get a collection of the records in the correlation.

Returns:
Collection of records in the correlation.
See Also:
getRecord(java.lang.String)

getRecord

public final java.lang.Object getRecord(java.lang.String name)
Get the record identified by the source name (same one registered with the correlator). In general this record can be any class that the specific implementation chooses to make. The record holds the value and time stamp of the specific measurement (e.g. PV timestamp and value). For a ChannelCorrelator, this method returns a ChannelTimeRecord.

Parameters:
name - The name that identifies the desired record.
Returns:
The record corresponding to the specified name.

contains

public boolean contains(Correlation correlation)
Check whether this correlation contains all of the records of a specified correlation.

Parameters:
correlation - The correlation to test for being contained within this
Returns:
true if this correlation contains all of the records of the specified correlation and false otherwise.

meanTimeInSeconds

public double meanTimeInSeconds()
Average time of the time stamps from the records in seconds since the Java epoch

Returns:
The mean time in seconds.

meanDate

public java.util.Date meanDate()
Convenience method to get a Java date for a given time stamp by averaging the dates of the records.

Returns:
The mean date of this correlation.

toString

public java.lang.String toString()
String representation of the correlation useful for printing

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this correlation.