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
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> <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 = require('qminer');
// create a new base with a simple store
var base = new qm.Base({ mode: "createClean" });
base.createStore({
name: "People",
fields: [
{ name: "Name", type: "string" },
{ name: "Gender", type: "string" }
]
});
// add new records to the store
base.store("People").push({ Name: "Geronimo", Gender: "Male" });
base.store("People").push({ Name: "Pochahontas", Gender: "Female" });
base.store("People").push({ Name: "John Rolfe", Gender: "Male" });
base.store("People").push({ Name: "John Smith", Gender: "Male"});
// factory based construction with forwardIter
var iter = base.store("People").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> → <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 = require('qminer');
// create a new base containing one store
var base = new qm.Base({
mode: "createClean",
schema: [{
name: "TheWitcherSaga",
fields: [
{ name: "Title", type: "string" },
{ name: "YearOfRelease", type: "int" },
{ name: "EnglishEdition", type: "bool" }
]
}]
});
// put some records in the store
base.store("TheWitcherSaga").push({ Title: "Blood of Elves", YearOfRelease: 1994, EnglishEdition: true });
base.store("TheWitcherSaga").push({ Title: "Time of Contempt", YearOfRelease: 1995, EnglishEdition: true });
base.store("TheWitcherSaga").push({ Title: "Baptism of Fire", YearOfRelease: 1996, EnglishEdition: true });
base.store("TheWitcherSaga").push({ Title: "The Swallow's Tower", YearOfRelease: 1997, EnglishEdition: false });
base.store("TheWitcherSaga").push({ Title: "Lady of the Lake", YearOfRelease: 1999, EnglishEdition: false });
base.store("TheWitcherSaga").push({ Title: "Season of Storms", YearOfRelease: 2013, EnglishEdition: false });
// create an iterator for the store
var iter = base.store("TheWitcherSaga").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>