|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
An iterator for moving through data arranged in a 2-dimensional matrix. To iterate column-by-column, use
MatrixIterator mi = matrix.getMatrixIterator();
while (hasNextColumn()) {
mi.nextColumn();
while (hasNextInColumn())
Object data = mi.nextInColumn();
}
Alternatively, you can go through each row:
MatrixIterator mi = matrix.getMatrixIterator();
while (hasNextRow()) {
mi.nextRow();
while (hasNextInRow())
Object data = mi.nextInRow();
}
DataMatrix2d| Method Summary | |
int |
currColumn()
Get the current column offset (x position). |
int |
currRow()
Get the current row offset (y position). |
boolean |
hasNextColumn()
Checks to see if there is a column to the east. |
boolean |
hasNextInColumn()
Is there another item in this column? |
boolean |
hasNextInRow()
Is there another item in the current column? |
boolean |
hasNextRow()
Checks to see if there is a row to the north. |
int |
nextColumn()
Advances to the next column and resets the pointer to the beginning of that column. |
java.lang.Object |
nextInColumn()
Returns the next non-empty cell in the matrix in the positive Y direction. |
java.lang.Object |
nextInRow()
Returns the next non-empty cell in the matrix in the positive x direction. |
int |
nextRow()
Advances to the start of the next non-empty row and returns its index. |
| Method Detail |
public int nextColumn()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if there is no next columnpublic boolean hasNextColumn()
true if iterator has another column.
public java.lang.Object nextInRow()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if there is no more data in the row.public boolean hasNextInRow()
true if iterator has another item in this row.
public int nextRow()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if there is no next row.public boolean hasNextRow()
true if iterator has another row.
public java.lang.Object nextInColumn()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if there is no more data in the column, or
not in a column.public boolean hasNextInColumn()
true if there is another piece of data along
the current column.public int currColumn()
public int currRow()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||