|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jagg.Aggregator
net.sf.jagg.TwoPropAggregator
net.sf.jagg.PercentileAggregator
public class PercentileAggregator
This class allows represents the "percentile" aggregator over numeric values. The first property is the desired percentile, between 0 and 1 inclusive, and the second property denotes the desired sort order and return value.
Field Summary |
---|
Fields inherited from class net.sf.jagg.Aggregator |
---|
PROP_SELF |
Constructor Summary | |
---|---|
PercentileAggregator(double percentile,
java.lang.String property)
Constructs a PercentileAggregator that operates on the specified
properties. |
|
PercentileAggregator(java.lang.String properties)
Constructs a PercentileAggregator on the specified
properties, in the format: percentile, property . |
Method Summary | |
---|---|
void |
init()
Initialize an internal list to empty. |
void |
iterate(java.lang.Object value)
Make sure the second property's value is not null, then add the entire Object to an internal list. |
void |
merge(Aggregator agg)
Merge the given Aggregator into this one by adding the
contents of the given Aggregator's internal list into this
Aggregator's internal list. |
PercentileAggregator |
replicate()
Returns an uninitialized copy of this Aggregator object,
with the same property(ies) to analyze. |
protected void |
setProperty(java.lang.String property)
Expects that the first "property" given is the actual desired percentile, from 0 to 1 inclusive. |
java.lang.Double |
terminate()
Return the value among the values in the specified property that matches the given percentile value, with the following algorithm: Sort the internal list with respect to the second property, using Collections.sort , using a
PropertiesComparator that compares values based on the
second property given. |
DoubleDouble |
terminateDoubleDouble()
Return the result as a DoubleDouble . |
Methods inherited from class net.sf.jagg.TwoPropAggregator |
---|
getProperty2, toString |
Methods inherited from class net.sf.jagg.Aggregator |
---|
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, setInUse |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PercentileAggregator(java.lang.String properties)
PercentileAggregator
on the specified
properties, in the format: percentile, property
.
properties
- A specification string in the format:
percentile, property
.public PercentileAggregator(double percentile, java.lang.String property)
PercentileAggregator
that operates on the specified
properties.
percentile
- The percentile value, between zero and one.property
- Determine the percentile of this property.Method Detail |
---|
public PercentileAggregator replicate()
Aggregator
object,
with the same property(ies) to analyze.
replicate
in class Aggregator
Aggregator
object.protected void setProperty(java.lang.String property)
setProperty
in class TwoPropAggregator
property
- The property string, with one comma separating two actual
properties.
java.lang.NumberFormatException
- If the first property, the percentile, is
not a number.
java.lang.IllegalArgumentException
- If the first property, the percentile,
is not between 0 and 1, inclusive.Aggregator.getProperty()
,
TwoPropAggregator.getProperty2()
public void init()
init
in class Aggregator
public void iterate(java.lang.Object value)
Object
to an internal list.
iterate
in class Aggregator
value
- The value to aggregate.Aggregator.getValueFromProperty(java.lang.Object, java.lang.String)
public void merge(Aggregator agg)
Aggregator
into this one by adding the
contents of the given Aggregator's
internal list into this
Aggregator's
internal list.
merge
in class Aggregator
agg
- The Aggregator
to merge into this one.public java.lang.Double terminate()
Collections.sort
, using a
PropertiesComparator
that compares values based on the
second property given.
terminate
in class Aggregator
Double
that best matches the given
percentile value, or null
if no items were processed.Collections.sort(java.util.List)
,
PropertiesComparator
public DoubleDouble terminateDoubleDouble()
DoubleDouble
. This is used mainly
when other Aggregators
that use this result must maintain a
high precision.
terminateDoubleDouble
in class Aggregator
DoubleDouble
that best matches the given
percentile value, or NaN
if no values have been
accumulated.DoubleDouble
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |