Class ListIterator

ListIterator

Classes extended from 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().

Class Variable Summary
$_element
Default Value: -><-
$_index
Default Value: -><-
$_values
Default Value: -><-

Inherited Class Variable Summary

Inherited Method Summary

Method Summary
void constructor ListIterator ( &$values )
void add ( $value )
boolean hasNext ( )
boolean hasPrevious ( )
mixed next ( )
mixed nextIndex ( )
mixed previous ( )
mixed previousIndex ( )
void remove ( )
void set ( $value )
Variable Detail

$_element

Data type: integer


$_index

Data type: integer


$_values

Data type: array



Method Detail

constructor ListIterator

void constructor ListIterator ( &$values )

Create a ListIterator with the specified values.
Function Parameters:
- array $values:
Function Info:
Access - public

add

void add ( $value )

Insert the specified element into the list.
Function Parameters:
- mixed $value:
Function Info:
Access - public

hasNext

boolean hasNext ( )

Check if the ListIterator has more elements when traversing the list in
 the forward direction.
Function Parameters:
Function Info:
Access - public

hasPrevious

boolean hasPrevious ( )

Check if the ListIterator has more elements when traversing the list in
 the reverse direction.
Function Parameters:
Function Info:
Access - public

next

mixed next ( )

Get the next element in the list.
Function Parameters:
Function Info:
Access - public

nextIndex

mixed nextIndex ( )

Get the index of the element that would be returned by a subsequent call
 to next().
Function Parameters:
Function Info:
Access - public

previous

mixed previous ( )

Get the previous element in the list.
Function Parameters:
Function Info:
Access - public

previousIndex

mixed previousIndex ( )

Get the index of the element that would be returned by a subsequent call
 to prev().
Function Parameters:
Function Info:
Access - public

remove

void remove ( )

Remove from the list the last element that was returned by next() or
 previous().
Function Parameters:
Function Info:
Access - public

set

void set ( $value )

Replace the last element returned by next() or previous() with the
 specified element.
Function Parameters:
- mixed $value:
Function Info:
Access - public