[ Index ] |
|
Code source de PRADO 3.0.6 |
[Code source] [Imprimer] [Statistiques]
TMap, TMapIterator classes
Author: | Qiang Xue <qiang.xue@gmail.com> |
Copyright: | Copyright © 2005 PradoSoft |
License: | http://www.pradosoft.com/license/ |
Version: | $Id: TMap.php 1397 2006-09-07 07:55:53Z wei $ |
Poids: | 353 lignes (9 kb) |
Inclus ou requis: | 1 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
TMap:: (19 méthodes):
__construct()
getReadOnly()
setReadOnly()
getIterator()
count()
getCount()
getKeys()
itemAt()
add()
remove()
clear()
contains()
toArray()
copyFrom()
mergeWith()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
TMapIterator:: (6 méthodes):
__construct()
rewind()
key()
current()
next()
valid()
__construct($data=null,$readOnly=false) X-Ref |
Constructor. Initializes the list with an array or an iterable object. param: array|Iterator the intial data. Default is null, meaning no initialization. param: boolean whether the list is read-only |
getReadOnly() X-Ref |
return: boolean whether this map is read-only or not. Defaults to false. |
setReadOnly($value) X-Ref |
param: boolean whether this list is read-only or not |
getIterator() X-Ref |
Returns an iterator for traversing the items in the list. This method is required by the interface IteratorAggregate. return: Iterator an iterator for traversing the items in the list. |
count() X-Ref |
Returns the number of items in the map. This method is required by Countable interface. return: integer number of items in the map. |
getCount() X-Ref |
return: integer the number of items in the map |
getKeys() X-Ref |
return: array the key list |
itemAt($key) X-Ref |
Returns the item with the specified key. This method is exactly the same as {@link offsetGet}. param: mixed the key return: mixed the element at the offset, null if no element is found at the offset |
add($key,$value) X-Ref |
Adds an item into the map. Note, if the specified key already exists, the old value will be overwritten. param: mixed key param: mixed value |
remove($key) X-Ref |
Removes an item from the map by its key. param: mixed the key of the item to be removed return: mixed the removed value, null if no such key exists. |
clear() X-Ref |
Removes all items in the map. |
contains($key) X-Ref |
param: mixed the key return: boolean whether the map contains an item with the specified key |
toArray() X-Ref |
return: array the list of items in array |
copyFrom($data) X-Ref |
Copies iterable data into the map. Note, existing data in the map will be cleared first. param: mixed the data to be copied from, must be an array or object implementing Traversable |
mergeWith($data) X-Ref |
Merges iterable data into the map. Existing data in the map will be kept and overwritten if the keys are the same. param: mixed the data to be merged with, must be an array or object implementing Traversable |
offsetExists($offset) X-Ref |
Returns whether there is an element at the specified offset. This method is required by the interface ArrayAccess. param: mixed the offset to check on return: boolean |
offsetGet($offset) X-Ref |
Returns the element at the specified offset. This method is required by the interface ArrayAccess. param: integer the offset to retrieve element. return: mixed the element at the offset, null if no element is found at the offset |
offsetSet($offset,$item) X-Ref |
Sets the element at the specified offset. This method is required by the interface ArrayAccess. param: integer the offset to set element param: mixed the element value |
offsetUnset($offset) X-Ref |
Unsets the element at the specified offset. This method is required by the interface ArrayAccess. param: mixed the offset to unset element |
Classe: TMapIterator - X-Ref
TMapIterator class__construct(&$data) X-Ref |
Constructor. param: array the data to be iterated through |
rewind() X-Ref |
Rewinds internal array pointer. This method is required by the interface Iterator. |
key() X-Ref |
Returns the key of the current array element. This method is required by the interface Iterator. return: mixed the key of the current array element |
current() X-Ref |
Returns the current array element. This method is required by the interface Iterator. return: mixed the current array element |
next() X-Ref |
Moves the internal pointer to the next array element. This method is required by the interface Iterator. |
valid() X-Ref |
Returns whether there is an element at current position. This method is required by the interface Iterator. return: boolean |
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |