|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.util.profiling.DataItem
avrora.util.profiling.MinMaxMean
avrora.util.profiling.Distribution
This class keeps track of the min, max, and median of a stream of integers, as well as the distribution of each. The distribution aids in computing the median without having to store the sequence of integers.
| Field Summary | |
int[] |
distrib
The distrib field stores an array that records the number of
occurrences for each value in the distribution. |
int |
distribMin
The distribMin field stores the value corresponding to index
0 in the distrib array. |
protected java.lang.String |
distribname
The distribname field stores the string that should be reported
as the name of the distribution, e.g. |
int |
median
The median field stores the median value of the distribution.
|
| Fields inherited from class avrora.util.profiling.MinMaxMean |
accumulation, countMaximum, countMinimum, cumulname, mean, observedMaximum, observedMinimum, someData, total, totalname |
| Fields inherited from class avrora.util.profiling.DataItem |
name |
| Constructor Summary | |
Distribution(java.lang.String name)
This is the public constructor. |
|
Distribution(java.lang.String newname,
java.lang.String tn,
java.lang.String cn)
Public constructor initializes the statistics for a sequence of integers. |
|
Distribution(java.lang.String newname,
java.lang.String tn,
java.lang.String cn,
java.lang.String dn)
Public constructor initializes the statistics for a sequence of integers. |
|
| Method Summary | |
void |
expandInterval(int min,
int max)
|
protected void |
incrementDistrib(int value)
Increment the number of occurrences for a particular integer. |
MinMaxMean |
merge(MinMaxMean m)
Merge this statistical information with another. |
protected void |
printDistribution(int base,
int[] data)
Print the distribution using stars |
void |
processData()
process the data so far and update internal statistics. |
protected void |
recomputeMaxDistrib(int newMax)
Resize the occurrence table with a new maximum value. |
protected void |
recomputeMinDistrib(int newMin)
Resize the occurences table with the given new minimum. |
void |
record(int value)
Record the next value and update internal state. |
void |
textReport()
Generate a textual report of the data gathered. |
| Methods inherited from class avrora.util.profiling.MinMaxMean |
hasData, toString |
| Methods inherited from class avrora.util.profiling.DataItem |
getName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int[] distrib
distrib field stores an array that records the number of
occurrences for each value in the distribution. The distribMin
field stores the value which corresponds to index 0 in the array. Therefore,
distrib[myval - distribMin] contains the count for myval,
provided that the array is large enough. Values outside the array have
have a count of zero.
public int median
median field stores the median value of the distribution.
This field is not computed until the processData() method has
been called after data has been collected.
public int distribMin
distribMin field stores the value corresponding to index
0 in the distrib array.
protected java.lang.String distribname
distribname field stores the string that should be reported
as the name of the distribution, e.g. "Distribution of hashcodes". When this
string is non-null, a textual table of the distribution will be printed to
the terminal when the textReport() method is called.
| Constructor Detail |
public Distribution(java.lang.String name)
public Distribution(java.lang.String newname,
java.lang.String tn,
java.lang.String cn)
public Distribution(java.lang.String newname,
java.lang.String tn,
java.lang.String cn,
java.lang.String dn)
| Method Detail |
public void record(int value)
record in class MinMaxMeanpublic void textReport()
textReport in class MinMaxMean
protected void printDistribution(int base,
int[] data)
public void expandInterval(int min,
int max)
protected void incrementDistrib(int value)
protected void recomputeMaxDistrib(int newMax)
protected void recomputeMinDistrib(int newMin)
public void processData()
MinMaxMean
processData in class MinMaxMeanpublic MinMaxMean merge(MinMaxMean m)
merge in class MinMaxMean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||