Class AVLGroupTree

java.lang.Object
java.util.AbstractCollection<Centroid>
com.tdunning.math.stats.AVLGroupTree
All Implemented Interfaces:
Serializable, Iterable<Centroid>, Collection<Centroid>

final class AVLGroupTree extends AbstractCollection<Centroid> implements Serializable
A tree of t-digest centroids.
  • Field Details

    • centroid

      private double centroid
    • count

      private int count
    • data

      private List<Double> data
    • centroids

      private double[] centroids
    • counts

      private int[] counts
    • datas

      private List<Double>[] datas
    • aggregatedCounts

      private int[] aggregatedCounts
    • tree

      private final IntAVLTree tree
  • Constructor Details

    • AVLGroupTree

      AVLGroupTree()
    • AVLGroupTree

      AVLGroupTree(boolean record)
  • Method Details

    • size

      public int size()
      Return the number of centroids in the tree.
      Specified by:
      size in interface Collection<Centroid>
      Specified by:
      size in class AbstractCollection<Centroid>
    • 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 List<Double> data(int node)
      Return the data for the provided node.
    • add

      public void add(double centroid, int count, List<Double> data)
      Add the provided centroid to the tree.
    • add

      public boolean add(Centroid centroid)
      Specified by:
      add in interface Collection<Centroid>
      Overrides:
      add in class AbstractCollection<Centroid>
    • update

      public void update(int node, double centroid, int count, List<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 than centroid.
    • 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 to sum.
    • 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 before node.
    • iterator

      public Iterator<Centroid> iterator()
      Specified by:
      iterator in interface Collection<Centroid>
      Specified by:
      iterator in interface Iterable<Centroid>
      Specified by:
      iterator in class AbstractCollection<Centroid>
    • iterator

      private 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)