GridIterator

Kind of class:class
Inherits from:Point
Implements:
Version:1.0
Author:Francis Bourre
Classpath:com.bourre.structures.GridIterator
File last modified:Wednesday, 31 October 2007, 07:35:30
GridIterator iterates over an AbstractGrid data structure.

Example

var g : NGrid : NGrid = new NGrid(2,2);
var myIterator : Iterator = new GridIterator( g );

while( myIterator.hasNext() ) {
  var e : Number = myIterator.next();
}

Summary

Constructor
Instance properties
Instance properties inherited from Point
Class methods
Class methods inherited from Point

Constructor

GridIterator

function GridIterator (
Usage : var i:GridIterator = new GridIterator(myGrid);
Parameters:
g:
target Grid for the iterator.

Instance methods

getIndex

function getIndex (
) : Number
Returns current iterator position in grid structure.

Example

var g : NGrid : NGrid = new NGrid(2,2);
var myIterator : Iterator = new GridIterator( g );

while( myIterator.hasNext() ) {
  var e : Number = myIterator.next();
  PixlibDebug.INFO( "Iterator index = " + myIterator.getIndex() );
}
Returns:
Number index

hasNext

function hasNext (
) : Boolean
Indicates if the next iterator position exists.

Example

var g : NGrid : NGrid = new NGrid(2,2);
var myIterator : Iterator = new GridIterator( g );

while( myIterator.hasNext() ) {
  //
}
Returns:
true if next position exist, either false

toString

function toString (
) : String
Returns the string representation of this instance.
Returns:
the string representation of this instance
Overrides: