simtools.data.async
Class TimeStampedDataSource

java.lang.Object
  extended by simtools.data.ValueProvider
      extended by simtools.data.DataSource
          extended by simtools.data.async.TimeStampedDataSource
Direct Known Subclasses:
AsynchronousMergeDSCollection.AsynchronousMergeDataSource, MultiStampedDataSource, MultiStampedDataSource.IntegerSource, MultiStampedDataSource.LabelSource, StreamingMSDataSource.StreamingIntegerSource, StreamingMSDataSource.StreamingLabelSource, StreamingTSDataSource, TimeStampedEmptyDataSource

public abstract class TimeStampedDataSource
extends DataSource

A data source to put together the value and its sampling date It is designed to collect asynchronous data sources in one collection Each data has its owwn sampling date, there is no simple way to correlate the data belonging to this king of data collection since the data index can not be used to get 2 synchronised values.

Author:
Claude Cazenave

Nested Class Summary
 class TimeStampedDataSource.TimeSource
           
 
Field Summary
protected  simtools.data.async.TimeStampedDataSource.AuxiliaryCollection _auxiliaries
           
 
Fields inherited from class simtools.data.DataSource
endNotificationListeners, listeners, sortedOrder
 
Fields inherited from class simtools.data.ValueProvider
ByteProvider, DoubleProvider, FloatProvider, IntegerProvider, kind, LongProvider, ObjectProvider, ShortProvider
 
Constructor Summary
TimeStampedDataSource(java.lang.String label, java.lang.String id, TimeStampedDataSourceCollection c)
           
 
Method Summary
protected abstract  void computeMinMax()
           
protected  DataSource createEmptyDataSource()
          Create an empty data source with same references than current data source.
 java.util.Collection getAuxiliarySources()
          If the data source is compund return the collection of auxiliary data sources
 TimeStampedDataSourceCollection getCollection()
           
 java.lang.String getDataSourceInformationClass()
          This method provide the UI Data source information class name.
 double getDoubleMax()
           
 double getDoubleMin()
           
abstract  double getDoubleValue(long index)
          Optimized accessor for double values.
abstract  double getEnd()
           
protected  DataInfo getInfo()
           
 DataInfo getInformation()
           
abstract  long getLastIndex()
           
 java.lang.Object getMax()
           
 java.lang.Object getMin()
          Return values if possibly only, without expensive computations.
protected  java.lang.String getName()
           
abstract  double getStart()
           
abstract  long getStartIndex()
           
 TimeStampedDataSource.TimeSource getTime()
           
abstract  java.lang.Object getValue(long index)
           
 boolean isCompound()
          Checks if a data source is compound, i.e. if it provides auxiliary data sources
abstract  boolean isValid()
           
protected  void setInfo(DataInfo info)
           
protected  void setMax(java.lang.Double max)
           
protected  void setMin(java.lang.Double min)
           
protected  void setMinmax(boolean minmax)
           
 void setTime(TimeStampedDataSource.TimeSource time)
           
 java.lang.String toString()
           
 
Methods inherited from class simtools.data.DataSource
addEndNotificationListener, addListener, computeLastIndex, computeMax, computeMin, computeSortedOrder, computeStartIndex, equals, getByteMax, getByteMin, getChoiceFormat, getFloatMax, getFloatMin, getIntegerMax, getIntegerMin, getLongMax, getLongMin, getShortMax, getShortMin, getSortedOrder, getSourceDependencies, isAuxiliary, isComparable, notifyEndNotificationListeners, notifyListenersForDataReplaced, notifyListenersForDataReplaced, notifyListenersForIndexRangeChange, notifyListenersForInfoChange, notifyListenersForOrderChange, notifyListenersForValueChange, notifyListenersForValueRangeChange, removeEndNotificationListener, removeListener, setSlice, sortedOrder, updateSortedOrder
 
Methods inherited from class simtools.data.ValueProvider
getByteValue, getFloatValue, getIntegerValue, getKind, getLongValue, getObjectValue, getShortValue, valueClass
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_auxiliaries

protected simtools.data.async.TimeStampedDataSource.AuxiliaryCollection _auxiliaries
Constructor Detail

TimeStampedDataSource

