|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectreport.Report
public abstract class Report
Abstract superclass for all reports. All settings defined in this class
can be used for all Report classes. Some reports don't implement intervalled
reports (INTERVAL_SETTING
) and will ignore that setting. Most of
the reports implement warm up feature (WARMUP_S
) but the
implementations are always report specific.
Field Summary | |
---|---|
static int |
DEF_PRECISION
Default precision of formatted double values |
static java.lang.String |
INTERVAL_SETTING
The interval (simulated seconds) of creating new settings files -setting id ("interval") |
static java.lang.String |
INTERVALLED_FORMAT
Suffix for reports that are created on n second intervals |
static java.lang.String |
NAN
String value for values that could not be calculated |
protected java.io.PrintWriter |
out
The print writer used to write output. |
static java.lang.String |
OUT_SUFFIX
Suffix of report files without explicit output |
static java.lang.String |
OUTPUT_SETTING
The output file path of the report -setting id ("output") |
static java.lang.String |
PRECISION_SETTING
Precision of formatted double values - setting id ("precision"). |
static java.lang.String |
REPORT_NS
Name space of the settings that are common to all reports ("Report"). |
static java.lang.String |
REPORTDIR_SETTING
The default output directory of reports (can be overridden per report with OUTPUT_SETTING ) -setting id ("Report.reportDir") |
static java.lang.String |
WARMUP_S
Warm up period -setting id ("warmup"). |
protected java.util.Set<java.lang.String> |
warmupIDs
|
protected int |
warmupTime
|
Constructor Summary | |
---|---|
Report()
Constructor. |
Method Summary | |
---|---|
protected void |
addWarmupID(java.lang.String id)
Adds a new ID to the warm up ID set |
void |
done()
Called when the simulation is done, user requested premature termination or intervalled report generating decided that it's time for the next report. |
protected java.lang.String |
format(double value)
Formats a double value according to current precision setting (see PRECISION_SETTING ) and returns it in a string. |
java.lang.String |
getAverage(java.util.List<java.lang.Double> values)
Returns the average of double values stored in a List or "NaN" for empty lists. |
java.lang.String |
getIntAverage(java.util.List<java.lang.Integer> values)
Returns the average of integer values stored in a List |
int |
getIntMedian(java.util.List<java.lang.Integer> values)
Returns the median of integer values stored in a List |
java.lang.String |
getMedian(java.util.List<java.lang.Double> values)
Returns the median of double values stored in a List |
protected java.lang.String |
getScenarioName()
Returns the name of the scenario as read from the settings |
protected Settings |
getSettings()
Returns a Settings object initialized for the report class' name space that uses "Report" as the secondary name space. |
protected double |
getSimTime()
Returns the current simulation time from the SimClock |
java.lang.String |
getVariance(java.util.List<java.lang.Double> values)
Returns the variance of the values in the List. |
protected void |
init()
Initializes the report output. |
protected boolean |
isWarmup()
Returns true if the warm up period is still ongoing (simTime < warmup) |
protected boolean |
isWarmupID(java.lang.String id)
Returns true if the given ID is in the warm up ID set |
protected void |
newEvent()
This method should be called before every new (complete) event the report logs. |
protected void |
removeWarmupID(java.lang.String id)
Removes a warm up ID from the warm up ID set |
protected void |
setPrefix(java.lang.String txt)
Sets a prefix that will be inserted before every line in the report |
protected void |
write(java.lang.String txt)
Writes a line to report using defined prefix and out writer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String REPORT_NS
public static final java.lang.String INTERVAL_SETTING
public static final java.lang.String OUTPUT_SETTING
public static final java.lang.String PRECISION_SETTING
public static final int DEF_PRECISION
public static final java.lang.String REPORTDIR_SETTING
OUTPUT_SETTING
) -setting id ("Report.reportDir")
public static final java.lang.String WARMUP_S
public static final java.lang.String OUT_SUFFIX
public static final java.lang.String INTERVALLED_FORMAT
protected java.io.PrintWriter out
write(String)
public static final java.lang.String NAN
protected int warmupTime
protected java.util.Set<java.lang.String> warmupIDs
Constructor Detail |
---|
public Report()
Method Detail |
---|
protected void init()
protected void newEvent()
protected void write(java.lang.String txt)
out
writer.
txt
- Line to writesetPrefix(String)
protected java.lang.String format(double value)
PRECISION_SETTING
) and returns it in a string.
value
- The value to format
protected void setPrefix(java.lang.String txt)
txt
- Text to use as the prefixprotected java.lang.String getScenarioName()
protected double getSimTime()
protected boolean isWarmup()
protected void addWarmupID(java.lang.String id)
id
- The IDprotected void removeWarmupID(java.lang.String id)
id
- The ID to removeprotected boolean isWarmupID(java.lang.String id)
id
- The ID
protected Settings getSettings()
public void done()
public java.lang.String getAverage(java.util.List<java.lang.Double> values)
values
- The list of double values
public java.lang.String getIntAverage(java.util.List<java.lang.Integer> values)
values
- The list of values
public java.lang.String getMedian(java.util.List<java.lang.Double> values)
values
- The list of double values
public int getIntMedian(java.util.List<java.lang.Integer> values)
values
- The list of values
public java.lang.String getVariance(java.util.List<java.lang.Double> values)
values
- The list of values
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |