org.apache.mahout.common.iterator
Class SamplingIterator<T>

java.lang.Object
  extended by com.google.common.collect.UnmodifiableIterator<T>
      extended by com.google.common.collect.AbstractIterator<T>
          extended by org.apache.mahout.common.iterator.SamplingIterator<T>
All Implemented Interfaces:
Iterator<T>

public final class SamplingIterator<T>
extends com.google.common.collect.AbstractIterator<T>

Wraps an Iterator and returns only some subset of the elements that it would, as determined by a iterator rate parameter.


Constructor Summary
SamplingIterator(Iterator<? extends T> delegate, double samplingRate)
           
SamplingIterator(RandomWrapper random, Iterator<? extends T> delegate, double samplingRate)
           
 
Method Summary
protected  T computeNext()
           
 
Methods inherited from class com.google.common.collect.AbstractIterator
endOfData, hasNext, next, peek
 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SamplingIterator

public SamplingIterator(Iterator<? extends T> delegate,
                        double samplingRate)

SamplingIterator

public SamplingIterator(RandomWrapper random,
                        Iterator<? extends T> delegate,
                        double samplingRate)
Method Detail

computeNext

protected T computeNext()
Specified by:
computeNext in class com.google.common.collect.AbstractIterator<T>


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.