module-barejs_polyfill.EntryStore.html 17 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: EntryStore</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: EntryStore</h1>
  17. <section>
  18. <header>
  19. <h2><span class="attribs"><span class="type-signature"></span></span>
  20. <span class="ancestors"><a href="module-barejs_polyfill.html">barejs/polyfill</a>.</span>EntryStore<span class="signature">(_iterable<span class="signature-attributes">opt</span>, _pair<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
  21. </header>
  22. <article>
  23. <div class="container-overview">
  24. <h4 class="name" id="EntryStore"><span class="type-signature"></span>new EntryStore<span class="signature">(_iterable<span class="signature-attributes">opt</span>, _pair<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  25. <div class="description">
  26. <p>EntryStore provides the actual Map (and Set) implementation. Its implementation is shaped by two features:</p>
  27. <ol>
  28. <li>Attempt to achieve the O(1) lookup time of the native Map and Set types (for String and Number values).</li>
  29. <li>Support iterators according to the spec.</li>
  30. </ol>
  31. <p>Since we don't want to track iterators (as that would keep them alive indefinitely if iteration is aborted before end),
  32. the EntryStore never re-uses or changes an entry index.
  33. This allows iterators to keep pointing at a specific entry index, and look at the actual situation during the next call.</p>
  34. </div>
  35. <h5>Parameters:</h5>
  36. <table class="params">
  37. <thead>
  38. <tr>
  39. <th>Name</th>
  40. <th>Type</th>
  41. <th>Attributes</th>
  42. <th class="last">Description</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <tr>
  47. <td class="name"><code>_iterable</code></td>
  48. <td class="type">
  49. <span class="param-type">*</span>
  50. </td>
  51. <td class="attributes">
  52. &lt;optional><br>
  53. </td>
  54. <td class="description last"><p>Optional: an iterable whose values will be added to the EntryStore.</p></td>
  55. </tr>
  56. <tr>
  57. <td class="name"><code>_pair</code></td>
  58. <td class="type">
  59. <span class="param-type">boolean</span>
  60. </td>
  61. <td class="attributes">
  62. &lt;optional><br>
  63. </td>
  64. <td class="description last"><p>Optional: if the EntryStore is used for a Map, this should be true
  65. (iterable's values should be interpreted as key-value pairs, not as single values).</p></td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. <dl class="details">
  70. <dt class="tag-source">Source:</dt>
  71. <dd class="tag-source"><ul class="dummy"><li>
  72. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line14">line 14</a>
  73. </li></ul></dd>
  74. </dl>
  75. </div>
  76. <h3 class="subsection-title">Classes</h3>
  77. <dl>
  78. <dt><a href="module-barejs_polyfill.EntryStore.Iterator.html">Iterator</a></dt>
  79. <dd></dd>
  80. </dl>
  81. <h3 class="subsection-title">Methods</h3>
  82. <h4 class="name" id="_nxt"><span class="type-signature"></span>_nxt<span class="signature">(_start)</span><span class="type-signature"> &rarr; {number}</span></h4>
  83. <div class="description">
  84. <p>Find the next valid index, starting at _start</p>
  85. </div>
  86. <h5>Parameters:</h5>
  87. <table class="params">
  88. <thead>
  89. <tr>
  90. <th>Name</th>
  91. <th>Type</th>
  92. <th class="last">Description</th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <tr>
  97. <td class="name"><code>_start</code></td>
  98. <td class="type">
  99. <span class="param-type">number</span>
  100. </td>
  101. <td class="description last"><p>The index to start looking at. If _start is in entries, start is returned.</p></td>
  102. </tr>
  103. </tbody>
  104. </table>
  105. <dl class="details">
  106. <dt class="tag-source">Source:</dt>
  107. <dd class="tag-source"><ul class="dummy"><li>
  108. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line63">line 63</a>
  109. </li></ul></dd>
  110. </dl>
  111. <h5>Returns:</h5>
  112. <div class="param-desc">
  113. <p>The next valid index, or -1 if there is no next entry.</p>
  114. </div>
  115. <dl>
  116. <dt>
  117. Type
  118. </dt>
  119. <dd>
  120. <span class="param-type">number</span>
  121. </dd>
  122. </dl>
  123. <h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4>
  124. <div class="description">
  125. <p>Clear the EntryStore, removing all keys and associated values.</p>
  126. </div>
  127. <dl class="details">
  128. <dt class="tag-source">Source:</dt>
  129. <dd class="tag-source"><ul class="dummy"><li>
  130. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line181">line 181</a>
  131. </li></ul></dd>
  132. </dl>
  133. <h4 class="name" id="forEach"><span class="type-signature"></span>forEach<span class="signature">(_iterated, Callback:, _thisArg<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  134. <div class="description">
  135. <p>Iterate the EntryStore (on behalf of _iterated)</p>
  136. </div>
  137. <h5>Parameters:</h5>
  138. <table class="params">
  139. <thead>
  140. <tr>
  141. <th>Name</th>
  142. <th>Type</th>
  143. <th>Attributes</th>
  144. <th class="last">Description</th>
  145. </tr>
  146. </thead>
  147. <tbody>
  148. <tr>
  149. <td class="name"><code>_iterated</code></td>
  150. <td class="type">
  151. <span class="param-type"><a href="module-barejs_polyfill.EntryStore.html">module:barejs/polyfill.EntryStore</a></span>
  152. </td>
  153. <td class="attributes">
  154. </td>
  155. <td class="description last"><p>The object to report as being iterated.
  156. Since the EntryStore is an internal object to be used by a Set or Map it has to report the correct object.</p></td>
  157. </tr>
  158. <tr>
  159. <td class="name"><code>Callback:</code></td>
  160. <td class="type">
  161. <span class="param-type">function</span>
  162. </td>
  163. <td class="attributes">
  164. </td>
  165. <td class="description last"><p>the iterator callback to call for every entry. Called with ( &lt;key&gt;, &lt;value&gt;, _iterated ).</p></td>
  166. </tr>
  167. <tr>
  168. <td class="name"><code>_thisArg</code></td>
  169. <td class="type">
  170. <span class="param-type">object</span>
  171. </td>
  172. <td class="attributes">
  173. &lt;optional><br>
  174. </td>
  175. <td class="description last"><p>Optional: object to use as context for the callback function</p></td>
  176. </tr>
  177. </tbody>
  178. </table>
  179. <dl class="details">
  180. <dt class="tag-source">Source:</dt>
  181. <dd class="tag-source"><ul class="dummy"><li>
  182. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line204">line 204</a>
  183. </li></ul></dd>
  184. </dl>
  185. <h4 class="name" id="indexOf"><span class="type-signature"></span>indexOf<span class="signature">(_key, _key)</span><span class="type-signature"> &rarr; {number}</span></h4>
  186. <div class="description">
  187. <p>Find the entry index for a key</p>
  188. </div>
  189. <h5>Parameters:</h5>
  190. <table class="params">
  191. <thead>
  192. <tr>
  193. <th>Name</th>
  194. <th>Type</th>
  195. <th class="last">Description</th>
  196. </tr>
  197. </thead>
  198. <tbody>
  199. <tr>
  200. <td class="name"><code>_key</code></td>
  201. <td class="type">
  202. </td>
  203. <td class="description last"><p>The key to get the entry index for</p></td>
  204. </tr>
  205. <tr>
  206. <td class="name"><code>_key</code></td>
  207. <td class="type">
  208. </td>
  209. <td class="description last"><p>The key to get the entry index for</p></td>
  210. </tr>
  211. </tbody>
  212. </table>
  213. <dl class="details">
  214. <dt class="tag-source">Source:</dt>
  215. <dd class="tag-source"><ul class="dummy"><li>
  216. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line77">line 77</a>
  217. </li></ul></dd>
  218. </dl>
  219. <h5>Returns:</h5>
  220. <div class="param-desc">
  221. <p>The entry index, or -1</p>
  222. </div>
  223. <dl>
  224. <dt>
  225. Type
  226. </dt>
  227. <dd>
  228. <span class="param-type">number</span>
  229. </dd>
  230. </dl>
  231. <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(_key)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  232. <div class="description">
  233. <p>Remove _key from the EntryStore</p>
  234. </div>
  235. <h5>Parameters:</h5>
  236. <table class="params">
  237. <thead>
  238. <tr>
  239. <th>Name</th>
  240. <th>Type</th>
  241. <th class="last">Description</th>
  242. </tr>
  243. </thead>
  244. <tbody>
  245. <tr>
  246. <td class="name"><code>_key</code></td>
  247. <td class="type">
  248. <span class="param-type">*</span>
  249. </td>
  250. <td class="description last"><p>The key to remove the value for</p></td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. <dl class="details">
  255. <dt class="tag-source">Source:</dt>
  256. <dd class="tag-source"><ul class="dummy"><li>
  257. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line133">line 133</a>
  258. </li></ul></dd>
  259. </dl>
  260. <h5>Returns:</h5>
  261. <div class="param-desc">
  262. <p>True if the value for _key got removed, false otherwise.</p>
  263. </div>
  264. <dl>
  265. <dt>
  266. Type
  267. </dt>
  268. <dd>
  269. <span class="param-type">boolean</span>
  270. </dd>
  271. </dl>
  272. <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(_key, _value)</span><span class="type-signature"></span></h4>
  273. <div class="description">
  274. <p>Set the entry for a key</p>
  275. </div>
  276. <h5>Parameters:</h5>
  277. <table class="params">
  278. <thead>
  279. <tr>
  280. <th>Name</th>
  281. <th>Type</th>
  282. <th class="last">Description</th>
  283. </tr>
  284. </thead>
  285. <tbody>
  286. <tr>
  287. <td class="name"><code>_key</code></td>
  288. <td class="type">
  289. <span class="param-type">*</span>
  290. </td>
  291. <td class="description last"><p>The key for the value.</p></td>
  292. </tr>
  293. <tr>
  294. <td class="name"><code>_value</code></td>
  295. <td class="type">
  296. <span class="param-type">*</span>
  297. </td>
  298. <td class="description last"><p>The value to set.</p></td>
  299. </tr>
  300. </tbody>
  301. </table>
  302. <dl class="details">
  303. <dt class="tag-source">Source:</dt>
  304. <dd class="tag-source"><ul class="dummy"><li>
  305. <a href="polyfill_EntryStore.js.html">polyfill/EntryStore.js</a>, <a href="polyfill_EntryStore.js.html#line95">line 95</a>
  306. </li></ul></dd>
  307. </dl>
  308. </article>
  309. </section>
  310. </div>
  311. <nav>
  312. <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-barejs.html">barejs</a></li><li><a href="module-barejs_polyfill.html">barejs/polyfill</a></li><li><a href="module-barejs_polyfill_Intl.html">barejs/polyfill/Intl</a></li></ul><h3>Classes</h3><ul><li><a href="module-barejs.decl.html">decl</a></li><li><a href="module-barejs.decl-Enum.html">Enum</a></li><li><a href="module-barejs.decl-Interface.html">Interface</a></li><li><a href="module-barejs.decl-SpecialType.html">SpecialType</a></li><li><a href="module-barejs.Destroyable.html">Destroyable</a></li><li><a href="module-barejs.EventArgs.html">EventArgs</a></li><li><a href="module-barejs.Evented.html">Evented</a></li><li><a href="module-barejs.Evented-EventedHandle.html">EventedHandle</a></li><li><a href="module-barejs.Exception.html">Exception</a></li><li><a href="module-barejs_polyfill.Array.html">Array</a></li><li><a href="module-barejs_polyfill.Date.html">Date</a></li><li><a href="module-barejs_polyfill.EntryStore.html">EntryStore</a></li><li><a href="module-barejs_polyfill.EntryStore.Iterator.html">Iterator</a></li><li><a href="module-barejs_polyfill.Function.html">Function</a></li><li><a href="module-barejs_polyfill.Map.html">Map</a></li><li><a href="module-barejs_polyfill.Map-MapIterator.html">MapIterator</a></li><li><a href="module-barejs_polyfill.Math.html">Math</a></li><li><a href="module-barejs_polyfill.Number.html">Number</a></li><li><a href="module-barejs_polyfill.Object.html">Object</a></li><li><a href="module-barejs_polyfill.Promise.html">Promise</a></li><li><a href="module-barejs_polyfill.Set.html">Set</a></li><li><a href="module-barejs_polyfill.Set-SetIterator.html">SetIterator</a></li><li><a href="module-barejs_polyfill.String.html">String</a></li><li><a href="module-barejs_polyfill.Symbol.html">Symbol</a></li><li><a href="module-barejs_polyfill.WeakMap.html">WeakMap</a></li><li><a href="module-barejs_polyfill.WeakSet.html">WeakSet</a></li><li><a href="module-barejs_polyfill_Intl.DateTimeFormat.html">DateTimeFormat</a></li><li><a href="module-barejs_polyfill_Intl.DateTimeFormat-DateTimeFormatOptions.html">DateTimeFormatOptions</a></li><li><a href="module-barejs_polyfill_Intl.NumberFormat.html">NumberFormat</a></li><li><a href="module-barejs_polyfill_Intl.NumberFormat-NumberFormatOptions.html">NumberFormatOptions</a></li><li><a href="module-barejs_polyfill_Intl-Format.html">Format</a></li></ul>
  313. </nav>
  314. <br class="clear">
  315. <footer>
  316. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 03 2018 15:59:34 GMT+0200 (W. Europe Daylight Time)
  317. </footer>
  318. <script> prettyPrint(); </script>
  319. <script src="scripts/linenumber.js"> </script>
  320. </body>
  321. </html>