711 lines
No EOL
38 KiB
HTML
711 lines
No EOL
38 KiB
HTML
<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>YAHOO.ext.util.MixedCollection</title>
|
|
<link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
|
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
|
|
<link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
|
|
</head>
|
|
<body>
|
|
<div class="body-wrap">
|
|
<div class="top-tools"><img src="../resources/print.gif" width="16" height="16" align="absmiddle"> <a href="YAHOO.ext.util.MixedCollection.html" target="_blank">Print Friendly</a></div>
|
|
<h1>Class YAHOO.ext.util.MixedCollection</h1>
|
|
<table cellspacing="0">
|
|
<tr><td class="label">Package:</td><td>YAHOO.ext.util</td></tr>
|
|
<tr><td class="label">Class:</td><td>MixedCollection</td></tr>
|
|
<tr><td class="label">Extends:</td><td>Object</td></tr>
|
|
<tr><td class="label">Defined In:</td><td><a href="MixedCollection.js.html">MixedCollection.js</a></td></tr>
|
|
</table>
|
|
<div class="description">
|
|
A Collection class that maintains both numeric indexes and keys and exposes events.<br> </div>
|
|
<hr />
|
|
<a name="properties"></a>
|
|
<h2>Public Properties</h2>
|
|
<div class="no-members">This class has no public properties.</div> <a name="methods"></a>
|
|
<h2>Public Methods</h2>
|
|
<table cellspacing="0" class="member-table">
|
|
<tr>
|
|
<th class="sig-header" colspan="2">Method</th>
|
|
<th class="msource-header">Defined By</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#MixedCollection">MixedCollection</a>(<code>Boolean allowFunctions</code>)</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc"></td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#add">add</a>(<code>String key</code>, <code>Object o</code>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Adds an item to the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#addAll">addAll</a>(<code>Object/Array objs</code>) : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Adds all elements of an Array or an Object to the collection.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#clear">clear</a>() : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Removes all items from the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#contains">contains</a>(<code>Object o</code>) : Boolean</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Returns true if the collection contains the passed Object as an item.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#containsKey">containsKey</a>(<code>String key</code>) : Boolean</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Returns true if the collection contains the passed Object as a key.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#each">each</a>(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>) : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Executes the specified function once for every item in the collection, passing each
|
|
item as the first and only parame...</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#eachKey">eachKey</a>(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>) : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Executes the specified function once for every key in the collection, passing each
|
|
key, and its associated item as th...</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#find">find</a>(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Returns the first item in the collection which elicits a true return value from the
|
|
passed selection function.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#first">first</a>() : Boolean</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Returns the first item in the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#get">get</a>(<code>String/Number key</code>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Returns the item associated with the passed key or index.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#getCount">getCount</a>() : Number</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Returns the number of items in the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#getKey">getKey</a>(<code>o {Object}</code>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">MixedCollection has a generic way to fetch keys if you implement getKey.
|
|
|
|
// normal way
|
|
var mc = new Y...</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#indexOf">indexOf</a>(<code>Object o</code>) : Number</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Returns index within the collection of the passed Object.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#indexOfKey">indexOfKey</a>(<code>String key</code>) : Number</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Returns index within the collection of the passed key.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#insert">insert</a>(<code>Number index</code>, <code>String key</code>, <span class="optional" title="Optional">[<code>Object o</code>]</span>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Inserts an item at the specified index in the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#item">item</a>(<code>String/Number key</code>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Returns the item associated with the passed key.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#last">last</a>() : Boolean</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Returns the last item in the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#remove">remove</a>(<code>Object o</code>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Removed an item from the collection.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#removeAt">removeAt</a>(<code>Number index</code>) : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Remove an item from a specified index in the collection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#removeKey">removeKey</a>(<code>String key</code>) : void</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Removed an item associated with the passed key fom the collection.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#replace">replace</a>(<code>String key</code>, <span class="optional" title="Optional">[<code>o {Object}</code>]</span>) : Object</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Replaces an item in the collection.</td>
|
|
</tr>
|
|
</table>
|
|
<a name="events"></a>
|
|
<h2>Public Events</h2>
|
|
<table cellspacing="0" class="member-table">
|
|
<tr>
|
|
<th class="sig-header" colspan="2">Event</th>
|
|
<th class="msource-header">Defined By</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#event-add">add</a> : (<code>Number index</code>, <code>Object o</code>, <code>String key</code>)</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Fires when an item is added to the collection.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#event-clear">clear</a> : ()</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Fires when the collection is cleared.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#event-remove">remove</a> : (<code>Object o</code>, <span class="optional" title="Optional">[<code>String key</code>]</span>)</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="mdesc">Fires when an item is removed from the collection.</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="micon" rowspan="2"> </td>
|
|
<td class="sig"><a class="mlink" href="#event-replace">replace</a> : (<code>String key</code>, <code>Object old</code>, <code>Object new</code>)</td>
|
|
<td class="msource" rowspan="2">MixedCollection</td>
|
|
</tr>
|
|
<tr class="alt">
|
|
<td class="mdesc">Fires when an item is replaced in the collection.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<a name="MixedCollection"></a>
|
|
<h2 class="mdetail-head">Constructor Details</h2>
|
|
<div class="detail-wrap">
|
|
<div class="mdetail">
|
|
<h3>MixedCollection</i></h3>
|
|
<code>public function MixedCollection(<code>Boolean allowFunctions</code>)</code>
|
|
<div class="mdetail-desc">
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>allowFunctions</code> : Boolean<div class="sub-desc">True if the addAll function should add function references to the collection.</div></li> </ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="mdetail-head">Method Details</h2>
|
|
<div class="detail-wrap">
|
|
<a name="add"></a>
|
|
<div class="mdetail">
|
|
<h3>add</i></h3>
|
|
<code>public function add(<code>String key</code>, <code>Object o</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Adds an item to the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">The key to associate with the item</div></li><li><code>o</code> : Object<div class="sub-desc">The item to add.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The item added.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="addAll"></a>
|
|
<div class="mdetail alt">
|
|
<h3>addAll</i></h3>
|
|
<code>public function addAll(<code>Object/Array objs</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Adds all elements of an Array or an Object to the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>objs</code> : Object/Array<div class="sub-desc">An Object containing properties which will be added to the collection, or an Array of values, each of which are added to the collection.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="clear"></a>
|
|
<div class="mdetail">
|
|
<h3>clear</i></h3>
|
|
<code>public function clear()</code>
|
|
<div class="mdetail-desc">
|
|
Removes all items from the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li>None.</li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="contains"></a>
|
|
<div class="mdetail alt">
|
|
<h3>contains</i></h3>
|
|
<code>public function contains(<code>Object o</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns true if the collection contains the passed Object as an item.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>o</code> : Object<div class="sub-desc">The Object to look for in the collection.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Boolean</code><div class="sub-desc">True if the collection contains the Object as an item.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="containsKey"></a>
|
|
<div class="mdetail">
|
|
<h3>containsKey</i></h3>
|
|
<code>public function containsKey(<code>String key</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns true if the collection contains the passed Object as a key.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">The key to look for in the collection.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Boolean</code><div class="sub-desc">True if the collection contains the Object as a key.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="each"></a>
|
|
<div class="mdetail alt">
|
|
<h3>each</i></h3>
|
|
<code>public function each(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>)</code>
|
|
<div class="mdetail-desc">
|
|
Executes the specified function once for every item in the collection, passing each
|
|
item as the first and only parameter.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>fn</code> : Function<div class="sub-desc">The function to execute for each item.</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the function.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="eachKey"></a>
|
|
<div class="mdetail">
|
|
<h3>eachKey</i></h3>
|
|
<code>public function eachKey(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>)</code>
|
|
<div class="mdetail-desc">
|
|
Executes the specified function once for every key in the collection, passing each
|
|
key, and its associated item as the first two parameters.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>fn</code> : Function<div class="sub-desc">The function to execute for each item.</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the function.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="find"></a>
|
|
<div class="mdetail alt">
|
|
<h3>find</i></h3>
|
|
<code>public function find(<code>Function fn</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns the first item in the collection which elicits a true return value from the
|
|
passed selection function.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>fn</code> : Function<div class="sub-desc">The selection function to execute for each item.</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the function.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The first item in the collection which returned true from the selection function.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="first"></a>
|
|
<div class="mdetail">
|
|
<h3>first</i></h3>
|
|
<code>public function first()</code>
|
|
<div class="mdetail-desc">
|
|
Returns the first item in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li>None.</li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Boolean</code><div class="sub-desc">the first item in the collection..</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="get"></a>
|
|
<div class="mdetail alt">
|
|
<h3>get</i></h3>
|
|
<code>public function get(<code>String/Number key</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns the item associated with the passed key or index.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String/Number<div class="sub-desc">The key or index of the item.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The item associated with the passed key.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="getCount"></a>
|
|
<div class="mdetail">
|
|
<h3>getCount</i></h3>
|
|
<code>public function getCount()</code>
|
|
<div class="mdetail-desc">
|
|
Returns the number of items in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li>None.</li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Number</code><div class="sub-desc">the number of items in the collection.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="getKey"></a>
|
|
<div class="mdetail alt">
|
|
<h3>getKey</i></h3>
|
|
<code>public function getKey(<code>o {Object}</code>)</code>
|
|
<div class="mdetail-desc">
|
|
MixedCollection has a generic way to fetch keys if you implement getKey.
|
|
<pre><code>
|
|
// normal way
|
|
var mc = new YAHOO.ext.util.MixedCollection();
|
|
mc.add(someEl.dom.id, someEl);
|
|
mc.add(otherEl.dom.id, otherEl);
|
|
//and so on
|
|
|
|
// using getKey
|
|
var mc = new YAHOO.ext.util.MixedCollection();
|
|
mc.getKey = function(el){
|
|
return el.dom.id;
|
|
}
|
|
mc.add(someEl);
|
|
mc.add(otherEl);
|
|
// etc
|
|
</code>
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>{Object}</code> : o<div class="sub-desc">The item for which to find the key.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The key for the passed item.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="indexOf"></a>
|
|
<div class="mdetail">
|
|
<h3>indexOf</i></h3>
|
|
<code>public function indexOf(<code>Object o</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns index within the collection of the passed Object.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>o</code> : Object<div class="sub-desc">The item to find the index of.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Number</code><div class="sub-desc">index of the item.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="indexOfKey"></a>
|
|
<div class="mdetail alt">
|
|
<h3>indexOfKey</i></h3>
|
|
<code>public function indexOfKey(<code>String key</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns index within the collection of the passed key.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">The key to find the index of.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Number</code><div class="sub-desc">index of the key.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="insert"></a>
|
|
<div class="mdetail">
|
|
<h3>insert</i></h3>
|
|
<code>public function insert(<code>Number index</code>, <code>String key</code>, <span class="optional" title="Optional">[<code>Object o</code>]</span>)</code>
|
|
<div class="mdetail-desc">
|
|
Inserts an item at the specified index in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>index</code> : Number<div class="sub-desc">The index to insert the item at.</div></li><li><code>key</code> : String<div class="sub-desc">The key to associate with the new item, or the item itself.</div></li><li><code>o</code> : Object<div class="sub-desc">(optional) If the second parameter was a key, the new item.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The item inserted.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="item"></a>
|
|
<div class="mdetail alt">
|
|
<h3>item</i></h3>
|
|
<code>public function item(<code>String/Number key</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Returns the item associated with the passed key.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String/Number<div class="sub-desc">The key or index of the item.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The item associated with the passed key.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="last"></a>
|
|
<div class="mdetail">
|
|
<h3>last</i></h3>
|
|
<code>public function last()</code>
|
|
<div class="mdetail-desc">
|
|
Returns the last item in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li>None.</li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Boolean</code><div class="sub-desc">the last item in the collection..</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="remove"></a>
|
|
<div class="mdetail alt">
|
|
<h3>remove</i></h3>
|
|
<code>public function remove(<code>Object o</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Removed an item from the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>o</code> : Object<div class="sub-desc">The item to remove.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The item removed.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="removeAt"></a>
|
|
<div class="mdetail">
|
|
<h3>removeAt</i></h3>
|
|
<code>public function removeAt(<code>Number index</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Remove an item from a specified index in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>index</code> : Number<div class="sub-desc">The index within the collection of the item to remove.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="removeKey"></a>
|
|
<div class="mdetail alt">
|
|
<h3>removeKey</i></h3>
|
|
<code>public function removeKey(<code>String key</code>)</code>
|
|
<div class="mdetail-desc">
|
|
Removed an item associated with the passed key fom the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">The key of the item to remove.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>void</code></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="replace"></a>
|
|
<div class="mdetail">
|
|
<h3>replace</i></h3>
|
|
<code>public function replace(<code>String key</code>, <span class="optional" title="Optional">[<code>o {Object}</code>]</span>)</code>
|
|
<div class="mdetail-desc">
|
|
Replaces an item in the collection.
|
|
<div class="mdetail-params">
|
|
<strong>Parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">The key associated with the item to replace, or the item to replace.</div></li><li><code>{Object}</code> : o<div class="sub-desc">o (optional) If the first parameter passed was a key, the item to associate with that key.</div></li> </ul>
|
|
<strong>Returns:</strong>
|
|
<ul>
|
|
<li><code>Object</code><div class="sub-desc">The new item.</div></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This method is defined by MixedCollection.</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="mdetail-head">Event Details</h2>
|
|
<div class="detail-wrap">
|
|
<a name="event-add"></a>
|
|
<div class="mdetail">
|
|
<h3>add</i></h3>
|
|
<code>public event add</code>
|
|
<div class="mdetail-desc">
|
|
Fires when an item is added to the collection.
|
|
<div class="mdetail-params">
|
|
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
|
|
<ul><li><code>index</code> : Number<div class="sub-desc">The index at which the item was added.</div></li><li><code>o</code> : Object<div class="sub-desc">The item added.</div></li><li><code>key</code> : String<div class="sub-desc">The key associated with the added item.</div></li> </ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This event is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="event-clear"></a>
|
|
<div class="mdetail alt">
|
|
<h3>clear</i></h3>
|
|
<code>public event clear</code>
|
|
<div class="mdetail-desc">
|
|
Fires when the collection is cleared.
|
|
<div class="mdetail-params">
|
|
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
|
|
<ul><li>None.</li> </ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This event is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="event-remove"></a>
|
|
<div class="mdetail">
|
|
<h3>remove</i></h3>
|
|
<code>public event remove</code>
|
|
<div class="mdetail-desc">
|
|
Fires when an item is removed from the collection.
|
|
<div class="mdetail-params">
|
|
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
|
|
<ul><li><code>o</code> : Object<div class="sub-desc">The item being removed.</div></li><li><code>key</code> : String<div class="sub-desc">(optional) The key associated with the removed item.</div></li> </ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This event is defined by MixedCollection.</div>
|
|
</div>
|
|
<a name="event-replace"></a>
|
|
<div class="mdetail alt">
|
|
<h3>replace</i></h3>
|
|
<code>public event replace</code>
|
|
<div class="mdetail-desc">
|
|
Fires when an item is replaced in the collection.
|
|
<div class="mdetail-params">
|
|
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
|
|
<ul><li><code>key</code> : String<div class="sub-desc">he key associated with the new added.</div></li><li><code>old</code> : Object<div class="sub-desc">The item being replaced.</div></li><li><code>new</code> : Object<div class="sub-desc">The new item.</div></li> </ul>
|
|
</div>
|
|
</div>
|
|
<div class="mdetail-def">This event is defined by MixedCollection.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
Copyright © 2006 Jack Slocum. All rights reserved.
|
|
</body>
|
|
</html>
|
|
|