|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.facet.util.RandomSample
public class RandomSample
Take random samples of large collections.
Nested Class Summary | |
---|---|
static class |
RandomSample.Algorithm
For specifying which sampling algorithm to use. |
static class |
RandomSample.Sorted
For specifying whether to sort the sample. |
Constructor Summary | |
---|---|
RandomSample()
|
Method Summary | |
---|---|
static int[] |
factor(long value)
Factors value into primes. |
static void |
main(String[] args)
Self-test. |
static int[] |
repeatableSample(ScoredDocIDs collection,
int collectionSize,
int sampleSize)
Returns sampleSize values from the first collectionSize
locations of collection , chosen using
the TRAVERSAL algorithm. |
static int[] |
repeatableSample(ScoredDocIDs collection,
int collectionSize,
int sampleSize,
RandomSample.Algorithm algorithm,
RandomSample.Sorted sorted)
Returns sampleSize values from the first collectionSize
locations of collection , chosen using algorithm . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomSample()
Method Detail |
---|
public static int[] repeatableSample(ScoredDocIDs collection, int collectionSize, int sampleSize) throws IOException
sampleSize
values from the first collectionSize
locations of collection
, chosen using
the TRAVERSAL
algorithm. The sample values are not sorted.
collection
- The values from which a sample is wanted.collectionSize
- The number of values (from the first) from which to draw the sample.sampleSize
- The number of values to return.
IOException
RandomSample.Algorithm.TRAVERSAL
public static int[] repeatableSample(ScoredDocIDs collection, int collectionSize, int sampleSize, RandomSample.Algorithm algorithm, RandomSample.Sorted sorted) throws IOException
sampleSize
values from the first collectionSize
locations of collection
, chosen using algorithm
.
collection
- The values from which a sample is wanted.collectionSize
- The number of values (from the first) from which to draw the sample.sampleSize
- The number of values to return.algorithm
- Which algorithm to use.sorted
- Sorted.YES to sort the sample values in ascending order before returning;
Sorted.NO to return them in essentially random order.
IOException
public static int[] factor(long value)
value
into primes.
public static void main(String[] args) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |