From 47e8cca6410a45a0c409a1121e9df27f5d57423c Mon Sep 17 00:00:00 2001 From: Giorgos Stamatelatos Date: Mon, 2 Jul 2018 02:02:32 +0300 Subject: [PATCH] Specify streamSize() overflow --- .../java/gr/james/sampling/AbstractRandomSampling.java | 7 +++++-- src/main/java/gr/james/sampling/ChaoSampling.java | 7 +++++-- src/main/java/gr/james/sampling/EfraimidisSampling.java | 9 +++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/gr/james/sampling/AbstractRandomSampling.java b/src/main/java/gr/james/sampling/AbstractRandomSampling.java index 7bce12e..b2c5123 100644 --- a/src/main/java/gr/james/sampling/AbstractRandomSampling.java +++ b/src/main/java/gr/james/sampling/AbstractRandomSampling.java @@ -123,9 +123,12 @@ public final int sampleSize() { } /** - * {@inheritDoc} + * Get the number of items that have been feeded to the algorithm during the lifetime of this instance, which is a + * non-negative {@code long} value. + *

+ * This method runs in constant time. * - * @return {@inheritDoc} + * @return the number of items that have been feeded to the algorithm */ @Override public final long streamSize() { diff --git a/src/main/java/gr/james/sampling/ChaoSampling.java b/src/main/java/gr/james/sampling/ChaoSampling.java index 231aa00..8367130 100644 --- a/src/main/java/gr/james/sampling/ChaoSampling.java +++ b/src/main/java/gr/james/sampling/ChaoSampling.java @@ -265,9 +265,12 @@ public final int sampleSize() { } /** - * {@inheritDoc} + * Get the number of items that have been feeded to the algorithm during the lifetime of this instance, which is a + * non-negative {@code long} value. + *

+ * This method runs in constant time. * - * @return {@inheritDoc} + * @return the number of items that have been feeded to the algorithm */ @Override public final long streamSize() { diff --git a/src/main/java/gr/james/sampling/EfraimidisSampling.java b/src/main/java/gr/james/sampling/EfraimidisSampling.java index 859d341..f4d540d 100644 --- a/src/main/java/gr/james/sampling/EfraimidisSampling.java +++ b/src/main/java/gr/james/sampling/EfraimidisSampling.java @@ -192,9 +192,14 @@ public final int sampleSize() { } /** - * {@inheritDoc} + * Get the number of items that have been feeded to the algorithm during the lifetime of this instance. + *

+ * If more than {@link Long#MAX_VALUE} items has been feeded to the instance, {@code streamSize()} will cycle the + * long values, continuing from {@link Long#MIN_VALUE}. + *

+ * This method runs in constant time. * - * @return {@inheritDoc} + * @return the number of items that have been feeded to the algorithm */ @Override public final long streamSize() {