uchicago.src.sim.analysis
Class LocalDataRecorder

java.lang.Object
  extended by uchicago.src.sim.analysis.AbstractDataSourceRecorder
      extended by uchicago.src.sim.analysis.LocalDataRecorder
All Implemented Interfaces:
DataSourceRecorder, Recorder, SimEventListener

public class LocalDataRecorder
extends AbstractDataSourceRecorder

The primary means of recording data during a simulation. The recorded data is drawn from objects in the simulation via the DataSources added with DataRecorder's addObjectDataSource method.

Version:
$Revision: 1.11 $ $Date: 2004/11/03 19:51:00 $
Author:
Nick Collier (Modified by Michael J. North)

Field Summary
protected  IController control
           
protected  java.util.Hashtable dynParams
           
protected  java.lang.String fileName
           
protected  boolean isBatch
           
protected  boolean writeHeader
           
protected  java.lang.String writeKey
           
 
Fields inherited from class uchicago.src.sim.analysis.AbstractDataSourceRecorder
data, dfHeader, model, sources
 
Constructor Summary
LocalDataRecorder(java.lang.String fileName, SimModel model)
          Constructs a DataRecorder using the specified file name and model.
LocalDataRecorder(java.lang.String fileName, SimModel model, boolean isBatch)
          Deprecated.  
LocalDataRecorder(java.lang.String fileName, SimModel model, boolean isBatch, java.lang.String headerComment)
          Deprecated.  
LocalDataRecorder(java.lang.String fileName, SimModel model, java.lang.String headerComment)
          Constructs a DataRecorder using the specified file name, model, and headerComment.
 
Method Summary
 void record()
          Records the data for the current tick in tabular format.
 void write()
          Writes the recorded data out to a file in tabular format.
 void writeEnd()
          Writes any ending matter to the file.
 void writeToFile()
          Writes the recorded data out to a file in tabular format.
 
Methods inherited from class uchicago.src.sim.analysis.AbstractDataSourceRecorder
addNumericDataSource, addNumericDataSource, addObjectDataSource, createAverageDataSource, createAverageDataSource, createNumericDataSource, createNumericDataSource, createObjectDataSource, initData, setDelimeter, simEventPerformed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

protected java.lang.String fileName

isBatch

protected boolean isBatch

dynParams

protected java.util.Hashtable dynParams

writeHeader

protected boolean writeHeader

control

protected IController control

writeKey

protected java.lang.String writeKey
Constructor Detail

LocalDataRecorder

public LocalDataRecorder(java.lang.String fileName,
                         SimModel model)
Constructs a DataRecorder using the specified file name and model. Defaults to non-batch mode.

Parameters:
fileName - the file to which the data is recorded
model - the model from which the data is drawn. The relevant model parameters (set/get parameters, rng seed) are written to the header of the file.

LocalDataRecorder

public LocalDataRecorder(java.lang.String fileName,
                         SimModel model,
                         java.lang.String headerComment)
Constructs a DataRecorder using the specified file name, model, and headerComment.

Parameters:
fileName - the file to which the data is recorded
model - the model from which the data is drawn. The relevant model parameters (set/get parameters, rng seed) are written to the header of the file
headerComment - a comment to prepend to the file header information

LocalDataRecorder

public LocalDataRecorder(java.lang.String fileName,
                         SimModel model,
                         boolean isBatch)
Deprecated. 

Constructs a DataRecorder using the specified file name, model, and mode.

Parameters:
fileName - the file to which the data is recorded
model - the model from which the data is drawn. The relevant model parameters (set/get parameters, rng seed) are written to the header of the file
isBatch - whether this model is run in batch mode

LocalDataRecorder

public LocalDataRecorder(java.lang.String fileName,
                         SimModel model,
                         boolean isBatch,
                         java.lang.String headerComment)
Deprecated. 

Constructs a DataRecorder using the specified file name, model, and mode.

Parameters:
fileName - the file to which the data is recorded
model - the model from which the data is drawn. The relevant model parameters (set/get parameters, rng seed) are written to the header of the file
isBatch - whether this model is run in batch mode
headerComment - a comment to prepend to the file header information
Method Detail

record

public void record()
Records the data for the current tick in tabular format. Each tick is a row, and each column is the name of the data source.

Specified by:
record in interface Recorder
Specified by:
record in class AbstractDataSourceRecorder

writeToFile

public void writeToFile()
Writes the recorded data out to a file in tabular format. This also does a flush on the data itself (i.e. the data is no longer stored by repast and exists only in the file). Identical to write().

Specified by:
writeToFile in interface Recorder
Specified by:
writeToFile in class AbstractDataSourceRecorder

write

public void write()
Writes the recorded data out to a file in tabular format. This also does a flush on the data itself (i.e. the data is no longer stored by repast and exists only in the file). Identical to writeToFile().

Specified by:
write in interface Recorder
Specified by:
write in class AbstractDataSourceRecorder

writeEnd

public void writeEnd()
Writes any ending matter to the file. Used internally during a batch run to write the ending time of the entire batch. A model would not typically call this method.

Specified by:
writeEnd in interface Recorder
Specified by:
writeEnd in class AbstractDataSourceRecorder