Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

OArray Class Reference

Inheritance diagram for OArray:

Inheritance graph
[legend]
Collaboration diagram for OArray:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OArray ($array=array())
 __construct ($array=array())
 getNewIterator ()
 size ()
 isEmpty ()
get ($i)
 indexOf ($element)
set ($i, $item)
setRef ($i, &$item)
 contains ($o)
 add ($o)
 remove ($o)
 removeIndex ($i)
 clear ()
 push ($o)
 pushRef (&$o)
values ()
pop ()
shift ()
toArray ()
 toString ()

Public Attributes

 $_array
 $_size = 0

Detailed Description

Class wrapper for oriented object arrays.

This class implements a simple interface quite like java to handle array in a good old oo way.

Author:
Laurent Bedubourg <laurent.bedubourg@free.fr>

Definition at line 36 of file OArray.php.


Constructor & Destructor Documentation

OArray::OArray array = array()  ) 
 

OArray constructor.

Parameters:
array $array optional The php array this vector will manage.

Definition at line 47 of file OArray.php.

References __construct().


Member Function Documentation

OArray::__construct array = array()  ) 
 

OArray php4.4 compliant constructor.

Parameters:
array $array optional The php array this vector will manage.

Definition at line 58 of file OArray.php.

References $i, __construct(), and pushRef().

Referenced by __construct(), and OArray().

OArray::add o  ) 
 

Add an element to the vector.

Parameters:
mixed $o The item to add.

Definition at line 170 of file OArray.php.

References add(), and push().

Referenced by add().

OArray::clear  ) 
 

Clear vector.

Definition at line 212 of file OArray.php.

OArray::contains o  ) 
 

Test if the vector contains the specified element.

Parameters:
mixed $item The item we look for.

Definition at line 157 of file OArray.php.

References $i, contains(), and size().

Referenced by contains().

& OArray::get i  ) 
 

Retrieve element at specified index.

Returns:
mixed
Exceptions:
OutOfBounds 

Definition at line 98 of file OArray.php.

References $i, get(), and size().

Referenced by get().

OArray::getNewIterator  ) 
 

Retrieve an iterator ready to used.

Returns:
ArrayIterator

Reimplemented from Iterable.

Definition at line 70 of file OArray.php.

OArray::indexOf element  ) 
 

Retrieve index of specified element.

Returns:
int The element index of false if element not in vector.

Definition at line 113 of file OArray.php.

References $i, and indexOf().

Referenced by indexOf().

OArray::isEmpty  ) 
 

Returns true if this vector is empty, false otherwise.

Returns:
boolean

Definition at line 88 of file OArray.php.

References size().

& OArray::pop  ) 
 

Remove the last element of the vector and returns it.

Returns:
mixed

Definition at line 258 of file OArray.php.

OArray::push o  ) 
 

Add an element at the end of the vector (same as add()).

Parameters:
mixed $o Item to append to vector.

Definition at line 222 of file OArray.php.

References push().

Referenced by add(), and push().

OArray::pushRef &$  o  ) 
 

Add an element at the end of the vector (same as add()).

Parameters:
mixed $o Item to append to vector.

Definition at line 232 of file OArray.php.

References pushRef().

Referenced by __construct(), and pushRef().

OArray::remove o  ) 
 

Remove object from this vector.

Parameters:
mixed $o Object to remove.
Returns:
boolean true if object removed false if not found

Definition at line 181 of file OArray.php.

References $i, remove(), and removeIndex().

Referenced by remove().

OArray::removeIndex i  ) 
 

Remove specified index from vector.

Parameters:
int $i Index
Exceptions:
OutOfBounds 

Definition at line 197 of file OArray.php.

References $i, removeIndex(), and size().

Referenced by remove(), and removeIndex().

& OArray::set i,
item
 

Set the item at specified index.

Exceptions:
OutOfBounds if index is greated that vector limit
Returns:
Old element

Definition at line 129 of file OArray.php.

References set(), and setRef().

Referenced by set().

& OArray::setRef i,
&$  item
 

Set the item at specified index (by reference).

Exceptions:
OutOfBounds if index is greated that vector limit
Returns:
Old element

Definition at line 140 of file OArray.php.

References $i, setRef(), and size().

Referenced by set(), and setRef().

& OArray::shift  ) 
 

Extract and return first element of OArray.

Returns:
mixed

Definition at line 268 of file OArray.php.

OArray::size  ) 
 

Returns the vector number of elements.

Returns:
int

Reimplemented from Iterable.

Definition at line 79 of file OArray.php.

Referenced by contains(), get(), isEmpty(), removeIndex(), setRef(), and values().

& OArray::toArray  ) 
 

Retrieve a php array for this vector.

Returns:
array

Definition at line 279 of file OArray.php.

References values().

OArray::toString  ) 
 

Retrieve a string representation of the array.

Definition at line 287 of file OArray.php.

& OArray::values  ) 
 

Retrieve vector values.

The returned array contains references to internal data.

Returns:
array

Definition at line 244 of file OArray.php.

References $i, and size().

Referenced by toArray().


Member Data Documentation

OArray::$_array
 

Definition at line 38 of file OArray.php.

OArray::$_size = 0
 

Definition at line 39 of file OArray.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 23:40:50 2004 for Mediawiki by doxygen 1.3.7