Skip to content

Commit

Permalink
SkipFunction accepts the stream size
Browse files Browse the repository at this point in the history
  • Loading branch information
gstamatelat committed Jul 2, 2018
1 parent ace814d commit 16e574d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/gr/james/sampling/SkipFunction.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package gr.james.sampling;

/**
* A skip function returns how many elements to skip.
* A skip function returns how many elements a reservoir algorithm must skip before accepting an element in the
* reservoir.
*/
@Deprecated
@FunctionalInterface
interface SkipFunction {
/**
* Returns a {@code long} indicating how many elements the algorithm must skip.
* <p>
* This method is called right after an element was accepted in the reservoir.
*
* @param streamSize the stream size
* @return how many elements the algorithm must skip
*/
long skip();
long skip(long streamSize);
}

0 comments on commit 16e574d

Please sign in to comment.