/** * Return the next node. */ public int next(int node) { return tree.next(node); }
@Override public Centroid next() { final Centroid next = new Centroid(mean(nextNode), count(nextNode)); final List<Double> data = data(nextNode); if (data != null) { for (Double x : data) { next.insertData(x); } } nextNode = tree.next(nextNode); return next; }
/** * Update <code>node</code> with the current data. */ public void update(int node) { final int prev = prev(node); final int next = next(node); if ((prev == NIL || compare(prev) > 0) && (next == NIL || compare(next) < 0)) { // Update can be done in-place copy(node); for (int n = node; n != NIL; n = parent(n)) { fixAggregates(n); } } else { // TODO: it should be possible to find the new node position without // starting from scratch remove(node); add(); } }
final int next = next(node); assert next != NIL; swap(node, next);
/** * Return the next node. */ public int next(int node) { return tree.next(node); }
@Override public Centroid next() { final Centroid next = new Centroid(mean(nextNode), count(nextNode)); final List<Double> data = data(nextNode); if (data != null) { for (Double x : data) { next.insertData(x); } } nextNode = tree.next(nextNode); return next; }
/** * Update <code>node</code> with the current data. */ public void update(int node) { final int prev = prev(node); final int next = next(node); if ((prev == NIL || compare(prev) > 0) && (next == NIL || compare(next) < 0)) { // Update can be done in-place copy(node); for (int n = node; n != NIL; n = parent(n)) { fixAggregates(n); } } else { // TODO: it should be possible to find the new node position without // starting from scratch remove(node); add(); } }
final int next = next(node); assert next != NIL; swap(node, next);