blob: 646990ba1b67782a7a9bd1638d69f27f9cc08631 [file]
<!DOCTYPE HTML>
<html lang>
<head>
<!-- Generated by javadoc (25) -->
<title>CompactTupleSketch (datasketches-java 9.0.1-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.datasketches.tuple, class: CompactTupleSketch">
<meta name="generator" content="javadoc/ClassWriter">
<link rel="stylesheet" type="text/css" href="../../../../resource-files/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="../../../../resource-files/stylesheet.css">
<script type="text/javascript" src="../../../../script-files/script.js"></script>
<script type="text/javascript" src="../../../../script-files/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="../../../../script-files/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">const pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="nav-content">
<div class="nav-menu-button"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button></div>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/CompactTupleSketch.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="../../../../search.html">Search</a></li>
<li><a href="../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
</div>
<div class="sub-nav">
<div class="nav-content">
<ol class="sub-nav-list">
<li><a href="package-summary.html">org.apache.datasketches.tuple</a></li>
<li><a href="CompactTupleSketch.html" class="current-selection">CompactTupleSketch</a></li>
</ol>
<div class="nav-list-search"><input type="text" id="search-input" disabled placeholder="Search documentation (type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false"><input type="reset" id="reset-search" disabled value="Reset"></div>
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="main-grid">
<nav role="navigation" class="toc" aria-label="Table of contents">
<div class="toc-header">Contents&nbsp;<input type="text" class="filter-input" disabled placeholder="Filter contents (type .)" aria-label="Filter table of contents" autocomplete="off" spellcheck="false"><input type="reset" class="reset-filter" disabled tabindex="-1" value="Reset"></div>
<ol class="toc-list" tabindex="-1">
<li><a href="#" tabindex="0">Description</a></li>
<li><a href="#method-summary" tabindex="0">Method Summary</a></li>
<li><a href="#method-detail" tabindex="0">Method Details</a>
<ol class="toc-list">
<li><a href="#compact()" tabindex="0">compact()</a></li>
<li><a href="#getRetainedEntries()" tabindex="0">getRetainedEntries()</a></li>
<li><a href="#getCountLessThanThetaLong(long)" tabindex="0">getCountLessThanThetaLong(long)</a></li>
<li><a href="#toByteArray()" tabindex="0">toByteArray()</a></li>
<li><a href="#iterator()" tabindex="0">iterator()</a></li>
</ol>
</li>
</ol>
<button class="hide-sidebar"><span>Hide sidebar&nbsp;</span><img src="../../../../resource-files/left.svg" alt="Hide sidebar"></button><button class="show-sidebar"><img src="../../../../resource-files/right.svg" alt="Show sidebar"><span>&nbsp;Show sidebar</span></button></nav>
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h1 title="Class CompactTupleSketch" class="title">Class CompactTupleSketch&lt;S extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance"><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">org.apache.datasketches.tuple.TupleSketch</a>&lt;S&gt;
<div class="inheritance">org.apache.datasketches.tuple.CompactTupleSketch&lt;S&gt;</div>
</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><span id="type-param-S"><code>S</code> - type of Summary</span></dd>
</dl>
<hr>
<div class="horizontal-scroll">
<div class="type-signature"><span class="modifiers">public final class </span><span class="element-name type-name-label">CompactTupleSketch&lt;S extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</span>
<span class="extends-implements">extends <a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;S&gt;</span></div>
<div class="block">CompactTupleSketches are never created directly. They are created as a result of
the compact() method of an UpdatableTupleSketch or as a result of the getResult()
method of a set operation like TupleUnion, TupleIntersection or TupleAnotB.
CompactTupleSketch consists of a compact list (i.e. no intervening spaces) of hash values,
corresponding list of Summaries, and a value for theta. The lists may or may
not be ordered. CompactTupleSketch is read-only.</div>
</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="CompactTupleSketch.html" title="class in org.apache.datasketches.tuple">CompactTupleSketch</a><wbr>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#compact()" class="member-name-link">compact</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Converts this TupleSketch to a CompactTupleSketch on the Java heap.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getCountLessThanThetaLong(long)" class="member-name-link">getCountLessThanThetaLong</a><wbr>(long&nbsp;thetaLong)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the number of hash values less than the given theta expressed as a long.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getRetainedEntries()" class="member-name-link">getRetainedEntries</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns number of retained entries</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="TupleSketchIterator.html" title="class in org.apache.datasketches.tuple">TupleSketchIterator</a><wbr>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#iterator()" class="member-name-link">iterator</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a SketchIterator</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>byte[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toByteArray()" class="member-name-link">toByteArray</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Serialize this sketch to a byte array.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-org.apache.datasketches.tuple.TupleSketch">Methods inherited from class&nbsp;<a href="TupleSketch.html#method-summary" title="class in org.apache.datasketches.tuple">TupleSketch</a></h3>
<code><a href="TupleSketch.html#createEmptySketch()" title="createEmptySketch()">createEmptySketch</a>, <a href="TupleSketch.html#getEstimate()" title="getEstimate()">getEstimate</a>, <a href="TupleSketch.html#getEstimate(int)" title="getEstimate(int)">getEstimate</a>, <a href="TupleSketch.html#getLowerBound(int)" title="getLowerBound(int)">getLowerBound</a>, <a href="TupleSketch.html#getLowerBound(int,int)" title="getLowerBound(int, int)">getLowerBound</a>, <a href="TupleSketch.html#getSummaryFactory()" title="getSummaryFactory()">getSummaryFactory</a>, <a href="TupleSketch.html#getTheta()" title="getTheta()">getTheta</a>, <a href="TupleSketch.html#getThetaLong()" title="getThetaLong()">getThetaLong</a>, <a href="TupleSketch.html#getUpperBound(int)" title="getUpperBound(int)">getUpperBound</a>, <a href="TupleSketch.html#getUpperBound(int,int)" title="getUpperBound(int, int)">getUpperBound</a>, <a href="TupleSketch.html#heapifySketch(java.lang.foreign.MemorySegment,org.apache.datasketches.tuple.SummaryDeserializer)" title="heapifySketch(MemorySegment, SummaryDeserializer)">heapifySketch</a>, <a href="TupleSketch.html#heapifyUpdatableSketch(java.lang.foreign.MemorySegment,org.apache.datasketches.tuple.SummaryDeserializer,org.apache.datasketches.tuple.SummaryFactory)" title="heapifyUpdatableSketch(MemorySegment, SummaryDeserializer, SummaryFactory)">heapifyUpdatableSketch</a>, <a href="TupleSketch.html#isEmpty()" title="isEmpty()">isEmpty</a>, <a href="TupleSketch.html#isEstimationMode()" title="isEstimationMode()">isEstimationMode</a>, <a href="TupleSketch.html#toString()" title="toString()">toString</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#method-summary" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="compact()">
<h3>compact</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="CompactTupleSketch.html" title="class in org.apache.datasketches.tuple">CompactTupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a>&gt;</span>&nbsp;<span class="element-name">compact</span>()</div>
<div class="block"><span class="description-from-type-label">Description copied from class:&nbsp;<code><a href="TupleSketch.html#compact()">TupleSketch</a></code></span></div>
<div class="block">Converts this TupleSketch to a CompactTupleSketch on the Java heap.
<p>If this sketch is already in compact form this operation returns <i>this</i>.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="TupleSketch.html#compact()">compact</a></code>&nbsp;in class&nbsp;<code><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a> extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>this sketch as a CompactTupleSketch on the Java heap.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getRetainedEntries()">
<h3>getRetainedEntries</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getRetainedEntries</span>()</div>
<div class="block"><span class="description-from-type-label">Description copied from class:&nbsp;<code><a href="TupleSketch.html#getRetainedEntries()">TupleSketch</a></code></span></div>
<div class="block">Returns number of retained entries</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="TupleSketch.html#getRetainedEntries()">getRetainedEntries</a></code>&nbsp;in class&nbsp;<code><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a> extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>number of retained entries</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getCountLessThanThetaLong(long)">
<h3>getCountLessThanThetaLong</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">getCountLessThanThetaLong</span><wbr><span class="parameters">(long&nbsp;thetaLong)</span></div>
<div class="block"><span class="description-from-type-label">Description copied from class:&nbsp;<code><a href="TupleSketch.html#getCountLessThanThetaLong(long)">TupleSketch</a></code></span></div>
<div class="block">Gets the number of hash values less than the given theta expressed as a long.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="TupleSketch.html#getCountLessThanThetaLong(long)">getCountLessThanThetaLong</a></code>&nbsp;in class&nbsp;<code><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a> extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</code></dd>
<dt>Parameters:</dt>
<dd><code>thetaLong</code> - the given theta as a long in the range (zero, <i>Long.MAX_VALUE</i>].</dd>
<dt>Returns:</dt>
<dd>the number of hash values less than the given thetaLong.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="toByteArray()">
<h3>toByteArray</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">toByteArray</span>()</div>
<div class="block"><span class="description-from-type-label">Description copied from class:&nbsp;<code><a href="TupleSketch.html#toByteArray()">TupleSketch</a></code></span></div>
<div class="block">Serialize this sketch to a byte array.
<p>As of 3.0.0, serializing an UpdatableTupleSketch is deprecated.
This capability will be removed in a future release.
Serializing a CompactTupleSketch is not deprecated.</p></div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="TupleSketch.html#toByteArray()">toByteArray</a></code>&nbsp;in class&nbsp;<code><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a> extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>serialized representation of this sketch.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="iterator()">
<h3>iterator</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="TupleSketchIterator.html" title="class in org.apache.datasketches.tuple">TupleSketchIterator</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a>&gt;</span>&nbsp;<span class="element-name">iterator</span>()</div>
<div class="block"><span class="description-from-type-label">Description copied from class:&nbsp;<code><a href="TupleSketch.html#iterator()">TupleSketch</a></code></span></div>
<div class="block">Returns a SketchIterator</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="TupleSketch.html#iterator()">iterator</a></code>&nbsp;in class&nbsp;<code><a href="TupleSketch.html" title="class in org.apache.datasketches.tuple">TupleSketch</a>&lt;<a href="#type-param-S" title="type parameter in CompactTupleSketch">S</a> extends <a href="Summary.html" title="interface in org.apache.datasketches.tuple">Summary</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>a SketchIterator</dd>
</dl>
</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2015&#x2013;2025 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</main>
</div>
</body>
</html>