| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (9) on Fri Oct 01 19:18:47 PDT 2021 --> |
| <title>ItemsSketch (datasketches-java 3.1.0-SNAPSHOT API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="date" content="2021-10-01"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-1.10.2.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ItemsSketch (datasketches-java 3.1.0-SNAPSHOT API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":10,"i2":9,"i3":10,"i4":10,"i5":10,"i6":9,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":9,"i19":9,"i20":10,"i21":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../";loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ItemsSketch.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/frequencies/ItemsSketch.html" target="_top">Frames</a></li> |
| <li><a href="ItemsSketch.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><span>SEARCH: </span> |
| <input type="text" id="search" value=" " disabled="disabled"> |
| <input type="reset" id="reset" value=" " disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="../../../../org/apache/datasketches/frequencies/package-summary.html">org.apache.datasketches.frequencies</a></div> |
| <h2 title="Class ItemsSketch" class="title">Class ItemsSketch<T></h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.datasketches.frequencies.ItemsSketch<T></li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The type of item to be tracked by this sketch</dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">ItemsSketch<T></span> |
| extends <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block"><p>This sketch is useful for tracking approximate frequencies of items of type <i><T></i> |
| with optional associated counts (<i><T></i> item, <i>long</i> count) that are members of a |
| multiset of such items. The true frequency of an item is defined to be the sum of associated |
| counts.</p> |
| |
| <p>This implementation provides the following capabilities:</p> |
| <ul> |
| <li>Estimate the frequency of an item.</li> |
| <li>Return upper and lower bounds of any item, such that the true frequency is always |
| between the upper and lower bounds.</li> |
| <li>Return a global maximum error that holds for all items in the stream.</li> |
| <li>Return an array of frequent items that qualify either a NO_FALSE_POSITIVES or a |
| NO_FALSE_NEGATIVES error type.</li> |
| <li>Merge itself with another sketch object created from this class.</li> |
| <li>Serialize/Deserialize to/from a byte array.</li> |
| </ul> |
| |
| <p><b>Space Usage</b></p> |
| |
| <p>The sketch is initialized with a <i>maxMapSize</i> that specifies the maximum physical |
| length of the internal hash map of the form (<i><T></i> item, <i>long</i> count). |
| The <i>maxMapSize</i> must be a power of 2.</p> |
| |
| <p>The hash map starts at a very small size (8 entries), and grows as needed up to the |
| specified <i>maxMapSize</i>.</p> |
| |
| <p>Excluding external space required for the item objects, the internal memory space usage of |
| this sketch is 18 * <i>mapSize</i> bytes (assuming 8 bytes for each Java reference), plus a small |
| constant number of additional bytes. The internal memory space usage of this sketch will never |
| exceed 18 * <i>maxMapSize</i> bytes, plus a small constant number of additional bytes.</p> |
| |
| <p><b>Maximum Capacity of the Sketch</b></p> |
| |
| <p>The LOAD_FACTOR for the hash map is internally set at 75%, |
| which means at any time the map capacity of (item, count) pairs is <i>mapCap</i> = 0.75 * |
| <i>mapSize</i>. |
| The maximum capacity of (item, count) pairs of the sketch is <i>maxMapCap</i> = 0.75 * |
| <i>maxMapSize</i>.</p> |
| |
| <p><b>Updating the sketch with (item, count) pairs</b></p> |
| |
| <p>If the item is found in the hash map, the mapped count field (the "counter") is |
| incremented by the incoming count, otherwise, a new counter "(item, count) pair" is |
| created. If the number of tracked counters reaches the maximum capacity of the hash map |
| the sketch decrements all of the counters (by an approximately computed median), and |
| removes any non-positive counters.</p> |
| |
| <p><b>Accuracy</b></p> |
| |
| <p>If fewer than 0.75 * <i>maxMapSize</i> different items are inserted into the sketch the |
| estimated frequencies returned by the sketch will be exact.</p> |
| |
| <p>The logic of the frequent items sketch is such that the stored counts and true counts are |
| never too different. |
| More specifically, for any <i>item</i>, the sketch can return an estimate of the |
| true frequency of <i>item</i>, along with upper and lower bounds on the frequency |
| (that hold deterministically).</p> |
| |
| <p>For this implementation and for a specific active <i>item</i>, it is guaranteed that |
| the true frequency will be between the Upper Bound (UB) and the Lower Bound (LB) computed for |
| that <i>item</i>. Specifically, <i>(UB- LB) ≤ W * epsilon</i>, where <i>W</i> denotes the |
| sum of all item counts, and <i>epsilon = 3.5/M</i>, where <i>M</i> is the <i>maxMapSize</i>.</p> |
| |
| <p>This is a worst case guarantee that applies to arbitrary inputs.<sup>1</sup> |
| For inputs typically seen in practice <i>(UB-LB)</i> is usually much smaller. |
| </p> |
| |
| <p><b>Background</b></p> |
| |
| <p>This code implements a variant of what is commonly known as the "Misra-Gries |
| algorithm". Variants of it were discovered and rediscovered and redesigned several times |
| over the years:</p> |
| <ul><li>"Finding repeated elements", Misra, Gries, 1982</li> |
| <li>"Frequency estimation of Internet packet streams with limited space" Demaine, |
| Lopez-Ortiz, Munro, 2002</li> |
| <li>"A simple algorithm for finding frequent elements in streams and bags" Karp, Shenker, |
| Papadimitriou, 2003</li> |
| <li>"Efficient Computation of Frequent and Top-k Elements in Data Streams" Metwally, |
| Agrawal, Abbadi, 2006</li> |
| </ul> |
| |
| <sup>1</sup> For speed we do employ some randomization that introduces a small probability that |
| our proof of the worst-case bound might not apply to a given run. However, we have ensured |
| that this probability is extremely small. For example, if the stream causes one table purge |
| (rebuild), our proof of the worst case bound applies with probability at least 1 - 1E-14. |
| If the stream causes 1E9 purges, our proof applies with probability at least 1 - 1E-5.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd>Justin Thaler, Alexander Saydakov</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Class</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies">ItemsSketch.Row</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="type parameter in ItemsSketch.Row">T</a>></span></code></th> |
| <td class="colLast"> |
| <div class="block">Row class that defines the return values from a getFrequentItems query.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#ItemsSketch-int-">ItemsSketch</a></span>​(int maxMapSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Construct this sketch with the parameter maxMapSize and the default initialMapSize (8).</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getAprioriError-int-long-">getAprioriError</a></span>​(int maxMapSize, |
| long estimatedTotalStreamWeight)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the estimated <i>a priori</i> error given the maxMapSize for the sketch and the |
| estimatedTotalStreamWeight.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getCurrentMapCapacity--">getCurrentMapCapacity</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the current number of counters the sketch is configured to support.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getEpsilon-int-">getEpsilon</a></span>​(int maxMapSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns epsilon used to compute <i>a priori</i> error.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getEstimate-T-">getEstimate</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the estimate of the frequency of the given item.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies">ItemsSketch.Row</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>>[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getFrequentItems-long-org.apache.datasketches.frequencies.ErrorType-">getFrequentItems</a></span>​(long threshold, |
| <a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies">ErrorType</a> errorType)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns an array of Rows that include frequent items, estimates, upper and lower bounds |
| given a threshold and an ErrorCondition.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies">ItemsSketch.Row</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>>[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getFrequentItems-org.apache.datasketches.frequencies.ErrorType-">getFrequentItems</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies">ErrorType</a> errorType)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns an array of Rows that include frequent items, estimates, upper and lower bounds |
| given an ErrorCondition and the default threshold.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static <T> <a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><T></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getInstance-org.apache.datasketches.memory.Memory-org.apache.datasketches.ArrayOfItemsSerDe-">getInstance</a></span>​(org.apache.datasketches.memory.Memory srcMem, |
| <a href="../../../../org/apache/datasketches/ArrayOfItemsSerDe.html" title="class in org.apache.datasketches">ArrayOfItemsSerDe</a><T> serDe)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a sketch instance of this class from the given srcMem, |
| which must be a Memory representation of this sketch class.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getLowerBound-T-">getLowerBound</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the guaranteed lower bound frequency of the given item, which can never be |
| negative.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getMaximumError--">getMaximumError</a></span>​()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getMaximumMapCapacity--">getMaximumMapCapacity</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the maximum number of counters the sketch is configured to support.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getNumActiveItems--">getNumActiveItems</a></span>​()</code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getStreamLength--">getStreamLength</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the sum of the frequencies in the stream seen so far by the sketch</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#getUpperBound-T-">getUpperBound</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</code></th> |
| <td class="colLast"> |
| <div class="block">Gets the guaranteed upper bound frequency of the given item.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#isEmpty--">isEmpty</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if this sketch is empty</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#merge-org.apache.datasketches.frequencies.ItemsSketch-">merge</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>> other)</code></th> |
| <td class="colLast"> |
| <div class="block">This function merges the other sketch into this one.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#reset--">reset</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Resets this sketch to a virgin state.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#toByteArray-org.apache.datasketches.ArrayOfItemsSerDe-">toByteArray</a></span>​(<a href="../../../../org/apache/datasketches/ArrayOfItemsSerDe.html" title="class in org.apache.datasketches">ArrayOfItemsSerDe</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>> serDe)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a byte array representation of this sketch</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#toString--">toString</a></span>​()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a human readable summary of this sketch.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#toString-byte:A-">toString</a></span>​(byte[] byteArr)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a human readable string of the preamble of a byte array image of a ItemsSketch.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#toString-org.apache.datasketches.memory.Memory-">toString</a></span>​(org.apache.datasketches.memory.Memory mem)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a human readable string of the preamble of a Memory image of a ItemsSketch.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#update-T-">update</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</code></th> |
| <td class="colLast"> |
| <div class="block">Update this sketch with an item and a frequency count of one.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html#update-T-long-">update</a></span>​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item, |
| long count)</code></th> |
| <td class="colLast"> |
| <div class="block">Update this sketch with an item and a positive frequency count.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="ItemsSketch-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ItemsSketch</h4> |
| <pre>public ItemsSketch​(int maxMapSize)</pre> |
| <div class="block">Construct this sketch with the parameter maxMapSize and the default initialMapSize (8).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>maxMapSize</code> - Determines the physical size of the internal hash map managed by this |
| sketch and must be a power of 2. The maximum capacity of this internal hash map is |
| 0.75 times * maxMapSize. Both the ultimate accuracy and size of this sketch are |
| functions of maxMapSize.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getInstance-org.apache.datasketches.memory.Memory-org.apache.datasketches.ArrayOfItemsSerDe-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInstance</h4> |
| <pre>public static <T> <a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><T> getInstance​(org.apache.datasketches.memory.Memory srcMem, |
| <a href="../../../../org/apache/datasketches/ArrayOfItemsSerDe.html" title="class in org.apache.datasketches">ArrayOfItemsSerDe</a><T> serDe)</pre> |
| <div class="block">Returns a sketch instance of this class from the given srcMem, |
| which must be a Memory representation of this sketch class.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - The type of item that this sketch will track</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>srcMem</code> - a Memory representation of a sketch of this class. |
| <a href="../../../../resources/dictionary.html#mem">See Memory</a></dd> |
| <dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a sketch instance of this class.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getAprioriError-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAprioriError</h4> |
| <pre>public static double getAprioriError​(int maxMapSize, |
| long estimatedTotalStreamWeight)</pre> |
| <div class="block">Returns the estimated <i>a priori</i> error given the maxMapSize for the sketch and the |
| estimatedTotalStreamWeight.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>maxMapSize</code> - the planned map size to be used when constructing this sketch.</dd> |
| <dd><code>estimatedTotalStreamWeight</code> - the estimated total stream weight.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the estimated <i>a priori</i> error.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCurrentMapCapacity--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCurrentMapCapacity</h4> |
| <pre>public int getCurrentMapCapacity​()</pre> |
| <div class="block">Returns the current number of counters the sketch is configured to support.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the current number of counters the sketch is configured to support.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEpsilon-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEpsilon</h4> |
| <pre>public static double getEpsilon​(int maxMapSize)</pre> |
| <div class="block">Returns epsilon used to compute <i>a priori</i> error. |
| This is just the value <i>3.5 / maxMapSize</i>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>maxMapSize</code> - the planned map size to be used when constructing this sketch.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>epsilon used to compute <i>a priori</i> error.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEstimate-java.lang.Object-"> |
| <!-- --> |
| </a><a name="getEstimate-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEstimate</h4> |
| <pre>public long getEstimate​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</pre> |
| <div class="block">Gets the estimate of the frequency of the given item. |
| Note: The true frequency of a item would be the sum of the counts as a result of the |
| two update functions.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - the given item</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the estimate of the frequency of the given item</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getLowerBound-java.lang.Object-"> |
| <!-- --> |
| </a><a name="getLowerBound-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLowerBound</h4> |
| <pre>public long getLowerBound​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</pre> |
| <div class="block">Gets the guaranteed lower bound frequency of the given item, which can never be |
| negative.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - the given item.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the guaranteed lower bound frequency of the given item. That is, a number which |
| is guaranteed to be no larger than the real frequency.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getFrequentItems-long-org.apache.datasketches.frequencies.ErrorType-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFrequentItems</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies">ItemsSketch.Row</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>>[] getFrequentItems​(long threshold, |
| <a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies">ErrorType</a> errorType)</pre> |
| <div class="block">Returns an array of Rows that include frequent items, estimates, upper and lower bounds |
| given a threshold and an ErrorCondition. If the threshold is lower than getMaximumError(), |
| then getMaximumError() will be used instead. |
| |
| <p>The method first examines all active items in the sketch (items that have a counter). |
| |
| <p>If <i>ErrorType = NO_FALSE_NEGATIVES</i>, this will include an item in the result |
| list if getUpperBound(item) > threshold. |
| There will be no false negatives, i.e., no Type II error. |
| There may be items in the set with true frequencies less than the threshold |
| (false positives).</p> |
| |
| <p>If <i>ErrorType = NO_FALSE_POSITIVES</i>, this will include an item in the result |
| list if getLowerBound(item) > threshold. |
| There will be no false positives, i.e., no Type I error. |
| There may be items omitted from the set with true frequencies greater than the |
| threshold (false negatives).</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>threshold</code> - to include items in the result list</dd> |
| <dd><code>errorType</code> - determines whether no false positives or no false negatives are |
| desired.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an array of frequent items</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getFrequentItems-org.apache.datasketches.frequencies.ErrorType-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFrequentItems</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies">ItemsSketch.Row</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>>[] getFrequentItems​(<a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies">ErrorType</a> errorType)</pre> |
| <div class="block">Returns an array of Rows that include frequent items, estimates, upper and lower bounds |
| given an ErrorCondition and the default threshold. |
| This is the same as getFrequentItems(getMaximumError(), errorType)</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>errorType</code> - determines whether no false positives or no false negatives are |
| desired.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an array of frequent items</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaximumError--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaximumError</h4> |
| <pre>public long getMaximumError​()</pre> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>An upper bound on the maximum error of getEstimate(item) for any item. |
| This is equivalent to the maximum distance between the upper bound and the lower bound |
| for any item.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaximumMapCapacity--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaximumMapCapacity</h4> |
| <pre>public int getMaximumMapCapacity​()</pre> |
| <div class="block">Returns the maximum number of counters the sketch is configured to support.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the maximum number of counters the sketch is configured to support.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getNumActiveItems--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNumActiveItems</h4> |
| <pre>public int getNumActiveItems​()</pre> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of active items in the sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getStreamLength--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStreamLength</h4> |
| <pre>public long getStreamLength​()</pre> |
| <div class="block">Returns the sum of the frequencies in the stream seen so far by the sketch</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the sum of the frequencies in the stream seen so far by the sketch</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getUpperBound-java.lang.Object-"> |
| <!-- --> |
| </a><a name="getUpperBound-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUpperBound</h4> |
| <pre>public long getUpperBound​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</pre> |
| <div class="block">Gets the guaranteed upper bound frequency of the given item.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - the given item</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the guaranteed upper bound frequency of the given item. That is, a number which |
| is guaranteed to be no smaller than the real frequency.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isEmpty--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEmpty</h4> |
| <pre>public boolean isEmpty​()</pre> |
| <div class="block">Returns true if this sketch is empty</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if this sketch is empty</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="merge-org.apache.datasketches.frequencies.ItemsSketch-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>merge</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>> merge​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="class in org.apache.datasketches.frequencies">ItemsSketch</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>> other)</pre> |
| <div class="block">This function merges the other sketch into this one. |
| The other sketch may be of a different size.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>other</code> - sketch of this class</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a sketch whose estimates are within the guarantees of the |
| largest error tolerance of the two merged sketches.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="reset--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>reset</h4> |
| <pre>public void reset​()</pre> |
| <div class="block">Resets this sketch to a virgin state.</div> |
| </li> |
| </ul> |
| <a name="toByteArray-org.apache.datasketches.ArrayOfItemsSerDe-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toByteArray</h4> |
| <pre>public byte[] toByteArray​(<a href="../../../../org/apache/datasketches/ArrayOfItemsSerDe.html" title="class in org.apache.datasketches">ArrayOfItemsSerDe</a><<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>> serDe)</pre> |
| <div class="block">Returns a byte array representation of this sketch</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a byte array representation of this sketch</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString​()</pre> |
| <div class="block">Returns a human readable summary of this sketch.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code> in class <code><a href="https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a human readable summary of this sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString-byte:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public static <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString​(byte[] byteArr)</pre> |
| <div class="block">Returns a human readable string of the preamble of a byte array image of a ItemsSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>byteArr</code> - the given byte array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a human readable string of the preamble of a byte array image of a ItemsSketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString-org.apache.datasketches.memory.Memory-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public static <a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString​(org.apache.datasketches.memory.Memory mem)</pre> |
| <div class="block">Returns a human readable string of the preamble of a Memory image of a ItemsSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - the given Memory object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a human readable string of the preamble of a Memory image of a ItemsSketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="update-java.lang.Object-"> |
| <!-- --> |
| </a><a name="update-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre>public void update​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item)</pre> |
| <div class="block">Update this sketch with an item and a frequency count of one.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - for which the frequency should be increased.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="update-java.lang.Object-long-"> |
| <!-- --> |
| </a><a name="update-T-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre>public void update​(<a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.html" title="type parameter in ItemsSketch">T</a> item, |
| long count)</pre> |
| <div class="block">Update this sketch with an item and a positive frequency count.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - for which the frequency should be increased. The sketch uses |
| hashCode() and equals() methods of the type T.</dd> |
| <dd><code>count</code> - the amount by which the frequency of the item should be increased. |
| A count of zero is a no-op, and a negative count will throw an exception.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ItemsSketch.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/datasketches/frequencies/ErrorType.html" title="enum in org.apache.datasketches.frequencies"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/frequencies/ItemsSketch.Row.html" title="class in org.apache.datasketches.frequencies"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/frequencies/ItemsSketch.html" target="_top">Frames</a></li> |
| <li><a href="ItemsSketch.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2015–2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |