ArrayEnumerator
| Kind of class: | class |
|---|---|
| Inherits from: | Enumerator < Dispatcher |
| Known subclasses: | |
| Author: | Arthur Clemens |
| Classpath: | org.asapframework.data.array.ArrayEnumerator |
| File last modified: | Wednesday, 11 October 2006, 22:14:07 |
Straightforward enumeration (iterator) class for arrays.
ArrayEnumerator has one way of iterating: forward (getNextObject). For more options see playground.classes.data.array.TraverseArrayEnumerator.Events broadcast to listeners:
TraverseArrayEnumeratorEvent with type:
UPDATE If the delegate validation method exists and only if the delegate method returns true.Summary
Constructor
Instance methods
Instance methods inherited from Enumerator
Constructor
ArrayEnumerator
function ArrayEnumerator (
inArray:Array)
Creates a new array enumerator. Optionally stores a pointer to array inArray.
Parameters:
inArray:
(optional) the array to enumerate
Instance methods
getAllObjects
function getAllObjects (
) : Array
Retrieves all objects.
Returns:
The array as set in the constructor or in setArray.
getCurrentObject
function getCurrentObject (
)
Retrieves the object from the array at the current pointer location.
Returns:
(Deliberately untyped) The object from the array at the current pointer location.
getNextObject
function getNextObject (
)
Increments the location pointer by one and returns the object from the array at that location.
Returns:
(Deliberately untyped) The object at the new location. Returns null if the location pointer has moved past the end of the array.
Implementation note:
Calls update.
reset
function reset (
) : Void
Puts the enumerator just before the first array item. At this point calling getCurrentObject will generate an error; you must first move the enumerator using getNextObject.
Implementation note:
Calls update.
Overrides:
setArray
function setArray (
inArray:Array) : Void
Stores a pointer to array inArray.
Parameters:
inArray:
the array to enumerate
setCurrentLocation
function setCurrentLocation (
inLocation:Number) : Void
Sets the location pointer to a new position.
Parameters:
inLocation:
the new pointer location
Implementation note:
Calls update.
setCurrentObject
function setCurrentObject (
inObject:Object) : Void
Sets the location pointer to the location (in the array) of inObject.
Parameters:
inObject:
the object whose index the location pointer should point to
Implementation note:
Calls update.