com.bigdata.bop.ap
Class SampleIndex.EntireRangeOffsetSampler

java.lang.Object
  extended by com.bigdata.bop.ap.SampleIndex.EntireRangeOffsetSampler
All Implemented Interfaces:
SampleIndex.IOffsetSampler
Enclosing class:
SampleIndex<E>

public static class SampleIndex.EntireRangeOffsetSampler
extends Object
implements SampleIndex.IOffsetSampler

Returns all offsets in the half-open range, but may only be used when the limit GTE the range count.


Constructor Summary
SampleIndex.EntireRangeOffsetSampler()
           
 
Method Summary
 long[] getOffsets(long seed, int limit, long fromIndex, long toIndex)
          Return an array of tuple indices which may be used to sample a key range of some index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleIndex.EntireRangeOffsetSampler

public SampleIndex.EntireRangeOffsetSampler()
Method Detail

getOffsets

public long[] getOffsets(long seed,
                         int limit,
                         long fromIndex,
                         long toIndex)
Return an array of tuple indices which may be used to sample a key range of some index.

Note: The caller must stop when it runs out of offsets, not when the limit is satisfied, as there will be fewer offsets returned when the half open range is smaller than the limit.

Specified by:
getOffsets in interface SampleIndex.IOffsetSampler
Parameters:
seed - The seed for the random number generator -or- ZERO (0L) for a random seed. A non-zero value may be used to create a repeatable sample.
limit - The maximum #of tuples to sample.
fromIndex - The inclusive lower bound.
toIndex - The exclusive upper bound0
Returns:
An array of at most limit offsets into the index. The offsets will lie in the half open range (fromIndex,toIndex]. The elements of the array will be in ascending order. No offsets will be repeated.
Throws:
UnsupportedOperationException - if limit!=rangeCount (after adjusting for limits greater than the rangeCount).


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.