etomica.data
Class AccumulatorHistory

java.lang.Object
  extended by etomica.data.DataProcessor
      extended by etomica.data.DataProcessorForked
          extended by etomica.data.DataAccumulator
              extended by etomica.data.AccumulatorHistory
All Implemented Interfaces:
DataPipe, DataPipeForked, IDataSink, IDataSource, IEtomicaDataSource, Serializable

public class AccumulatorHistory
extends DataAccumulator

Accumulator that keeps history of data.

See Also:
Serialized Form

Nested Class Summary
protected static class AccumulatorHistory.DataSourceCount
          Simple DataSource to use as a default time DataSource.
 
Field Summary
protected  History history
           
protected  int nData
           
protected  DataSourceIndependentSimple xDataSources
           
 
Fields inherited from class etomica.data.DataAccumulator
active, putCount
 
Fields inherited from class etomica.data.DataProcessor
dataInfo, dataSink, tag, trueDataSink
 
Constructor Summary
AccumulatorHistory()
          Creates instance using HistorySimple factory and specifying historys having 100 bins.
AccumulatorHistory(History history)
           
 
Method Summary
protected  void addData(IData newData)
          Adds each value in the given array to its own history.
 IData getData()
          Returns the set of histories.
 DataPipe getDataCaster(IEtomicaDataInfo newInputDataInfo)
          Returns null.
 IEtomicaDataInfo getDataInfo()
           
 History getHistory()
           
 DataSourceScalar getTimeDataSource()
          Returns the DataSource used for the "time" component of the history.
protected  IEtomicaDataInfo processDataInfo(IEtomicaDataInfo newInputDataInfo)
          Sets up data and histories, discarding any previous results.
 void reset()
          Defined by subclass to perform some action that clears accumulated values.
 void setHistory(History newHistory)
           
 void setTimeDataSource(DataSourceScalar newTimeDataSource)
          Sets the DataSource used for the "time" component of the history.
 
Methods inherited from class etomica.data.DataAccumulator
getPushInterval, isActive, processData, setActive, setPushInterval, toString
 
Methods inherited from class etomica.data.DataProcessorForked
addDataSink, getDataSink, getDataSinks, removeDataSink, setDataSink, setDataSinks
 
Methods inherited from class etomica.data.DataProcessor
getTag, insertTransformerIfNeeded, putData, putDataInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface etomica.data.IEtomicaDataSource
getTag
 
Methods inherited from interface etomica.data.DataPipe
getTag
 
Methods inherited from interface etomica.data.IDataSink
putData, putDataInfo
 

Field Detail

history

protected History history

xDataSources

protected DataSourceIndependentSimple xDataSources

nData

protected int nData
Constructor Detail

AccumulatorHistory

public AccumulatorHistory()
Creates instance using HistorySimple factory and specifying historys having 100 bins.


AccumulatorHistory

public AccumulatorHistory(History history)
Method Detail

setTimeDataSource

public void setTimeDataSource(DataSourceScalar newTimeDataSource)
Sets the DataSource used for the "time" component of the history. Each time addData is called, the time DataSource's getData will be called and the returned scalar will be taken as the current time. By default, the time variable is taken to be the number of times data was added to the history.


getTimeDataSource

public DataSourceScalar getTimeDataSource()
Returns the DataSource used for the "time" component of the history.


getDataCaster

public DataPipe getDataCaster(IEtomicaDataInfo newInputDataInfo)
Returns null. AccumulatorHistogram can take an type of Data.

Parameters:
newInputDataInfo - the DataInfo for the Data that will fed to the sink's putData method

processDataInfo

protected IEtomicaDataInfo processDataInfo(IEtomicaDataInfo newInputDataInfo)
Sets up data and histories, discarding any previous results.

Specified by:
processDataInfo in class DataProcessor
Parameters:
nData -
Returns:
the DataInfo of the Data that will be output by this DataProcessor

addData

protected void addData(IData newData)
Adds each value in the given array to its own history. If the number of values is different from that given in previous calls to the method, old history data is discarded and new historys are constructed (this behavior can be modified by overriding the setNData method).

Specified by:
addData in class DataAccumulator

getData

public IData getData()
Returns the set of histories.

Specified by:
getData in interface IDataSource
Specified by:
getData in class DataAccumulator
Returns:
the data given by this source

getHistory

public History getHistory()

setHistory

public void setHistory(History newHistory)

reset

public void reset()
Description copied from class: DataAccumulator
Defined by subclass to perform some action that clears accumulated values.

Specified by:
reset in class DataAccumulator

getDataInfo

public IEtomicaDataInfo getDataInfo()
Specified by:
getDataInfo in interface IEtomicaDataSource
Overrides:
getDataInfo in class DataProcessor