diff --git a/src/main/java/gr/james/sampling/ChaoSampling.java b/src/main/java/gr/james/sampling/ChaoSampling.java index c79d0c6..231aa00 100644 --- a/src/main/java/gr/james/sampling/ChaoSampling.java +++ b/src/main/java/gr/james/sampling/ChaoSampling.java @@ -8,6 +8,9 @@ * According to this algorithm, the probability of an item to be in the final sample is proportional to its relative * weight. Weights are the range (0,+Inf), otherwise an {@link IllegalWeightException} is thrown. *
+ * This implementation throws {@link StreamOverflowException} if more than {@link Long#MAX_VALUE} are feeded or if the + * sum of the weights of the items feeded is {@link Double#POSITIVE_INFINITY}, whichever occurs first. + *
* The space complexity of this class is {@code O(k)}, where {@code k} is the sample size.
*
* @param
+ * This implementation never throws {@link StreamOverflowException}.
+ *
* The space complexity of this class is {@code O(k)}, where {@code k} is the sample size.
*
* @param
+ * Implementations can throw {@link StreamOverflowException} if some overflow has occurred in the internal state of the
+ * algorithm that would otherwise prevent it from functioning properly, typically related to the stream size.
+ *
* Classes that implement this interface have a static method with signature
*
+ * This implementations throws {@link StreamOverflowException} if more than {@link Long#MAX_VALUE} items are feeded.
+ *
* The space complexity of this class is {@code O(k)}, where {@code k} is the sample size.
*
* @param
+ * This implementations throws {@link StreamOverflowException} if more than {@link Long#MAX_VALUE} items are feeded.
+ *
* The space complexity of this class is {@code O(k)}, where {@code k} is the sample size.
*
* @param
+ * This implementations throws {@link StreamOverflowException} if more than {@link Long#MAX_VALUE} items are feeded.
+ *
* The space complexity of this class is {@code O(k)}, where {@code k} is the sample size.
*
* @param
+ * Implementations can throw {@link StreamOverflowException} if some overflow has occurred in the internal state of the
+ * algorithm that would otherwise prevent it from functioning properly, typically related to the stream size.
+ *
* Classes that implement this interface have a static method with signature
*
* public static <E> RandomSamplingCollector<E> collector(int sampleSize, Random random)
diff --git a/src/main/java/gr/james/sampling/VitterXSampling.java b/src/main/java/gr/james/sampling/VitterXSampling.java
index c279fa6..9c34303 100644
--- a/src/main/java/gr/james/sampling/VitterXSampling.java
+++ b/src/main/java/gr/james/sampling/VitterXSampling.java
@@ -10,6 +10,8 @@
* algorithms to perform better by efficiently calculating the number of items that need to be skipped, while making
* fewer calls to the RNG.
*
* public static <E> WeightedRandomSamplingCollector<E> weightedCollector(int sampleSize, Random random)