elge.storage.file
Class DataRecorder

java.lang.Object
  |
  +--elge.storage.file.DataRecorder
All Implemented Interfaces:
DataStorage

public class DataRecorder
extends Object
implements DataStorage

DataRecorder is a simple easy format data recorder. It uses very simple format for writing. Especialy for each element there is a seperate file. In each file there is a tick in every new line, there is a tick count and a value that is stored separated by ":" The format is compresed, so only changes are writen, and last tick - is writen.

Author:
Palino

Field Summary
protected static SimpleDateFormat dirName
           
protected static SimpleDateFormat format
           
 
Method Summary
 void close()
          Makes flush and save the data.
static DataRecorder createRecorder(String path)
          In path creates new directory where data are stored...
 void destroy()
           
 DataReader getDataReader(String property)
           
 com.jrefinery.data.CategoryDataset getLastTickCategoryDataset(List property)
          An category dataset.
 com.jrefinery.data.PieDataset getLastTickPieDataset(List property)
          Pie dataset for the pie graph.
 List getPropertyNames()
          Get actual list of properties that are monitored and stored to the disk.
 DataStorage getRun(int index)
          Returns a DataStorage for older simulation data.
 List getRunNames()
          Every storage is responsible for the runs, that user makes.
 Object getValue(int tick, String property)
          retruns a value for tick and property.
 com.jrefinery.data.XYDataset getXYTickValueDataset(List property)
          Like above
 com.jrefinery.data.XYDataset getXYTickValueDataset(List property, int window)
          like above
 com.jrefinery.data.XYDataset getXYTickValueDataset(String[] property)
          Toto spravi viac series v tom grafe...
 com.jrefinery.data.XYDataset getXYTickValueDataset(String property, int window)
          Creates dataset that uses data stored for the "property", actualy, the X is tick count, and Y is the data...
 Integer lastTick()
          The lastTick that was recorder by this storage
 void record(Vector monitors)
          Stores the data from monitors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirName

protected static SimpleDateFormat dirName

format

protected static SimpleDateFormat format
Method Detail

createRecorder

public static DataRecorder createRecorder(String path)
In path creates new directory where data are stored...


getXYTickValueDataset

public com.jrefinery.data.XYDataset getXYTickValueDataset(String property,
                                                          int window)
Creates dataset that uses data stored for the "property", actualy, the X is tick count, and Y is the data...

Specified by:
getXYTickValueDataset in interface DataStorage
Parameters:
property - property name
window - the tick step size
Returns:
the dataset

getXYTickValueDataset

public com.jrefinery.data.XYDataset getXYTickValueDataset(String[] property)
Toto spravi viac series v tom grafe...

Specified by:
getXYTickValueDataset in interface DataStorage
Parameters:
property - the list of properties
Returns:
the dataset

getXYTickValueDataset

public com.jrefinery.data.XYDataset getXYTickValueDataset(List property)
Description copied from interface: DataStorage
Like above

Specified by:
getXYTickValueDataset in interface DataStorage
Parameters:
property - the properties
Returns:
dataset for graph

getXYTickValueDataset

public com.jrefinery.data.XYDataset getXYTickValueDataset(List property,
                                                          int window)
Description copied from interface: DataStorage
like above

Specified by:
getXYTickValueDataset in interface DataStorage
Parameters:
property - propeties
window - the tick step size
Returns:
the dataset for graph

record

public void record(Vector monitors)
            throws IOException
Stores the data from monitors.

Specified by:
record in interface DataStorage
Parameters:
monitors - The vector of monitors.
Throws:
IOException - if some io problem occures.

close

public void close()
Makes flush and save the data. This should be called befare

Specified by:
close in interface DataStorage

destroy

public void destroy()

lastTick

public Integer lastTick()
Description copied from interface: DataStorage
The lastTick that was recorder by this storage

Specified by:
lastTick in interface DataStorage
Returns:
the last tick value.

getDataReader

public DataReader getDataReader(String property)
Returns:
a DataReader, which reads the stored data...

getLastTickCategoryDataset

public com.jrefinery.data.CategoryDataset getLastTickCategoryDataset(List property)
Description copied from interface: DataStorage
An category dataset. Unlike XYDataset, this category dataset shows only last values of the tick.

Specified by:
getLastTickCategoryDataset in interface DataStorage
Parameters:
property - propeties
Returns:
dataset for graph

getLastTickPieDataset

public com.jrefinery.data.PieDataset getLastTickPieDataset(List property)
Description copied from interface: DataStorage
Pie dataset for the pie graph. Also a sipmle category dataset.

Specified by:
getLastTickPieDataset in interface DataStorage
Parameters:
property - the property list
Returns:
a pie dataset for graph

getRun

public DataStorage getRun(int index)
Description copied from interface: DataStorage
Returns a DataStorage for older simulation data.

Specified by:
getRun in interface DataStorage
Parameters:
index - index of older simulation
Returns:
DataStorage for older simulation.

getRunNames

public List getRunNames()
Every storage is responsible for the runs, that user makes. So one simulation coresponds to one data storage and one run. This method returns the run names user can display. To get the specific simulation data, use the getRun method.

Specified by:
getRunNames in interface DataStorage
Returns:
List of available data of older simulations
See Also:
getRun(int)

getPropertyNames

public List getPropertyNames()
Description copied from interface: DataStorage
Get actual list of properties that are monitored and stored to the disk.

Specified by:
getPropertyNames in interface DataStorage
Returns:
List of monitored properties

getValue

public Object getValue(int tick,
                       String property)
Description copied from interface: DataStorage
retruns a value for tick and property.

Specified by:
getValue in interface DataStorage
Parameters:
tick - the tick
property - property name
Returns:
the stored value.