This is one of the most heavily used classes within the framework. baseSet is a wrapper around an array with a set of methods to manipulate it. baseSet can be used directly or extended and made into more complex objects. It is used extensively internally whenever an array of objects needs to be moved around or maintained.
baseSet implements IteratorAggregate allowing it to be easily iterated via foreach.
public isModified()
Returns true if the list has been modified
public setModified([$inStatus = true])
Set modified to $status
public count()
Implementation of count for Countable interface
public getCount()
Returns the item count
protected _getItem([$inKey = null])
Returns item at index $key, or if null the whole list; returns false if item is not found
protected _setItem($inKey, [$inItem = null])
Add item(s) to the set
protected _setValue($inItem)
Adds the item to the Set if not already present
protected _removeItem($inKey)
Remove an item from the set
protected _removeItemWithValue($inItem)
Searches set for an item with value of $item and removes it
protected _resetSet()
Clears all set values and resets set to an empty array
protected _findItem($inItem)
Attempts to locate $inItem in the set and returns index if located
protected _itemKeyExists($inKey)
Returns true if $inKey already exists in set
protected _itemValueInSet($inItem)
Returns true if $inItem is in the set
protected _itemCount()
Returns the item count from the set
protected _mergeSets($inArray)
Merges the supplied array into the current set Note: should only be used with sets of the same data, may cause strange results
protected _reverseSet()
Reverses the data in the set maintaining any keys
public getIterator()
Returns the array when iterating the object
Posted by: Scorpio Documentor (Writer), in Base on 19 Nov 2009 @ 20:30
Tags: base, baseset, countable, iteratoraggregate, traversable,
This
work is licenced under a
Creative Commons Licence.