Class PortionSamplerPipe<T>
- java.lang.Object
-
- org.pipecraft.pipes.sync.inter.FilterBasePipe<T>
-
- org.pipecraft.pipes.sync.inter.sample.PortionSamplerPipe<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BasePipe,Pipe<T>
public class PortionSamplerPipe<T> extends FilterBasePipe<T>
A pipe sampling about x% of the incoming items. The exact number of sampled items depends on the input pipe length and on the provided randomizer.- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description PortionSamplerPipe(Pipe<T> input, double p)ConstructorPortionSamplerPipe(Pipe<T> input, double p, Random rnd)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanshouldSelect(T item)-
Methods inherited from class org.pipecraft.pipes.sync.inter.FilterBasePipe
close, getProgress, next, peek, start
-
-
-
-
Method Detail
-
shouldSelect
protected boolean shouldSelect(T item)
- Specified by:
shouldSelectin classFilterBasePipe<T>- Parameters:
item- The next item from the input stream- Returns:
- true if and only if the item should be selected
-
-