Skip to content

Commit

Permalink
Specify streamSize() overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gstamatelat committed Jul 1, 2018
1 parent 5f803f7 commit 47e8cca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/main/java/gr/james/sampling/AbstractRandomSampling.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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() {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/gr/james/sampling/ChaoSampling.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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() {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/gr/james/sampling/EfraimidisSampling.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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}.
* <p>
* 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() {
Expand Down

0 comments on commit 47e8cca

Please sign in to comment.