|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.grandcentral.appstats.StatCalculator | +--com.grandcentral.appstats.calculators.HistogramCalculator
A calculator to generate a histogram of the stat data received. You must intialize this class either with the buckets into which you want the stat data grouped, or a bucket size to allow the class to auto-generate the histogram. Note that auto-generated histograms are implement with Maps, and so are much less space and speed efficient than the array based counterparts.
The author would like to thank Genesis for "Trick of the Tail," which was playing for most of his contributions to this package
Field Summary | |
static java.lang.String |
SUFFIX_DHIST_PFX
|
static java.lang.String |
SUFFIX_HIST_EXTRA
|
static java.lang.String |
SUFFIX_LHIST_PFX
|
static java.lang.String |
SUFFIX_OHIST_PFX
|
Fields inherited from class com.grandcentral.appstats.StatCalculator |
m_parent |
Constructor Summary | |
HistogramCalculator()
|
Method Summary | |
void |
calculate(Task destination,
Stat newSample,
java.lang.String prependName)
|
void |
clear()
resets this object to clean state |
java.util.List |
getSuffices()
|
int |
getType()
|
protected long |
incrBucketCounter(Task destination,
java.lang.String prefix,
double bucket)
|
protected long |
incrBucketCounter(Task destination,
java.lang.String prefix,
long bucket)
|
protected long |
incrBucketCounter(Task destination,
java.lang.String prefix,
java.lang.Object bucket)
|
protected long |
incrCounter(Task destination,
java.lang.String statName)
|
void |
removeType(int dataType)
removes the type from this calculator and deletes any corresponding values |
void |
setAutoGenBuckets(boolean val)
convenience method to instuct this class to auto generate all buckets (if the user hasn't already assigned bucket arrays, that is) with bucket size = 1 |
void |
setAutoGenObjectBuckets(boolean val)
if there are no object buckets set for this instance, signals this class that Object buckets should be automatically generated. |
void |
setBuckets(double[] buckets)
set the buckets for this calculator to use for creating the histogram. |
void |
setBuckets(long[] buckets)
set the buckets for this calculator to use for creating the histogram. |
void |
setBuckets(java.lang.Object[] buckets)
set the buckets for this calculator to use for creating the histogram. |
void |
setBucketSize(double bucketSize)
if there are no double buckets set for this instance, if bucketSize>0, signals this class that double buckets should be automatically generated. |
void |
setBucketSize(long bucketSize)
if there are no long buckets set for this instance, if bucketSize>0, signals this class that long buckets should be automatically generated. |
void |
setObjectComparator(java.util.Comparator c)
sets the comparator for Arrays.binarySearch algorith when locating Objects in the bucket array |
Methods inherited from class com.grandcentral.appstats.StatCalculator |
getParent, getTopMostParent, setParent |
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 SUFFIX_LHIST_PFX
public static final java.lang.String SUFFIX_DHIST_PFX
public static final java.lang.String SUFFIX_OHIST_PFX
public static final java.lang.String SUFFIX_HIST_EXTRA
Constructor Detail |
public HistogramCalculator()
Method Detail |
public void setBuckets(long[] buckets)
buckets
- a sorted array of bucket values, or null to unset previous bucketspublic void setBuckets(double[] buckets)
buckets
- a sorted array of bucket values, or null to unset previous bucketspublic void setBuckets(java.lang.Object[] buckets)
buckets
- a sorted array of bucket values, or null to unset previous bucketspublic void setObjectComparator(java.util.Comparator c)
public void setBucketSize(long bucketSize)
public void setBucketSize(double bucketSize)
public void setAutoGenObjectBuckets(boolean val)
public void setAutoGenBuckets(boolean val)
public int getType()
public void removeType(int dataType)
public java.util.List getSuffices()
getSuffices
in class StatCalculator
UnsupportedOperationException()
- -- this method may go away from the interfacepublic void calculate(Task destination, Stat newSample, java.lang.String prependName) throws DatatypeMismatchException
calculate
in class StatCalculator
protected long incrBucketCounter(Task destination, java.lang.String prefix, long bucket)
protected long incrBucketCounter(Task destination, java.lang.String prefix, double bucket)
protected long incrBucketCounter(Task destination, java.lang.String prefix, java.lang.Object bucket)
protected long incrCounter(Task destination, java.lang.String statName)
public void clear()
clear
in class StatCalculator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |