UNPKG

qminer

Version:

A C++ based data analytics platform for processing large-scale real-time streams containing structured and unstructured data

186 lines (182 loc) 8.17 kB
<!doctype html> <html> <head> <meta name="generator" content="JSDoc 3"> <meta charset="utf-8"> <title>Class: Iterator</title> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link href="css/baseline.css" rel="stylesheet"> </head> <body onload="prettyPrint()"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-content"> <a href="index.html" class="jsdoc-navbar-package-name">QMiner JavaScript API v9.4.0</a> </div> </div> </nav> <div id="jsdoc-body-container"> <div id="jsdoc-content"> <div id="jsdoc-content-container"> <div id="jsdoc-main" role="main"> <header class="page-header"> <div class="symbol-detail-labels"><span class="label label-kind">class</span>&nbsp;<span class="label label-static">static</span></div> <h1><small><a href="module-qm.html">qm</a>.<wbr></small><span class="symbol-name">Iterator</span></h1> <p class="source-link">Source: <a href="qminerdoc.js.html#source-line-2518">qminerdoc.<wbr>js:2518</a></p> <dl class="dl-compact"> </dl> </header> <section id="summary"> <div class="summary-callout"> <h2 class="summary-callout-heading">Properties</h2> <div class="summary-content"> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Iterator.html#record">record</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Iterator.html#store">store</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> </div> </div> </div> <div class="summary-callout"> <h2 class="summary-callout-heading">Method</h2> <div class="summary-content"> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Iterator.html#next">next()</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> </div> <div class="summary-column"> </div> </div> </div> </section> <section> <h2 id="Iterator"><span class="symbol-name">Iterator</span><span class="signature"><span class="signature-params">()</span></span></h2> <p>Store Iterators allows you to iterate through the records in the store. <br> <b>Factory pattern</b>: this class cannot be construced using the new keyword. It is constructed by calling a specific method or attribute, e.g. calling <a href="module-qm.Store.html#forwardIter">module:qm.Store#forwardIter</a> to construct the Iterator. </p> <section> <h3> Example </h3> <div> <pre class="prettyprint"><code>// import qm module qm &#x3D; require(&#x27;qminer&#x27;); // create a new base with a simple store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot; }); base.createStore({ name: &quot;People&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;Gender&quot;, type: &quot;string&quot; } ] }); // add new records to the store base.store(&quot;People&quot;).push({ Name: &quot;Geronimo&quot;, Gender: &quot;Male&quot; }); base.store(&quot;People&quot;).push({ Name: &quot;Pochahontas&quot;, Gender: &quot;Female&quot; }); base.store(&quot;People&quot;).push({ Name: &quot;John Rolfe&quot;, Gender: &quot;Male&quot; }); base.store(&quot;People&quot;).push({ Name: &quot;John Smith&quot;, Gender: &quot;Male&quot;}); // factory based construction with forwardIter var iter &#x3D; base.store(&quot;People&quot;).forwardIter; base.close();</code></pre> </div> </section> <dl class="dl-compact"> </dl> </section> <section> <h2>Properties</h2> <section> <h3 id="record"><span class="symbol-name">record</span></h3> <p>Gives the current record. Type <a href="module-qm.Record.html">module:qm.Record</a>.</p> <dl class="dl-compact"> </dl> <h3 id="store"><span class="symbol-name">store</span></h3> <p>Gives the store of the iterator. Type <a href="module-qm.Store.html">module:qm.Store</a>.</p> <dl class="dl-compact"> </dl> </section> <h2>Method</h2> <section> <h3 id="next"><span class="symbol-name">next</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3> <p>Moves to the next record.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;TheWitcherSaga&quot;, fields: [ { name: &quot;Title&quot;, type: &quot;string&quot; }, { name: &quot;YearOfRelease&quot;, type: &quot;int&quot; }, { name: &quot;EnglishEdition&quot;, type: &quot;bool&quot; } ] }] }); // put some records in the store base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Blood of Elves&quot;, YearOfRelease: 1994, EnglishEdition: true }); base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Time of Contempt&quot;, YearOfRelease: 1995, EnglishEdition: true }); base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Baptism of Fire&quot;, YearOfRelease: 1996, EnglishEdition: true }); base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;The Swallow&#x27;s Tower&quot;, YearOfRelease: 1997, EnglishEdition: false }); base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Lady of the Lake&quot;, YearOfRelease: 1999, EnglishEdition: false }); base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Season of Storms&quot;, YearOfRelease: 2013, EnglishEdition: false }); // create an iterator for the store var iter &#x3D; base.store(&quot;TheWitcherSaga&quot;).forwardIter; // go to the first record in the store iter.next(); // returns true base.close();</code></pre> </div> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>boolean</code>B <br>1. <code>True</code>, if the iteration successfully moves to the next record. <br>2. <code>False</code>, if there is no record left. </p> </dd> </dl> </section> </section> </div> </div> <nav id="jsdoc-toc-nav" role="navigation"></nav> </div> </div> <footer id="jsdoc-footer" class="jsdoc-footer"> <div id="jsdoc-footer-container"> <p> </p> </div> </footer> <script src="scripts/jquery.min.js"></script> <script src="scripts/tree.jquery.js"></script> <script src="scripts/prettify.js"></script> <script src="scripts/jsdoc-toc.js"></script> <script src="scripts/linenumber.js"></script> <script src="scripts/scrollanchor.js"></script> </body> </html>