public TimeStampedDataSource(java.lang.String label,
                             java.lang.String id,
                             TimeStampedDataSourceCollection c)
                      throws java.io.IOException,
                             TimeStampedDataSourceCollection.InvalidFormatException
Parameters:
label - The data source name
id - The data source id
c - The collection holding this data
Throws:
java.io.IOException
TimeStampedDataSourceCollection.InvalidFormatException
Method Detail

createEmptyDataSource

protected DataSource createEmptyDataSource()
Create an empty data source with same references than current data source. A such empty data source can be replaced later when new collections have been added to pool

Overrides:
createEmptyDataSource in class DataSource
Returns:
an empty data source

getStart

public abstract double getStart()
                         throws DataException
Throws:
DataException

getEnd

public abstract double getEnd()
                       throws DataException
Throws:
DataException

computeMinMax

protected abstract void computeMinMax()
                               throws UnsupportedOperation
Throws:
UnsupportedOperation

getValue

public abstract java.lang.Object getValue(long index)
                                   throws DataException
Specified by:
getValue in class ValueProvider
Throws:
DataException

getDoubleValue

public abstract double getDoubleValue(long index)
                               throws DataException
Description copied from class: ValueProvider
Optimized accessor for double values. If the provider can provide doubles directly, then it should override this method. Otherwise, the default implementation will do its best to convert the Object returned by getValue() to a double. This conversion also parses strings, and returns 0 if it failed. An exception is thrown if, and only if, getValue throws it.

Overrides:
getDoubleValue in class ValueProvider
Throws:
DataException

getStartIndex

public abstract long getStartIndex()
                            throws UnsupportedOperation
Overrides:
getStartIndex in class DataSource
Throws:
UnsupportedOperation

getLastIndex

public abstract long getLastIndex()
                           throws UnsupportedOperation
Overrides:
getLastIndex in class DataSource
Throws:
UnsupportedOperation

getDoubleMin

public double getDoubleMin()
                    throws DataException
Overrides:
getDoubleMin in class DataSource
Throws:
DataException

getDoubleMax

public double getDoubleMax()
                    throws DataException
Overrides:
getDoubleMax in class DataSource
Throws:
DataException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getInformation

public DataInfo getInformation()
Overrides:
getInformation in class DataSource

getCollection

public TimeStampedDataSourceCollection getCollection()
Returns:
Returns the _collection.

setTime

public void setTime(TimeStampedDataSource.TimeSource time)
Parameters:
time - The time to set.

getTime

public TimeStampedDataSource.TimeSource getTime()
Returns:
Returns the time.

getName

protected java.lang.String getName()
Returns:
Returns the name.

setMinmax

protected void setMinmax(boolean minmax)
Parameters:
minmax - The minmax to set.

setInfo

protected void setInfo(DataInfo info)
Parameters:
info - The info to set.

getInfo

protected DataInfo getInfo()
Returns:
Returns the info.

setMin

protected void setMin(java.lang.Double min)
Parameters:
min - The min to set.

getMin

public java.lang.Object getMin()
Description copied from class: DataSource
Return values if possibly only, without expensive computations.

Overrides:
getMin in class DataSource
Returns:
Returns the min.

setMax

protected void setMax(java.lang.Double max)
Parameters:
max - The max to set.

getMax

public java.lang.Object getMax()
Overrides:
getMax in class DataSource
Returns:
Returns the max.

isValid

public abstract boolean isValid()
Returns:
true if it is valid

getAuxiliarySources

public java.util.Collection getAuxiliarySources()
Description copied from class: DataSource
If the data source is compund return the collection of auxiliary data sources

Overrides:
getAuxiliarySources in class DataSource
Returns:
the auxilary data source collection or null if not a compound data source

isCompound

public boolean isCompound()
Description copied from class: DataSource
Checks if a data source is compound, i.e. if it provides auxiliary data sources

Overrides:
isCompound in class DataSource
Returns:
true if it is compound

getDataSourceInformationClass

public java.lang.String getDataSourceInformationClass()
Description copied from class: DataSource
This method provide the UI Data source information class name. Should be overloaded in sub classes to return specified information

Overrides:
getDataSourceInformationClass in class DataSource
Returns:
the box