public class LocIterator extends Object implements Iterator<Location>
Constructor and Description |
---|
LocIterator(Location bounds,
int windowSize,
int increment)
Construct an iterator that slides a window over a Location.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Check if next window of default size is available.
|
boolean |
hasNext(int windowSize,
int increment)
Check if next window of specified size is available.
|
static void |
main(String[] args)
Deprecated.
|
Location |
next()
Get next window of default size, then increment position by default amount.
|
Location |
next(int windowSize,
int increment)
Get next window of specified size, then increment position by specified amount.
|
Location |
remainder()
Get portion of bounding location that has not yet been retrieved by next() method.
|
void |
remove()
Unsupported.
|
String |
toString()
Get string representation of iterator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEachRemaining
public LocIterator(Location bounds, int windowSize, int increment)
bounds
- The location over which to iterate.windowSize
- The size of the moving window.increment
- The increment by which to move the window at each iteration.
If increment is positive, the iteration starts at the beginning of the bounding location
and moves toward the end; if the increment is negative, the iteration starts at the end and moves
toward the begnning.public boolean hasNext(int windowSize, int increment)
windowSize
- Size of window. May be smaller or larger than default window size.increment
- The increment by which to move the window at each iteration. Note that this
method does not actually change the position. However, it checks the sign of the increment parameter to determine
the direction of the iteration.IllegalArgumentException
- Window size parameter was not positive.public boolean hasNext()
public Location remainder()
public Location next()
next
in interface Iterator<Location>
IndexOutOfBoundsException
- The next window was not within the bounding location.public Location next(int windowSize, int increment)
windowSize
- Size of window to get.increment
- Amount by which to shift position. If increment is positive, the position is shifted
toward the end of the bounding location; if increment is negative, the position is shifted toward
the beginning of the bounding location.IndexOutOfBoundsException
- The next window was not within the bounding location.IllegalArgumentException
- The increment was zero, or windowSize was not positive.public void remove()
remove
in interface Iterator<Location>
UnsupportedOperationException
@Deprecated public static void main(String[] args)
Copyright © 2000–2019 BioJava. All rights reserved.