public final class PercentileBuckets extends Object
| Modifier and Type | Method and Description |
|---|---|
static long[] |
asArray()
Returns a copy of the bucket values array.
|
static long |
bucket(long v)
Returns the value of the bucket that should be used for
v. |
static long |
get(int i)
Return the value of the bucket at index
i. |
static int |
indexOf(long v)
Returns the value the index of the bucket that should be used for
v. |
static int |
length()
Returns the number of buckets.
|
static <T> T[] |
map(Class<T> c,
Function<Long,T> f)
Map the bucket values to a new array of a different type.
|
static double |
percentile(long[] counts,
double p)
Compute a percentile based on the counts for the buckets.
|
static void |
percentiles(long[] counts,
double[] pcts,
double[] results)
Compute a set of percentiles based on the counts for the buckets.
|
public static long[] asArray()
public static <T> T[] map(Class<T> c, Function<Long,T> f)
public static long get(int i)
i.public static int length()
public static int indexOf(long v)
v. The bucket value
can be retrieved using get(int).public static long bucket(long v)
v.public static void percentiles(long[] counts,
double[] pcts,
double[] results)
counts - Counts for each of the buckets. The size must be the same as length() and the
positions must correspond to the positions of the bucket values.pcts - Array with the requested percentile values. The length must be at least 1 and the
array should be sorted. Each value, v, should adhere to 0.0 <= v <= 100.0.results - The calculated percentile values will be written to the results array. It should have the
same length as pcts.public static double percentile(long[] counts,
double p)
counts - Counts for each of the buckets. The size must be the same as length() and the
positions must correspond to the positions of the bucket values.p - Percentile to compute, the value should be 0.0 <= p <= 100.0.