Skip to content

Commit

Permalink
Fix StreamOverflowException description to include state overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gstamatelat committed Jun 27, 2018
1 parent aa506a7 commit f30236f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gr/james/sampling/RandomSampling.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface RandomSampling<T> {
* @param item the item to feed to the algorithm
* @return this instance
* @throws NullPointerException if {@code item} is {@code null}
* @throws StreamOverflowException if the amount of items feeded to this algorithm has reached the maximum allowed
* @throws StreamOverflowException if the internal state of the algorithm has overflown
*/
RandomSampling<T> feed(T item);

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/gr/james/sampling/StreamOverflowException.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import java.util.Map;

/**
* A {@code StreamOverflowException} indicates that the amount of items feeded to a random sampling algorithm exceeds
* the maximum allowed.
* A {@code StreamOverflowException} indicates that the internal state of the algorithm has overflown.
* <p>
* The exception may occur when the amount of items feeded to a random sampling algorithm exceeds the maximum allowed or
* when the internal state has overflown in a way that would otherwise cause the algorithm to behave inconsistently.
* <p>
* More specifically, this exception targets the methods
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface WeightedRandomSampling<T> extends RandomSampling<T> {
* @return this instance
* @throws NullPointerException if {@code item} is {@code null}
* @throws IllegalWeightException if {@code weight} is incompatible with the algorithm
* @throws StreamOverflowException if the amount of items feeded to this algorithm has reached the maximum allowed
* @throws StreamOverflowException if the internal state of the algorithm has overflown
*/
WeightedRandomSampling<T> feed(T item, double weight);

Expand Down

0 comments on commit f30236f

Please sign in to comment.