T
- public static class RandomUtil.Sample<T>
extends java.util.ArrayList<T>
Constructor and Description |
---|
RandomUtil.Sample(int sampleSize) |
Modifier and Type | Method and Description |
---|---|
void |
maybeSave(T item) |
void |
maybeSave(T item,
double weight)
maybeSave(T item, double weight) behaves like two functions: shouldSave and save
|
void |
save(T item)
stores the item in the reservoir, ejecting another one if needed
|
boolean |
shouldSave() |
boolean |
shouldSave(double weight)
determines if the item should be stored in the reservoir
|
public void maybeSave(T item)
public void maybeSave(T item, double weight)
item
- weight
- public boolean shouldSave()
public boolean shouldSave(double weight)
weight
- public void save(T item)
item
-