Class ListIterator

Description

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().

  • author: Arnold Cano
  • version: $Id: ListIterator.php,v 1.1.1.1.24.1 2011/10/04 11:19:40 afelixf Exp $

Located in /phrame/util/ListIterator.php (line 22)


	
			
Variable Summary
integer $_element
integer $_index
array $_values
Method Summary
ListIterator ListIterator ( &$values, array $values)
void add (mixed $value)
boolean hasNext ()
boolean hasPrevious ()
mixed next ()
mixed nextIndex ()
mixed previous ()
mixed previousIndex ()
void remove ()
void set (mixed $value)
Variables
integer $_element (line 35)
integer $_index (line 31)
array $_values (line 27)
Methods
Constructor ListIterator (line 43)

Create a ListIterator with the specified values.

  • access: public
ListIterator ListIterator ( &$values, array $values)
  • array $values
  • &$values
add (line 151)

Insert the specified element into the list.

  • access: public
void add (mixed $value)
  • mixed $value
hasNext (line 59)

Check if the ListIterator has more elements when traversing the list in the forward direction.

  • access: public
boolean hasNext ()
hasPrevious (line 70)

Check if the ListIterator has more elements when traversing the list in the reverse direction.

  • access: public
boolean hasPrevious ()
next (line 80)

Get the next element in the list.

  • access: public
mixed next ()
nextIndex (line 95)

Get the index of the element that would be returned by a subsequent call to next().

  • access: public
mixed nextIndex ()
previous (line 105)

Get the previous element in the list.

  • access: public
mixed previous ()
previousIndex (line 120)

Get the index of the element that would be returned by a subsequent call to prev().

  • access: public
mixed previousIndex ()
remove (line 130)

Remove from the list the last element that was returned by next() or previous().

  • access: public
void remove ()
set (line 141)

Replace the last element returned by next() or previous() with the specified element.

  • access: public
void set (mixed $value)
  • mixed $value

Documentation generated on Wed, 05 Oct 2011 10:36:41 +0200 by phpDocumentor 1.4.1