uchicago.src.sim.analysis
Class DataFileHeader

java.lang.Object
  extended by uchicago.src.sim.analysis.DataFileHeader

public class DataFileHeader
extends java.lang.Object

Given a model and this will create the appropriate header for any data file. For batch runs, constant parameters will be in one header (the true header), and dynamic parameters will be in a block header and reflect the parameter value at that time. Also, the user has an option to provide their own custom header. Note: the actual parameter values in the file header are created via the call to getFileHeader(). For DataRecorder's this call is made in the DataRecorder's constructor. Consequently, any changes to model parameter's made after this call are not reflected in the file header.


Field Summary
static java.lang.String WRITE_HEADER
           
 
Constructor Summary
DataFileHeader()
          This should only be used for testing various Recorders that use DataFileHeader but don't need to create a model.
DataFileHeader(SimModel model)
           
DataFileHeader(java.lang.String modelHeader)
          Constructor which allows users to specify their own custom header.
 
Method Summary
 void addHeaderComment(java.lang.String comment)
          Prepends a comment to the usual file header.
 boolean doWriteHeader(java.lang.String fileName)
          Should the header be written to the specified file during this run?
 java.lang.String getBlockHeader()
          Gets the block header.
 java.lang.String getBlockHeaderAsComments()
          Gets the block header.
 java.util.Hashtable getDynParamMethod()
           
 java.lang.String getFileHeader()
          Gets the true file header.
 java.lang.Object getPersistentObj(java.lang.Object key)
          Gets a persistent object.
 boolean isBatch()
          Is this DataFileHeader part of a batch run.
 void putPersistentObj(java.lang.Object key, java.lang.Object val)
          Puts an object in the persistent store.
 void setWriteHeader(java.lang.String fileName, boolean val)
          Sets whether the header should be written to the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITE_HEADER

public static final java.lang.String WRITE_HEADER
See Also:
Constant Field Values
Constructor Detail

DataFileHeader

public DataFileHeader()
This should only be used for testing various Recorders that use DataFileHeader but don't need to create a model.


DataFileHeader

public DataFileHeader(java.lang.String modelHeader)
Constructor which allows users to specify their own custom header.

Parameters:
modelHeader - - user provided header.

DataFileHeader

public DataFileHeader(SimModel model)
Method Detail

addHeaderComment

public void addHeaderComment(java.lang.String comment)
Prepends a comment to the usual file header.

Parameters:
comment - the comment to prepend

getFileHeader

public java.lang.String getFileHeader()
Gets the true file header. This includes all the constant model parameters. For a non-batch run, this is just all the model parameters at the time the file is first written.


getBlockHeader

public java.lang.String getBlockHeader()
Gets the block header. This is all the dynamic parameters and their values. For a non batch run, this is an empty string. For a batch run, this is the current run number, followed by the dynamic parameters and their values. One parameter per line.


getBlockHeaderAsComments

public java.lang.String getBlockHeaderAsComments()
Gets the block header. This is all the dynamic parameters and their values. For a non batch run, this is an empty string. For a batch run, this is the current run number, followed by the dynamic parameters and their values. One parameter per line, prepended by a "#"


isBatch

public boolean isBatch()
Is this DataFileHeader part of a batch run.


doWriteHeader

public boolean doWriteHeader(java.lang.String fileName)
Should the header be written to the specified file during this run? Recorder objects can query their DataFileHeaders to see if the header should be written. The header will always be written during a non-batch run where one run is recorded per file. For a batch run where all the runs are written to a single file the header is only written once.

Parameters:
fileName - the fileName for this header.

setWriteHeader

public void setWriteHeader(java.lang.String fileName,
                           boolean val)
Sets whether the header should be written to the file.

Parameters:
fileName - the fileName associated with this header
val - whether the header should be written to the specified file.
See Also:
doWriteHeader(String)

putPersistentObj

public void putPersistentObj(java.lang.Object key,
                             java.lang.Object val)
Puts an object in the persistent store. The object will then persist over the course of several runs (i.e. beyond the life of this DataFileHeader).

Parameters:
key - the key for the persistent object
val - the object to persist.

getPersistentObj

public java.lang.Object getPersistentObj(java.lang.Object key)
Gets a persistent object.

Parameters:
key - the key for this object to get

getDynParamMethod

public java.util.Hashtable getDynParamMethod()