ArrayIterator : public class
Created: 04/26/07 10:55:47
Modified: 04/26/07 10:55:47
Project:
Advanced:
Concrete Iterator implementation which provides methods for iterating over an array
Attribute Details
private int
  index
Initial: 0
Notes: The index of the current item in the Array
private Array
  items
Notes: The aggregate [Array] in which to traverse
Operation Details
public
ArrayIterator(
array: Array,
):var
Sequential
Notes: Instantiates new ArrayIterator instance <br />@example basic ArrayIterator example is as follows: <br /><listing version="3.0"  var array:Array new Array("A","B","C"); var it:IIterator new ArrayIterator( array );  while it.hasNext() trace( it.next(), it.position());  outputs: A, B, C, 2<br /></listing> <br />@param the Array in which to iterate over
public
hasNext():Boolean
Sequential
Notes: Determines if there are elements remaining in the aggregate <br />@inheritDoc
public
next():var
Sequential
Notes: Returns the next item element in the array <br />@return  Next array element based on the current index
public
position():int
Sequential
Notes: Determines the indexed position of the aggreagate <br />@inheritDoc
public
reset():void
Sequential
Notes: Resets the index of the ArrayIterator instance to 0
public
setAggregate(
aggregate: Object,
):void
Sequential
Notes: Sets the array in which the ArrayIterator instance is to iterator over <br />@inheritDoc
Object Type Connection Notes
«interface» IIterator Interface Realisation