public class ExactDoubleQuantileFinder extends PersistentObject implements DoubleQuantileFinder
Modifier and Type | Field and Description |
---|---|
DoubleArrayList |
buffer |
boolean |
isSorted |
Constructor and Description |
---|
ExactDoubleQuantileFinder()
Constructs an empty exact quantile finder.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double value)
Adds a value to the receiver.
|
void |
addAllOf(DoubleArrayList values)
Adds all values of the specified list to the receiver.
|
void |
addAllOfFromTo(DoubleArrayList values,
int from,
int to)
Adds the part of the specified list between indexes from
(inclusive) and to (inclusive) to the receiver.
|
void |
clear()
Removes all elements from the receiver.
|
Object |
clone()
Returns a deep copy of the receiver.
|
boolean |
contains(double element)
Returns whether the specified element is contained in the receiver.
|
boolean |
forEach(DoubleProcedure procedure)
Applies a procedure to each element of the receiver, if any.
|
long |
memory()
Returns the number of elements currently needed to store all contained
elements.
|
double |
phi(double element)
Returns how many percent of the elements contained in the receiver are
<= element.
|
DoubleArrayList |
quantileElements(DoubleArrayList phis)
Computes the specified quantile elements over the values previously
added.
|
long |
size()
Returns the number of elements currently contained in the receiver
(identical to the number of values added so far).
|
String |
toString()
Returns a String representation of the receiver.
|
long |
totalMemory()
Returns the number of elements currently needed to store all contained
elements.
|
public DoubleArrayList buffer
public boolean isSorted
public ExactDoubleQuantileFinder()
public void add(double value)
add
in interface DoubleQuantileFinder
value
- the value to add.public void addAllOf(DoubleArrayList values)
addAllOf
in interface DoubleQuantileFinder
values
- the list of which all values shall be added.public void addAllOfFromTo(DoubleArrayList values, int from, int to)
addAllOfFromTo
in interface DoubleQuantileFinder
values
- the list of which elements shall be added.from
- the index of the first element to be added (inclusive).to
- the index of the last element to be added (inclusive).public void clear()
clear
in interface DoubleQuantileFinder
public Object clone()
clone
in interface DoubleQuantileFinder
clone
in class PersistentObject
public boolean contains(double element)
public boolean forEach(DoubleProcedure procedure)
forEach
in interface DoubleQuantileFinder
procedure
- the procedure to be applied. Stops iteration if the procedure
returns false, otherwise continues.public long memory()
memory
in interface DoubleQuantileFinder
public double phi(double element)
phi
in interface DoubleQuantileFinder
element
- the element to search for.public DoubleArrayList quantileElements(DoubleArrayList phis)
quantileElements
in interface DoubleQuantileFinder
phis
- the quantiles for which elements are to be computed. Each phi
must be in the interval [0.0,1.0]. phis must be
sorted ascending.public long size()
size
in interface DoubleQuantileFinder
public String toString()
public long totalMemory()
totalMemory
in interface DoubleQuantileFinder
Jump to the Parallel Colt Homepage