spunQ_Map Class Reference

A dictionary class that will map one type of value to another. More...

Inheritance diagram for spunQ_Map:

spunQ_ReadonlyMap

List of all members.

Public Member Functions

 __construct ($collection=array())
 Constructor.
 setKeysAndValues ($keys, $values)
 getAnyKey ()
 getRandomKey ()
 getKeys ()
 getValues ()
 add ($key, $value)
 remove ($key)
 removeMultiple (array $keys)
 extract ($keys)
 intersect (spunQ_Map $otherMap)
 equals (spunQ_Map $otherMap)
 isEmpty ()
get ($key)
getByKey ($key)
getByValue ($value)
 getAllKeysByValue ($value)
 getPairs ()
 getSize ()
 toAssociativeArray ()
 keyExists ($key)
 valueExists ($value)
 copyFrom (spunQ_Map $otherMap)
 clear ()
 rewind ()
 Rewinds the internal iterator.
 valid ()
 Checks whether the internal iterator points to a valid position.
 current ()
 Returns the value references by the internal iterator.
 key ()
 Returns the key references by the internal iterator.
 next ()
 Increments the internal iterator.
 offsetExists ($key)
 Alias for keyExists().
 offsetGet ($key)
 Alias for getByKey().
 offsetSet ($key, $val)
 Alias for add().
 offsetUnset ($key)
 Alias for remove().

Static Public Member Functions

static emptyMap ()
 Returns an empty read-only map.

Private Attributes

 $keys = array()
 The keys that have been defined.
 $values = array()
 Values of the keys.
 $iteratorIndex = 0
 Index for the iterator interface.

Static Private Attributes

static $emptyMap
 An empty spunQ_ReadonlyMap instance.


Detailed Description

A dictionary class that will map one type of value to another.

This class is required since associative arrays in php can only contain numeric or string values as keys.

Developer log entry:
Necdet Can Atesman (2009-02-09): Implements the Iterator and ArrayAccess interfaces.

Definition at line 10 of file Map.class.php.


Constructor & Destructor Documentation

spunQ_Map::__construct ( collection = array()  ) 

Constructor.

Parameters:
$collection Can optionally be initialized with an associative array or another map.

Definition at line 52 of file Map.class.php.


Member Function Documentation

spunQ_Map::current (  ) 

Returns the value references by the internal iterator.

Returns:
mixed

Definition at line 321 of file Map.class.php.

static spunQ_Map::emptyMap (  )  [static]

Returns an empty read-only map.

Returns:
spunQ_ReadonlyMap

Definition at line 22 of file Map.class.php.

spunQ_Map::key (  ) 

Returns the key references by the internal iterator.

Returns:
mixed

Definition at line 333 of file Map.class.php.

spunQ_Map::next (  ) 

Increments the internal iterator.

Returns:
void

Definition at line 345 of file Map.class.php.

spunQ_Map::rewind (  ) 

Rewinds the internal iterator.

Returns:
void

Definition at line 302 of file Map.class.php.

spunQ_Map::valid (  ) 

Checks whether the internal iterator points to a valid position.

Returns:
boolean

Definition at line 312 of file Map.class.php.


Member Data Documentation

spunQ_Map::$emptyMap [static, private]

An empty spunQ_ReadonlyMap instance.

Type:
spunQ_ReadonlyMap

Definition at line 16 of file Map.class.php.

spunQ_Map::$iteratorIndex = 0 [private]

Index for the iterator interface.

Type:
integer

Definition at line 45 of file Map.class.php.

spunQ_Map::$keys = array() [private]

The keys that have been defined.

Type:
array

Definition at line 33 of file Map.class.php.

spunQ_Map::$values = array() [private]

Values of the keys.

Type:
array

Definition at line 39 of file Map.class.php.


The documentation for this class was generated from the following file:

Generated on Fri Jul 1 11:12:42 2011 for spunQ3 by  doxygen 1.5.9