|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.event.DefaultScapeListener
org.ascape.view.nonvis.NonGraphicView
org.ascape.view.nonvis.DataView
org.ascape.view.nonvis.DataOutputView
public class DataOutputView
A non-graphic view providing output of model data to a file. To use, (assuming you are collecting the statistics you are interested in, see Scape) just add this view to any scape, and set a file or data strem for it. Every period, statistic measurements will be written to the file or data strem. By default, all statistics are selected; get data selection to make different selections. If you would like to add more information to the period or run data, simply override the write.. methods. The rule here is that all fields must be preceeded by the '\t' character. (Of course, the first field should not be preceeded with a tab character, but ordinarily you will be calling the super method first anyway.) If you do override either writeRunData or writePeriodData, be sure to override writeRunHeader or writePeriodHeader as well.
DataView
,
SweepGroup
,
SweepControlView
,
Scape
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
EOLString
The character(s) to use for end-of-line. |
protected boolean |
periodHeadersWritten
The period headers written. |
protected int |
runCount
The number used for naming each consecutive run. |
protected java.io.DataOutputStream |
runDataStream
The data stream statistics are written to. |
protected java.io.File |
runFile
The run file. |
protected boolean |
runHeadersWritten
The run headers written. |
protected long |
startTime
The time the current run was started. |
protected boolean |
writeHeaders
The write headers. |
Fields inherited from class org.ascape.view.nonvis.DataView |
---|
dataSelection |
Fields inherited from class org.ascape.model.event.DefaultScapeListener |
---|
listeningToScape, name, scape |
Constructor Summary | |
---|---|
DataOutputView()
Constructs a data output view. |
|
DataOutputView(java.io.DataOutputStream runDataStream)
Constructs a data output view. |
|
DataOutputView(java.io.File file)
Constructs a data output view. |
Method Summary | |
---|---|
java.lang.String |
getEOLSeparator()
Returns the character(s) to be used to indicate an end-of-line; i.e. |
static int |
getNumCharsInFileName()
Returns the number of characters used for the sequential file name. |
java.io.DataOutputStream |
getPeriodDataStream()
Returns the data stream that period (iteration by iteration) output will be written to. |
java.io.File |
getPeriodFile()
Gets the period file. |
java.io.DataOutputStream |
getRunDataStream()
Returns the data stream that statistics output should go to. |
java.io.File |
getRunFile()
Returns the file that the run output will be written to. |
void |
scapeAdded(ScapeEvent scapeEvent)
Notifies the listener that the scape has added it. |
protected void |
scapeChanged()
Called for any model change that effects model state; i.e. |
void |
scapeClosing(ScapeEvent scapeEvent)
On close, closes any open files. |
void |
scapeDeserialized(ScapeEvent scapeEvent)
Method called once a model is deserialized. |
void |
scapeIterated(ScapeEvent scapeEvent)
On scape iterate, write period data. |
void |
scapeStarted(ScapeEvent scapeEvent)
On scape start, record the start time and wirte the file headers. |
void |
scapeStopped(ScapeEvent scapeEvent)
On scape stop, writes the run parameters to the file. |
static void |
setEOLSeparator(java.lang.String string)
Sets the character(s) to be used to indicate an end-of-line; i.e. |
static void |
setNumCharsInFileName(int _numCharsInFileName)
Sets the number of characters to use for the sequential file name. |
void |
setPeriodDataStream(java.io.DataOutputStream periodDataStream)
Defines the data stream that period (iteration by iteration) output will be written to. |
void |
setPeriodFile(java.io.File file)
Defines the file that period (iteration by iteeration) output will be written to. |
void |
setRunDataStream(java.io.DataOutputStream runDataStream)
Defines the data stream that run output will be written to. |
void |
setRunFile(java.io.File file)
Defines the file that run output will be written to. |
boolean |
stopCondition()
(Conveneince method.) If this method returns true, the current run will be stopped. |
java.lang.String |
toString()
Returns a short description of this view. |
void |
writePeriodData()
Writes the current period statistics to the data stream or file. |
void |
writePeriodHeader()
Writes the headers for the period statistics to the run data stream or file. |
void |
writeRunData()
Writes the current run parameters to the data stream or file. |
void |
writeRunHeader()
Writes the headers for the run parameters to the run data stream or file. |
Methods inherited from class org.ascape.view.nonvis.DataView |
---|
getDataSelection |
Methods inherited from class org.ascape.view.nonvis.NonGraphicView |
---|
isGraphic |
Methods inherited from class org.ascape.model.event.DefaultScapeListener |
---|
clone, environmentQuiting, getName, getScape, isLifeOfScape, isNotifyScapeAutomatically, notifyScapeUpdated, scapeInitialized, scapeNotification, scapeRemoved, scapeSetup, setName, setNotifyScapeAutomatically |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int runCount
public static java.lang.String EOLString
protected boolean writeHeaders
protected boolean runHeadersWritten
protected boolean periodHeadersWritten
protected long startTime
protected java.io.File runFile
protected transient java.io.DataOutputStream runDataStream
Constructor Detail |
---|
public DataOutputView()
public DataOutputView(java.io.DataOutputStream runDataStream)
runDataStream
- the stream to write the data topublic DataOutputView(java.io.File file) throws java.io.IOException
file
- the file to write the data to
java.io.IOException
- Signals that an I/O exception has occurred.
java.io.IOException
- if a file stream cannot be created from the fileMethod Detail |
---|
public java.io.DataOutputStream getRunDataStream()
public void setRunDataStream(java.io.DataOutputStream runDataStream)
runDataStream
- the stream to write the data topublic java.io.File getRunFile()
public void setRunFile(java.io.File file) throws java.io.IOException
file
- the file to write the data to
java.io.IOException
- Signals that an I/O exception has occurred.
java.io.IOException
- if a file stream cannot be created from the filepublic java.io.DataOutputStream getPeriodDataStream()
public void setPeriodDataStream(java.io.DataOutputStream periodDataStream)
periodDataStream
- the stream to write the data topublic java.io.File getPeriodFile()
public void setPeriodFile(java.io.File file) throws java.io.IOException
file
- the file to write the data to
java.io.IOException
- Signals that an I/O exception has occurred.
java.io.IOException
- if a file stream cannot be created from the filepublic void writePeriodHeader() throws java.io.IOException
java.io.IOException
- Signals that an I/O exception has occurred.public void writePeriodData() throws java.io.IOException
java.io.IOException
- Signals that an I/O exception has occurred.public void writeRunHeader() throws java.io.IOException
java.io.IOException
- Signals that an I/O exception has occurred.public void writeRunData() throws java.io.IOException
java.io.IOException
- Signals that an I/O exception has occurred.public boolean stopCondition()
public static int getNumCharsInFileName()
public static void setNumCharsInFileName(int _numCharsInFileName)
_numCharsInFileName
- the _num chars in file nameprotected void scapeChanged()
public void scapeIterated(ScapeEvent scapeEvent)
scapeIterated
in interface ScapeListener
scapeIterated
in class DefaultScapeListener
scapeEvent
- the scape eventpublic void scapeClosing(ScapeEvent scapeEvent)
scapeClosing
in interface ScapeListener
scapeClosing
in class DefaultScapeListener
scapeEvent
- the scape eventpublic void scapeStarted(ScapeEvent scapeEvent)
scapeStarted
in interface ScapeListener
scapeStarted
in class DefaultScapeListener
scapeEvent
- the scape eventpublic void scapeStopped(ScapeEvent scapeEvent)
scapeStopped
in interface ScapeListener
scapeStopped
in class DefaultScapeListener
scapeEvent
- the scape eventscapeStarted(org.ascape.model.event.ScapeEvent)
,
scapeStopped(org.ascape.model.event.ScapeEvent)
public void scapeDeserialized(ScapeEvent scapeEvent)
scapeDeserialized
in interface ScapeListener
scapeDeserialized
in class DefaultScapeListener
scapeEvent
- the scape eventpublic void scapeAdded(ScapeEvent scapeEvent) throws java.util.TooManyListenersException
scapeAdded
in interface ScapeListener
scapeAdded
in class DataView
scapeEvent
- the scape added notification event
java.util.TooManyListenersException
- the too many listeners exception
java.util.TooManyListenersException
- on attempt to add this listener to another scape when one
has already been assignedpublic java.lang.String toString()
DefaultScapeListener
toString
in class DefaultScapeListener
public java.lang.String getEOLSeparator()
public static void setEOLSeparator(java.lang.String string)
string
- the string
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |