net.ericaro.neoitertools.generators
Class SliceGenerator<T>

java.lang.Object
  extended by net.ericaro.neoitertools.generators.SliceGenerator<T>
All Implemented Interfaces:
Generator<T>

public class SliceGenerator<T>
extends java.lang.Object
implements Generator<T>

a Generator that returns selected elements from the Generator. If start is non-zero, then elements from the Generator are skipped until start is reached. Afterward, elements are returned consecutively unless step is set higher than one which results in items being skipped. It stops at the specified position. slice() does not support negative values for start, stop, or step.

Author:
eric
See Also:
SliceGenerator's wiki page, neoitertools site

Constructor Summary
SliceGenerator(Generator<T> sequence, int start, int stop, int step)
           
 
Method Summary
 T next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SliceGenerator

public SliceGenerator(Generator<T> sequence,
                      int start,
                      int stop,
                      int step)
Method Detail

next

public T next()
Specified by:
next in interface Generator<T>
Returns:
the next item in the sequence.


Copyright © 2011. All Rights Reserved.