biorderediterator.html
来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· HTML 代码 · 共 265 行
HTML
265 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiOrderedIterator</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript"> function showDerivedClasses() { var ul = document.getElementById("api-derived-classes"); var lis = ul.childNodes; var l = lis.length; for (var i = 1; i < l; i++) lis[i].style.display = ""; lis[0].style.display = "none"; } </script></head><body><h1 id="BiOrderedIterator">BiOrderedIterator</h1><p>This is an ordered iterator that allows you to add items ordered by an index. The items are ordered based on the index and finding and removing an item based on its index is done in constant time. Inserting an item is in worst case O(n) (where n is the number of items in the iterator).</p><p>This class extends <code><a href="BiObject.html">BiObject</a></code> and therefore all methods and fields available for <code><a href="BiObject.html">BiObject</a></code> are also available for <code>BiOrderedIterator</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code>BiOrderedIterator</code><ul id="api-derived-classes"></ul></li></ul></li></ul><h2>Constructor</h2><p><code> new BiOrderedIterator()</code></p><h3>Parameters</h3><p>No parameters.</p><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="count"></a><code>count</code></td><td><code class="type">Number</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>The number of items in the iterator</td></tr><tr><td><a name="currentIndex"></a><code>currentIndex</code></td><td><code class="type">Number</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Returns the index of the curren item</td></tr><tr><td><a name="currentValue"></a><code>currentValue</code></td><td><code class="type">Object</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Returns the value for the current item.</td></tr><tr><td><a name="done"></a><code>done</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Whether the iterator is finished (has passed the end).</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#add">add</a></code></td><td>Adds an value with an index. Adding an item using an index that already exists in the iterator overwrites the old item.</td></tr><tr><td><code><a href="#containsIndex">containsIndex</a></code></td><td>Whether the iterator contains an item with the given index</td></tr><tr><td><code><a href="#first">first</a></code></td><td>Resets the iterator to the first item</td></tr><tr><td><code><a href="#getValueAt">getValueAt</a></code></td><td>Returns the value at the given index</td></tr><tr><td><code><a href="#next">next</a></code></td><td>Advances the iterator to the next item</td></tr><tr><td><code><a href="#remove">remove</a></code></td><td>Removes the item at the given index and returns it.</td></tr></tbody></table><h2>Events</h2><p>None.</p><h2>Static Methods</h2><p>None.</p><h2>Static Fields</h2><p>None.</p><h2>Remarks</h2><p> </p><h2>Method Details</h2><h3><a name="add"></a>add</h3><p>Adds an value with an index. Adding an item using an index that already exists in the iterator overwrites the old item.</p><h4>Syntax</h4><pre class="method-syntax">object.add(<span class="methodArgument">nIndex</span>, <span class="methodArgument">val</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index to order the value by.</td></tr><tr><td><code>val</code></td><td><code class="type">Object</code></td><td class="optional-column"></td><td></td><td>The value to add at the given index</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="containsIndex"></a>containsIndex</h3><p>Whether the iterator contains an item with the given index</p><h4>Syntax</h4><pre class="method-syntax">object.containsIndex(<span class="methodArgument">nIndex</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index to check for</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Boolean</code></p><h3><a name="first"></a>first</h3><p>Resets the iterator to the first item</p><h4>Syntax</h4><pre class="method-syntax">object.first()</pre><h4>Parameters</h4><p>No arguments.</p><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="getValueAt"></a>getValueAt</h3><p>Returns the value at the given index</p><h4>Syntax</h4><pre class="method-syntax">object.getValueAt(<span class="methodArgument">nIndex</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index to get the value for</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Object</code></p><h3><a name="next"></a>next</h3><p>Advances the iterator to the next item</p><h4>Syntax</h4><pre class="method-syntax">object.next()</pre><h4>Parameters</h4><p>No arguments.</p><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="remove"></a>remove</h3><p>Removes the item at the given index and returns it.</p><h4>Syntax</h4><pre class="method-syntax">object.remove(<span class="methodArgument">nIndex</span>)</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>nIndex</code></td><td><code class="type">Number</code></td><td class="optional-column"></td><td></td><td>The index of the value to remove</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Object</code></p></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?