Package com.tdunning.math.stats
Class AVLGroupTree
- java.lang.Object
-
- java.util.AbstractCollection<Centroid>
-
- com.tdunning.math.stats.AVLGroupTree
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
aggregatedCounts
private double
centroid
private double[]
centroids
private int
count
private int[]
counts
private java.util.List<java.lang.Double>
data
private java.util.List<java.lang.Double>[]
datas
private IntAVLTree
tree
-
Constructor Summary
Constructors Constructor Description AVLGroupTree()
AVLGroupTree(boolean record)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double centroid, int count, java.util.List<java.lang.Double> data)
Add the provided centroid to the tree.boolean
add(Centroid centroid)
(package private) void
checkAggregates()
private void
checkAggregates(int node)
(package private) void
checkBalance()
int
count(int node)
Return the count for the provided node.java.util.List<java.lang.Double>
data(int node)
Return the data for the provided node.int
first()
Return the least node in the tree.int
floor(double centroid)
Return the last node whose centroid is less thancentroid
.int
floorSum(long sum)
Return the last node so that the sum of counts of nodes that are before it is less than or equal tosum
.long
headSum(int node)
Compute the number of elements and sum of counts for every entry that is strictly beforenode
.java.util.Iterator<Centroid>
iterator()
private java.util.Iterator<Centroid>
iterator(int startNode)
double
mean(int node)
Return the mean for the provided node.int
next(int node)
Return the next node.int
prev(int node)
Return the previous node.int
size()
Return the number of centroids in the tree.int
sum()
Return the total count of points that have been added to the tree.void
update(int node, double centroid, int count, java.util.List<java.lang.Double> data)
Update values associated with a node, readjusting the tree if necessary.-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
centroid
private double centroid
-
count
private int count
-
data
private java.util.List<java.lang.Double> data
-
centroids
private double[] centroids
-
counts
private int[] counts
-
datas
private java.util.List<java.lang.Double>[] datas
-
aggregatedCounts
private int[] aggregatedCounts
-
tree
private final IntAVLTree tree
-
-
Method Detail
-
size
public int size()
Return the number of centroids in the tree.
-
prev
public int prev(int node)
Return the previous node.
-
next
public int next(int node)
Return the next node.
-
mean
public double mean(int node)
Return the mean for the provided node.
-
count
public int count(int node)
Return the count for the provided node.
-
data
public java.util.List<java.lang.Double> data(int node)
Return the data for the provided node.
-
add
public void add(double centroid, int count, java.util.List<java.lang.Double> data)
Add the provided centroid to the tree.
-
add
public boolean add(Centroid centroid)
-
update
public void update(int node, double centroid, int count, java.util.List<java.lang.Double> data)
Update values associated with a node, readjusting the tree if necessary.
-
floor
public int floor(double centroid)
Return the last node whose centroid is less thancentroid
.
-
floorSum
public int floorSum(long sum)
Return the last node so that the sum of counts of nodes that are before it is less than or equal tosum
.
-
first
public int first()
Return the least node in the tree.
-
headSum
public long headSum(int node)
Compute the number of elements and sum of counts for every entry that is strictly beforenode
.
-
iterator
public java.util.Iterator<Centroid> iterator()
-
iterator
private java.util.Iterator<Centroid> iterator(int startNode)
-
sum
public int sum()
Return the total count of points that have been added to the tree.
-
checkBalance
void checkBalance()
-
checkAggregates
void checkAggregates()
-
checkAggregates
private void checkAggregates(int node)
-
-