iglu.util
Class Looper2D

java.lang.Object
  |
  +--iglu.util.Looper2D
All Implemented Interfaces:
java.util.Iterator

public class Looper2D
extends java.lang.Object
implements java.util.Iterator

A convienent way to iterate through a 2-dimensional array. Initialize the array with the number of rows, colums, and the order in which you want to iterate. Then, each iteration will return a java.awt.point. Refer to the public x and y coordinate to get the values in the array.

Author:
Travis Bauer

Field Summary
static int COLORDER
           
protected  int cols
           
protected  int curCol
           
protected  int curRow
           
protected  int order
           
static int ROWORDER
           
protected  int rows
           
 
Constructor Summary
Looper2D(int numRows, int numCols)
           
Looper2D(int numRows, int numCols, int order)
           
 
Method Summary
 int col()
           
 boolean hasNext()
           
static void main(java.lang.String[] argv)
           
 java.lang.Object next()
           
 void remove()
           
 int row()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROWORDER

public static final int ROWORDER
See Also:
Constant Field Values

COLORDER

public static final int COLORDER
See Also:
Constant Field Values

rows

protected int rows

cols

protected int cols

order

protected int order

curRow

protected int curRow

curCol

protected int curCol
Constructor Detail

Looper2D

public Looper2D(int numRows,
                int numCols,
                int order)

Looper2D

public Looper2D(int numRows,
                int numCols)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Specified by:
next in interface java.util.Iterator
java.util.NoSuchElementException

row

public int row()

col

public int col()

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Specified by:
remove in interface java.util.Iterator
java.lang.UnsupportedOperationException

main

public static void main(java.lang.String[] argv)