public class DataLogger extends DataProcessor
Modifier and Type | Class | Description |
---|---|---|
static interface |
DataLogger.DataWriter |
Interface for a DataSink that actually writes data to a file
|
Modifier and Type | Field | Description |
---|---|---|
protected java.lang.String |
fileNameSuffix |
|
protected java.io.FileWriter |
fileWriter |
dataInfo, dataSink, tag
Constructor | Description |
---|---|
DataLogger() |
Modifier and Type | Method | Description |
---|---|---|
void |
cleanUp() |
|
void |
closeFile() |
|
protected java.lang.String |
defaultFileName() |
|
java.lang.String |
getFileName() |
|
int |
getWriteInterval() |
|
IDataSource |
getWriteOnFinishDataSource() |
|
boolean |
isAppending() |
|
boolean |
isCloseFileEachTime() |
|
boolean |
isSameFileEachTime() |
|
boolean |
isWriteOnInterval() |
|
IData |
processData(IData data) |
Gives data to DataSink for writing
|
IDataInfo |
processDataInfo(IDataInfo newDataInfo) |
Informs this DataProcessor of the DataInfo for the Data it will be
processing.
|
void |
putData(IData data) |
Performs the open/write/close file actions in accordance with the
settings of the Logger.
|
void |
setAppending(boolean appending) |
Overwrite or attach the data to the file.
|
void |
setCloseFileEachTime(boolean closeFileEachTime) |
Close the file and open a new one at each time INTERVAL.
|
void |
setDataSink(IDataSink dataSink) |
Sets the sink receiving the data.
|
void |
setFileName(java.lang.String fileName) |
Define the name of the output file.
|
void |
setSameFileEachTime(boolean sameFileEachTime) |
Write to the same file at each time INTERVAL, and close the file at the
end of the simulation.
|
void |
setWriteInterval(int newWriteInterval) |
Define how many number of interval events received between writings to
file.
|
void |
setWriteOnFinish(IDataSource newWriteOnFinishSource) |
|
void |
setWriteOnInterval(boolean writeOnInterval) |
getDataInfo, getDataSink, getTag, putDataInfo
protected transient java.io.FileWriter fileWriter
protected java.lang.String fileNameSuffix
public void setDataSink(IDataSink dataSink)
DataProcessor
setDataSink
in interface DataPipe
setDataSink
in class DataProcessor
dataSink
- The data sink to set.public IData processData(IData data)
processData
in class DataProcessor
data
- the Data for processingpublic IDataInfo processDataInfo(IDataInfo newDataInfo)
DataProcessor
processDataInfo
in class DataProcessor
newDataInfo
- the DataInfo of the Data that will be input to this
DataProcessorpublic void cleanUp()
public void putData(IData data)
putData
in interface IDataSink
putData
in class DataProcessor
public int getWriteInterval()
public void setWriteInterval(int newWriteInterval)
protected java.lang.String defaultFileName()
public void closeFile()
public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
public boolean isAppending()
public void setAppending(boolean appending)
public boolean isSameFileEachTime()
public void setSameFileEachTime(boolean sameFileEachTime)
public boolean isCloseFileEachTime()
public void setCloseFileEachTime(boolean closeFileEachTime)
public IDataSource getWriteOnFinishDataSource()
public void setWriteOnFinish(IDataSource newWriteOnFinishSource)
newWriteOnFinishSource
- The writeOnFinish to set.public boolean isWriteOnInterval()
public void setWriteOnInterval(boolean writeOnInterval)
writeOnInterval
- The writeOnInterval to set.