zinger.bsheet
Class RangeIterator
java.lang.Object
zinger.bsheet.RangeIterator
- All Implemented Interfaces:
- java.util.Iterator
public class RangeIterator
- extends java.lang.Object
- implements java.util.Iterator
Iterates through cell addresses of a specified rectangle.
- Author:
- Alexey Zinger (inline_four@yahoo.com)
- See Also:
next()
Constructor Summary |
RangeIterator(int leftCol,
int topRow,
int rightCol,
int bottomRow)
Constructs an instance ready for iteration of the range specified by its top left and bottom right corners. |
Method Summary |
boolean |
hasNext()
|
java.lang.Object |
next()
Advances through the specified rectangular range. |
void |
remove()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
leftCol
protected final int leftCol
topRow
protected final int topRow
rightCol
protected final int rightCol
bottomRow
protected final int bottomRow
col
protected int col
row
protected int row
RangeIterator
public RangeIterator(int leftCol,
int topRow,
int rightCol,
int bottomRow)
- Constructs an instance ready for iteration of the range specified by its top left and bottom right corners.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
next
public java.lang.Object next()
throws java.util.NoSuchElementException
- Advances through the specified rectangular range.
Advancements are made left to right and top to bottom.
- Specified by:
next
in interface java.util.Iterator
- Returns:
- a
Point
, whose x
property represents a model column index
and y
property represents a row index
- Throws:
java.util.NoSuchElementException
- if the end of the range (bottom right corner)
has already been reached prior to the call
remove
public void remove()
throws java.lang.UnsupportedOperationException
- Specified by:
remove
in interface java.util.Iterator
- Throws:
java.lang.UnsupportedOperationException
- always