| <!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 (1.8.0_162) on Tue Aug 07 18:31:01 PDT 2018 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>HashOperations (com.yahoo.datasketches:sketches-core 0.12.1-SNAPSHOT API)</title> |
| <meta name="date" content="2018-08-07"> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="HashOperations (com.yahoo.datasketches:sketches-core 0.12.1-SNAPSHOT API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= 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/HashOperations.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="../../../com/yahoo/sketches/Family.html" title="enum in com.yahoo.sketches"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../com/yahoo/sketches/QuantilesHelper.html" title="class in com.yahoo.sketches"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?com/yahoo/sketches/HashOperations.html" target="_top">Frames</a></li> |
| <li><a href="HashOperations.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> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">com.yahoo.sketches</div> |
| <h2 title="Class HashOperations" class="title">Class HashOperations</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/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>com.yahoo.sketches.HashOperations</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public final class <span class="typeNameLabel">HashOperations</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">Helper class for the common hash table methods.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd>Lee Rhodes, Kevin Lang</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#STRIDE_MASK">STRIDE_MASK</a></span></code> |
| <div class="block">The stride mask for the Open Address, Double Hashing (OADH) hash table algorithm.</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" border="0" cellpadding="3" cellspacing="0" 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="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="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#checkHashCorruption-long-">checkHashCorruption</a></span>(long hash)</code> </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#checkThetaCorruption-long-">checkThetaCorruption</a></span>(long thetaLong)</code> </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#continueCondition-long-long-">continueCondition</a></span>(long thetaLong, |
| long hash)</code> |
| <div class="block">Return true (continue) if hash is greater than or equal to thetaLong, or if hash == 0, |
| or if hash == Long.MAX_VALUE.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#count-long:A-long-">count</a></span>(long[] srcArr, |
| long thetaLong)</code> |
| <div class="block">Counts the cardinality of the given source array.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#countPart-long:A-int-long-">countPart</a></span>(long[] srcArr, |
| int lgArrLongs, |
| long thetaLong)</code> |
| <div class="block">Counts the cardinality of the first Log2 values of the given source array.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#fastHashInsertOnly-com.yahoo.memory.WritableMemory-int-long-int-">fastHashInsertOnly</a></span>(com.yahoo.memory.WritableMemory wmem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme, but inserts |
| values directly into a Memory.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#fastHashSearchOrInsert-com.yahoo.memory.WritableMemory-int-long-int-">fastHashSearchOrInsert</a></span>(com.yahoo.memory.WritableMemory wmem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme, but inserts |
| values directly into a Memory.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#hashArrayInsert-long:A-long:A-int-long-">hashArrayInsert</a></span>(long[] srcArr, |
| long[] hashTable, |
| int lgArrLongs, |
| long thetaLong)</code> |
| <div class="block">Inserts the given long array into the given hash table array of the target size, |
| removes any negative input values, ignores duplicates and counts the values inserted.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#hashInsertOnly-long:A-int-long-">hashInsertOnly</a></span>(long[] hashTable, |
| int lgArrLongs, |
| long hash)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme for on-heap.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#hashSearch-long:A-int-long-">hashSearch</a></span>(long[] hashTable, |
| int lgArrLongs, |
| long hash)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash search scheme for on-heap.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#hashSearch-com.yahoo.memory.Memory-int-long-int-">hashSearch</a></span>(com.yahoo.memory.Memory mem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash search scheme for off-heap.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../com/yahoo/sketches/HashOperations.html#hashSearchOrInsert-long:A-int-long-">hashSearchOrInsert</a></span>(long[] hashTable, |
| int lgArrLongs, |
| long hash)</code> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme for on-heap.</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/8/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/8/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/8/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/8/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/8/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/8/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/8/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/8/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/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/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/8/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/8/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"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="STRIDE_MASK"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>STRIDE_MASK</h4> |
| <pre>public static final int STRIDE_MASK</pre> |
| <div class="block">The stride mask for the Open Address, Double Hashing (OADH) hash table algorithm.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#com.yahoo.sketches.HashOperations.STRIDE_MASK">Constant Field Values</a></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="countPart-long:A-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>countPart</h4> |
| <pre>public static int countPart(long[] srcArr, |
| int lgArrLongs, |
| long thetaLong)</pre> |
| <div class="block">Counts the cardinality of the first Log2 values of the given source array.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>srcArr</code> - the given source array</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a></dd> |
| <dd><code>thetaLong</code> - <a href="../../../resources/dictionary.html#thetaLong">See Theta Long</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cardinality</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="count-long:A-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>count</h4> |
| <pre>public static int count(long[] srcArr, |
| long thetaLong)</pre> |
| <div class="block">Counts the cardinality of the given source array.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>srcArr</code> - the given source array</dd> |
| <dd><code>thetaLong</code> - <a href="../../../resources/dictionary.html#thetaLong">See Theta Long</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cardinality</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashSearch-long:A-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashSearch</h4> |
| <pre>public static int hashSearch(long[] hashTable, |
| int lgArrLongs, |
| long hash)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash search scheme for on-heap. |
| Returns the index if found, -1 if not found.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>hashTable</code> - The hash table to search. Must be a power of 2 in size.</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - A hash value to search for. Must not be zero.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Current probe index if found, -1 if not found.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashInsertOnly-long:A-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashInsertOnly</h4> |
| <pre>public static int hashInsertOnly(long[] hashTable, |
| int lgArrLongs, |
| long hash)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme for on-heap. |
| This method assumes that the input hash is not a duplicate. |
| Useful for rebuilding tables to avoid unnecessary comparisons. |
| Returns the index of insertion, which is always positive or zero. Throws an exception if the |
| table is full with no empty slot. |
| Throws an exception if table has no empty slot.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>hashTable</code> - the hash table to insert into.</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - value that must not be zero and will be inserted into the array into an empty slot.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>index of insertion. Always positive or zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashSearchOrInsert-long:A-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashSearchOrInsert</h4> |
| <pre>public static int hashSearchOrInsert(long[] hashTable, |
| int lgArrLongs, |
| long hash)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme for on-heap. |
| Returns index ≥ 0 if found (duplicate); < 0 if inserted, inserted at -(index + 1). |
| Throws an exception if the value is not found and table has no empty slot.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>hashTable</code> - the hash table to insert into.</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - hash value that must not be zero and if not a duplicate will be inserted into the |
| array into an empty slot</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>index ≥ 0 if found (duplicate); < 0 if inserted, inserted at -(index + 1).</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashArrayInsert-long:A-long:A-int-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashArrayInsert</h4> |
| <pre>public static int hashArrayInsert(long[] srcArr, |
| long[] hashTable, |
| int lgArrLongs, |
| long thetaLong)</pre> |
| <div class="block">Inserts the given long array into the given hash table array of the target size, |
| removes any negative input values, ignores duplicates and counts the values inserted. |
| The given hash table may have values, but they must have been inserted by this method or one |
| of the other OADH insert methods in this class and they may not be dirty. |
| This method performs additional checks against potentially invalid hash values or theta values. |
| Returns the count of values actually inserted.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>srcArr</code> - the source hash array to be potentially inserted</dd> |
| <dd><code>hashTable</code> - The correctly sized target hash table that must be a power of two.</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>thetaLong</code> - must greater than zero |
| <a href="../../../resources/dictionary.html#thetaLong">See Theta Long</a></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the count of values actually inserted</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashSearch-com.yahoo.memory.Memory-int-long-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashSearch</h4> |
| <pre>public static int hashSearch(com.yahoo.memory.Memory mem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash search scheme for off-heap. |
| Returns the index if found, -1 if not found.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - The Memory hash table to search.</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - A hash value to search for. Must not be zero.</dd> |
| <dd><code>memOffsetBytes</code> - offset in the memory where the hash array starts</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>index if found, -1 if not found.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="fastHashInsertOnly-com.yahoo.memory.WritableMemory-int-long-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>fastHashInsertOnly</h4> |
| <pre>public static int fastHashInsertOnly(com.yahoo.memory.WritableMemory wmem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme, but inserts |
| values directly into a Memory. |
| This method assumes that the input hash is not a duplicate. |
| Useful for rebuilding tables to avoid unnecessary comparisons. |
| Returns the index of insertion, which is always positive or zero. |
| Throws an exception if table has no empty slot.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>wmem</code> - The writable memory</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - value that must not be zero and will be inserted into the array into an empty slot.</dd> |
| <dd><code>memOffsetBytes</code> - offset in the memory where the hash array starts</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>index of insertion. Always positive or zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="fastHashSearchOrInsert-com.yahoo.memory.WritableMemory-int-long-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>fastHashSearchOrInsert</h4> |
| <pre>public static int fastHashSearchOrInsert(com.yahoo.memory.WritableMemory wmem, |
| int lgArrLongs, |
| long hash, |
| int memOffsetBytes)</pre> |
| <div class="block">This is a classical Knuth-style Open Addressing, Double Hash insert scheme, but inserts |
| values directly into a Memory. |
| Returns index ≥ 0 if found (duplicate); < 0 if inserted, inserted at -(index + 1). |
| Throws an exception if the value is not found and table has no empty slot.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>wmem</code> - the WritableMemory</dd> |
| <dd><code>lgArrLongs</code> - <a href="../../../resources/dictionary.html#lgArrLongs">See lgArrLongs</a>. |
| lgArrLongs ≤ log2(hashTable.length).</dd> |
| <dd><code>hash</code> - A hash value that must not be zero and if not a duplicate will be inserted into the |
| array into an empty slot.</dd> |
| <dd><code>memOffsetBytes</code> - offset in the memory where the hash array starts</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>index ≥ 0 if found (duplicate); < 0 if inserted, inserted at -(index + 1).</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="checkThetaCorruption-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkThetaCorruption</h4> |
| <pre>public static void checkThetaCorruption(long thetaLong)</pre> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>thetaLong</code> - must be greater than zero otherwise throws an exception. |
| <a href="../../../resources/dictionary.html#thetaLong">See Theta Long</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="checkHashCorruption-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkHashCorruption</h4> |
| <pre>public static void checkHashCorruption(long hash)</pre> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>hash</code> - must be greater than -1 otherwise throws an exception. |
| Note a hash of zero is normally ignored, but a negative hash is never allowed.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="continueCondition-long-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>continueCondition</h4> |
| <pre>public static boolean continueCondition(long thetaLong, |
| long hash)</pre> |
| <div class="block">Return true (continue) if hash is greater than or equal to thetaLong, or if hash == 0, |
| or if hash == Long.MAX_VALUE.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>thetaLong</code> - must be greater than the hash value |
| <a href="../../../resources/dictionary.html#thetaLong">See Theta Long</a></dd> |
| <dd><code>hash</code> - must be less than thetaLong and not less than or equal to zero.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true (continue) if hash is greater than or equal to thetaLong, or if hash == 0, |
| or if hash == Long.MAX_VALUE.</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/HashOperations.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="../../../com/yahoo/sketches/Family.html" title="enum in com.yahoo.sketches"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../com/yahoo/sketches/QuantilesHelper.html" title="class in com.yahoo.sketches"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?com/yahoo/sketches/HashOperations.html" target="_top">Frames</a></li> |
| <li><a href="HashOperations.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> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </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–2018. All rights reserved.</small></p> |
| </body> |
| </html> |