|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Utility.Tally | +--Utility.WeightedTally
The WeightedTally class is for weighted tallying of values. It extends
the Tally class.
Unfortunately, SimKit does not (yet) give the programmer access to
either the current event or the current simulation time. This means
that there is no method of providing a time weighted tally where the
time weights are automatically calculated.
Tally
Field Summary | |
protected java.util.Vector |
fWeights
|
Fields inherited from class Utility.Tally |
fCount, fDataPoints, fMax, fMin, fName, fSum, fSumSq, seperator, STORE_POINTS, SUMMARY_ONLY, WITH_HEADER, WO_HEADER |
Constructor Summary | |
WeightedTally()
|
|
WeightedTally(java.lang.String name,
boolean storePoints)
Initialize the object, give the Tally a name. |
Method Summary | |
double |
average()
Report the weighted mean of the data points. |
void |
outputPoints(java.io.PrintStream out,
boolean withHeader)
Output all the data points stored in the Tally object. |
void |
outputSummary(java.io.PrintStream out,
boolean withHeader)
Output the summary statistics that were collected for the WeightedTally. |
void |
reset()
Remove all data points from the Tally. |
double |
stdDev()
Report the standard deviation of the data points. |
double |
sumWeights()
|
void |
update(double x)
Add a data point to the tally. |
void |
update(double x,
double weight)
Updates the statistics with the weighted new value. |
void |
updateBatch(Tally data)
Update Tally with batch data. |
double |
variance()
Report the variance of the data points. |
Methods inherited from class Utility.Tally |
count, isStoringPoints, max, min, sum, sumSq |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector fWeights
Constructor Detail |
public WeightedTally()
public WeightedTally(java.lang.String name, boolean storePoints)
name
- The name of the Tally object. This will
be used with the output functions.storePoints
- Whether or not the Tally should record
all individiual data points. Tally.STORE_POINTS means
the object should store data points, and Tally.SUMMARY_ONLY
means the object should only compute summary statistics.Method Detail |
public void reset()
Tally
reset
in class Tally
public void update(double x)
update
in class Tally
x
- The value to add to the tally.public void update(double x, double weight)
x
- The value to add to statisticsweight
- The weight to use for this valuepublic void updateBatch(Tally data)
updateBatch
in class Tally
data
- The Tally whose data will be added to this
tally. For now, this should be an instance of
WeightedTally. Later on, other types of Tallies may
be supported.
java.lang.RuntimeException
- A RuntimeException is thrown
if the Tally object data is not an instance of
WeightedTally.public double average()
average
in class Tally
public double variance()
variance
in class Tally
public double sumWeights()
public double stdDev()
stdDev
in class Tally
public void outputPoints(java.io.PrintStream out, boolean withHeader)
outputPoints
in class Tally
out
- The PrintStream to send the output to.withHeader
- true to print a header, false to skip
the header. Tally.WITH_HEADER and Tally.WO_HEADER can
be used instead of true and false.
java.lang.RuntimeException
- A RuntimeException is thrown
if the Tally object is not currently storing data points.public void outputSummary(java.io.PrintStream out, boolean withHeader)
outputSummary
in class Tally
out
- The PrintStream to send the output to.withHeader
- true to print a header, false to skip
the header. Tally.WITH_HEADER and Tally.WO_HEADER can
be used instead of true and false.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |