public class DoublePercentileAggregatorFunction extends Object implements Function<List<Double>,Double>
AbstractListBackedAggregator
which retrieves the percentile value for a
given percentile. The percentile rank/index for a value P can be obtained
using formula: n = round((P / 100) * N + 0.5)
where N is the
number of items in a list.Constructor and Description |
---|
DoublePercentileAggregatorFunction(double percentile)
|
DoublePercentileAggregatorFunction(double percentile,
boolean useCopy)
Initializes the function with the given percentile and decides whether
the function will modify the original list or not.
|
Modifier and Type | Method and Description |
---|---|
Double |
evaluate(List<Double> data)
Traverses the list and computes the percentile.
|
double |
getPercentile()
Getter for
percentile . |
boolean |
isUseCopy()
Does this instance modify the passed in list or not?
|
String |
toString() |
public DoublePercentileAggregatorFunction(double percentile)
percentile
- Percentile this function will return the value forpublic DoublePercentileAggregatorFunction(double percentile, boolean useCopy)
percentile
- Percentile this function will return the value foruseCopy
- If set to true, the original list will not be modified and
will contain the data in sorted order, if false, this instance
will operate on a copy of the listpublic Double evaluate(List<Double> data)
isUseCopy()
.public double getPercentile()
percentile
.public boolean isUseCopy()
DoublePercentileAggregatorFunction(double,
boolean)
Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.