private void start(double x, int w, int id) { this.id = id; add(x, w); }
public static Centroid createWeighted(double x, int w, Iterable<? extends Double> data) { Centroid r = new Centroid(data != null); r.add(x, w, data); return r; }
private void start(double x, int w, int id) { this.id = id; add(x, w); }
public static Centroid createWeighted(double x, int w, Iterable<? extends Double> data) { Centroid r = new Centroid(data != null); r.add(x, w, data); return r; }
/** * Modify an existing value in the tree subject to the constraint that the change will not alter the * ordering of the tree. * @param x New value to add to Centroid * @param count Weight of new value * @param v The value to modify * @param data The recorded data */ public void move(double x, int count, Centroid v, Iterable<? extends Double> data) { if (size <= 0) { throw new IllegalStateException("Cannot move element of empty tree"); } if (size == 1) { if(leaf != v) { throw new IllegalStateException("Cannot move element that is not in tree"); } leaf.add(x, count, data); } else if (v.compareTo(leaf) < 0) { left.move(x, count, v, data); } else { right.move(x, count, v, data); } this.count += count; }
closest.add(x, w, base.data()); summary.add(closest);