@Test public void sameState() { final Quantile q1 = Quantile.median(); final Quantile q2 = Quantile.median(); final Random random = new Random(); for (int i = 0; i < 100; ++i) { final double value = random.nextInt(1_000_000); q1.accept(value); q2.accept(value); Assert.assertTrue(q1.sameState(q2)); Assert.assertTrue(q2.sameState(q1)); Assert.assertTrue(q1.sameState(q1)); Assert.assertTrue(q2.sameState(q2)); } }
public boolean sameState(final Quantile other) { return Objects.equals(_quantile, other._quantile) && Arrays.equals(_dn, other._dn) && Arrays.equals(_n, other._n) && Arrays.equals(_nn, other._nn) && Arrays.equals(_q, other._q); }
Quantile implements DoubleConsumer { public boolean sameState(final Quantile other) { return Objects.equals(_quantile, other._quantile) && Arrays.equals(_dn, other._dn) && Arrays.equals(_n, other._n) && Arrays.equals(_nn, other._nn) && Arrays.equals(_q, other._q); } }
Quantile implements DoubleConsumer { public boolean sameState(final Quantile other) { return Objects.equals(_quantile, other._quantile) && Arrays.equals(_dn, other._dn) && Arrays.equals(_n, other._n) && Arrays.equals(_nn, other._nn) && Arrays.equals(_q, other._q); } Quantile(final double quantile); }
Quantile implements DoubleConsumer { public boolean sameState(final Quantile other) { return Objects.equals(_quantile, other._quantile) && Arrays.equals(_dn, other._dn) && Arrays.equals(_n, other._n) && Arrays.equals(_nn, other._nn) && Arrays.equals(_q, other._q); } Quantile(final double quantile); void reset(); double quantile(); double value(); long count(); @Override void accept(final double value); Quantile combine(final Quantile other); boolean sameState(final Quantile other); @Override String toString(); static Collector<T, ?, Quantile> toQuantile(
		final double quantile,
		final ToDoubleFunction<? super T> mapper
	); static Collector<T, ?, Quantile> toMedian(
		final ToDoubleFunction<? super T> mapper
	); }
Quantile implements DoubleConsumer { public boolean sameState(final Quantile other) { return Objects.equals(_quantile, other._quantile) && Arrays.equals(_dn, other._dn) && Arrays.equals(_n, other._n) && Arrays.equals(_nn, other._nn) && Arrays.equals(_q, other._q); } Quantile(final double quantile); void reset(); double quantile(); double value(); long count(); @Override void accept(final double value); Quantile combine(final Quantile other); boolean sameState(final Quantile other); @Override String toString(); static Collector<T, ?, Quantile> toQuantile(
		final double quantile,
		final ToDoubleFunction<? super T> mapper
	); static Collector<T, ?, Quantile> toMedian(
		final ToDoubleFunction<? super T> mapper
	);  }