class AVLGroupTree extends AbstractCollection<Centroid> implements Serializable {

    @SuppressWarnings("WeakerAccess")
    public long headSum(int node) {
        final int left = tree.left(node);
        long sum = aggregatedCounts[left];
        for (int n = node, p = tree.parent(node); p != IntAVLTree.NIL; n = p, p = tree.parent(n)) {
            if (n == tree.right(p)) {
                final int leftP = tree.left(p);
                sum += counts[p] + aggregatedCounts[leftP];
            }
        }
        return sum;
    }

      AVLGroupTree();
      AVLGroupTree(final boolean record);

}