Package cern.jet.stat.quantile
Class DoubleBuffer
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.jet.stat.quantile.Buffer
-
- cern.jet.stat.quantile.DoubleBuffer
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
class DoubleBuffer extends Buffer
A buffer holding double elements; internally used for computing approximate quantiles.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
isSorted
protected DoubleArrayList
values
-
Fields inherited from class cern.jet.stat.quantile.Buffer
isAllocated, k, level, weight
-
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
-
-
Constructor Summary
Constructors Constructor Description DoubleBuffer(int k)
This method was created in VisualAge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double value)
Adds a value to the receiver.void
addAllOfFromTo(DoubleArrayList elements, int from, int to)
Adds a value to the receiver.protected void
allocate()
Allocates the receiver.void
clear()
Clears the receiver.java.lang.Object
clone()
Returns a deep copy of the receiver.boolean
contains(double element)
Returns whether the specified element is contained in the receiver.boolean
isEmpty()
Returns whether the receiver is empty.boolean
isFull()
Returns whether the receiver is empty.int
memory()
Returns the number of elements currently needed to store all contained elements.double
rank(double element)
Returns the rank of a given element within the sorted sequence of the receiver.int
size()
Returns the number of elements contained in the receiver.void
sort()
Sorts the receiver.java.lang.String
toString()
Returns a String representation of the receiver.
-
-
-
Field Detail
-
values
protected DoubleArrayList values
-
isSorted
protected boolean isSorted
-
-
Method Detail
-
add
public void add(double value)
Adds a value to the receiver.
-
addAllOfFromTo
public void addAllOfFromTo(DoubleArrayList elements, int from, int to)
Adds a value to the receiver.
-
allocate
protected void allocate()
Allocates the receiver.
-
clone
public java.lang.Object clone()
Returns a deep copy of the receiver.- Overrides:
clone
in classPersistentObject
- Returns:
- a deep copy of the receiver.
-
contains
public boolean contains(double element)
Returns whether the specified element is contained in the receiver.
-
isEmpty
public boolean isEmpty()
Returns whether the receiver is empty.
-
isFull
public boolean isFull()
Returns whether the receiver is empty.
-
memory
public int memory()
Returns the number of elements currently needed to store all contained elements. This number usually differs from the results of method size(), according to the underlying algorithm.
-
rank
public double rank(double element)
Returns the rank of a given element within the sorted sequence of the receiver. A rank is the number of elements <= element. Ranks are of the form {1,2,...size()}. If no element is <= element, then the rank is zero. If the element lies in between two contained elements, then uses linear interpolation.- Parameters:
list
- cern.colt.list.DoubleArrayListelement
- the element to search for- Returns:
- the rank of the element.
-
size
public int size()
Returns the number of elements contained in the receiver.
-
toString
public java.lang.String toString()
Returns a String representation of the receiver.- Overrides:
toString
in classjava.lang.Object
-
-