ListIterator
Located in File: Program_Root/util/ListIterator.php
A ListIterator for lists that allows the programmer to traverse the list in
either direction, modify the list during iteration, and obtain the
iterator's current position in the list. A ListIterator has no current
element; its cursor position always lies between the element that would be
returned by a call to previous() and the element that would be returned by a
call to next(). In a list of length n, there are n+1 valid index values,
from 0 to n, inclusive.
Element(0) Element(1) Element(2) ... Element(n)
^ ^ ^ ^ ^
Index: 0 1 2 3 n+1
Note that the remove() and set() methods are not defined in terms of the
cursor position; they are defined to operate on the last element returned by
a call to next() or previous().
phrame$Id: ListIterator.html,v 1.1.1.1 2002/11/19 16:47:22 arcano Exp $Arnold Cano| Class Variable Summary |
$_element
Default Value:
|
$_index
Default Value:
|
$_values
Default Value:
|
| Inherited Class Variable Summary |
| Inherited Method Summary |
| Variable Detail |
| Method Detail |
void constructor ListIterator ( &$values )
Create a ListIterator with the specified values.
- array $values: publicvoid add ( $value )
Insert the specified element into the list.
- mixed $value: publicboolean hasNext ( )
Check if the ListIterator has more elements when traversing the list in the forward direction.
publicboolean hasPrevious ( )
Check if the ListIterator has more elements when traversing the list in the reverse direction.
publicmixed next ( )
Get the next element in the list.
publicmixed nextIndex ( )
Get the index of the element that would be returned by a subsequent call to next().
publicmixed previous ( )
Get the previous element in the list.
publicmixed previousIndex ( )
Get the index of the element that would be returned by a subsequent call to prev().
publicvoid remove ( )
Remove from the list the last element that was returned by next() or previous().
publicvoid set ( $value )
Replace the last element returned by next() or previous() with the specified element.
- mixed $value: public