907 lines
51 KiB
HTML
907 lines
51 KiB
HTML
<!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 (version 1.7.0_51) on Wed Apr 06 13:11:11 EDT 2016 -->
|
|
<title>LongMultiSet (Parallel Java 2 Library Documentation)</title>
|
|
<meta name="date" content="2016-04-06">
|
|
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="LongMultiSet (Parallel Java 2 Library Documentation)";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar_top">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/LongMultiSet.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-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/util/LongList.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/util/LongMultiSet.html" target="_top">Frames</a></li>
|
|
<li><a href="LongMultiSet.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>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 ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">edu.rit.util</div>
|
|
<h2 title="Class LongMultiSet" class="title">Class LongMultiSet<E></h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li><a href="http://docs.oracle.com/javase/7/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>edu.rit.util.LongMultiSet<E></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - Element data type.</dd></dl>
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="strong">LongMultiSet<E></span>
|
|
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
|
|
implements <a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></pre>
|
|
<div class="block">Class LongMultiSet provides a multiset of elements. A multiset is a set in
|
|
which each element may appear more than once. An element's
|
|
<I>multiplicity</I> (a long integer greater than or equal to 0) is the number
|
|
of times the element appears in the multiset. The element must be an object
|
|
suitable for use in a hashed data structure; that is, the element class must
|
|
define the <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><code>equals()</code></a> and <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang"><code>hashCode()</code></a> methods properly. Elements must not be null.
|
|
Once an element is stored in a multiset, the state of the element must not be
|
|
altered.
|
|
<P>
|
|
The multiset calls the protected <a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)"><code>getPair()</code></a>
|
|
method to make an element-multiplicity pair being added to the multiset. The
|
|
multiset calls the protected <a href="../../../edu/rit/util/LongMultiSet.html#copyElement(E)"><code>copyElement()</code></a>
|
|
method to make a copy of an element being added to the multiset. The default
|
|
is to copy just the element reference. This behavior can be changed by
|
|
overriding the aforementioned methods in a subclass of class LongMultiSet.
|
|
<P>
|
|
Class LongMultiSet is streamable. For object streaming to work properly, the
|
|
element class must be streamable or serializable.
|
|
<P>
|
|
<I>Note:</I> Class LongMultiSet is not multiple thread safe.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#LongMultiSet()">LongMultiSet</a></strong>()</code>
|
|
<div class="block">Construct a new empty multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#LongMultiSet(edu.rit.util.LongMultiSet)">LongMultiSet</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Construct a new multiset that is a copy of the given multiset.</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="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#add(E)">add</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Add one occurrence of the given element to this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#add(E, long)">add</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem,
|
|
long count)</code>
|
|
<div class="block">Add the given number of occurrences of the given element to this
|
|
multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#clear()">clear</a></strong>()</code>
|
|
<div class="block">Clear this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#contains(E)">contains</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Determine if this multiset contains the given element.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#copy(edu.rit.util.LongMultiSet)">copy</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Change this multiset to be a copy of the given multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>protected <a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#copyElement(E)">copyElement</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Copy the given element.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#count(E)">count</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Determine the multiplicity of the given element in this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#countAll()">countAll</a></strong>()</code>
|
|
<div class="block">Returns the number of elements in this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#difference(edu.rit.util.LongMultiSet)">difference</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Change this multiset to be the difference of itself and the given
|
|
multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#forEachItemDo(edu.rit.util.Action)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/Action.html" title="interface in edu.rit.util">Action</a><<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>> action)</code>
|
|
<div class="block">Perform the given action on each element in this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><R> R</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#forEachItemDo(edu.rit.util.ActionResult)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/ActionResult.html" title="interface in edu.rit.util">ActionResult</a><<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>,R> action)</code>
|
|
<div class="block">Perform the given action on each element in this multiset and return a
|
|
result.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>protected <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)">getPair</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> key,
|
|
long value)</code>
|
|
<div class="block">Create a pair containing the given element and multiplicity.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#intersection(edu.rit.util.LongMultiSet)">intersection</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Change this multiset to be the intersection of itself and the given
|
|
multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#isEmpty()">isEmpty</a></strong>()</code>
|
|
<div class="block">Determine if this multiset is empty.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#isSubsetOf(edu.rit.util.LongMultiSet)">isSubsetOf</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Determine if this multiset is a subset of the given multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#readIn(edu.rit.io.InStream)">readIn</a></strong>(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a> in)</code>
|
|
<div class="block">Read this object's fields from the given in stream.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#remove(E)">remove</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Remove one occurrence of the given element from this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#remove(E, long)">remove</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem,
|
|
long count)</code>
|
|
<div class="block">Remove the given number of occurrences of the given element from this
|
|
multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#removeAll(E)">removeAll</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</code>
|
|
<div class="block">Remove all occurrences of the given element from this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#size()">size</a></strong>()</code>
|
|
<div class="block">Returns the number of unique elements in this multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#symmetricDifference(edu.rit.util.LongMultiSet)">symmetricDifference</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Change this multiset to be the symmetric difference of itself and the
|
|
given multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[]</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#toArray(edu.rit.util.LongPair[])">toArray</a></strong>(<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] array)</code>
|
|
<div class="block">Store this multiset's elements in the given array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[]</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#toArray(edu.rit.util.LongPair[], int, int)">toArray</a></strong>(<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] array,
|
|
int off,
|
|
int len)</code>
|
|
<div class="block">Store this multiset's elements in the given array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#union(edu.rit.util.LongMultiSet)">union</a></strong>(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</code>
|
|
<div class="block">Change this multiset to be the union of itself and the given multiset.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/LongMultiSet.html#writeOut(edu.rit.io.OutStream)">writeOut</a></strong>(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a> out)</code>
|
|
<div class="block">Write this object's fields to the given out stream.</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="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
|
|
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/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="LongMultiSet()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>LongMultiSet</h4>
|
|
<pre>public LongMultiSet()</pre>
|
|
<div class="block">Construct a new empty multiset.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="LongMultiSet(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>LongMultiSet</h4>
|
|
<pre>public LongMultiSet(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Construct a new multiset that is a copy of the given multiset.
|
|
<P>
|
|
The element-multiplicity pairs of the given multiset are copied using the
|
|
<a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)"><code>getPair()</code></a> method.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset to copy.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>mset</TT> is null.</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="isEmpty()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isEmpty</h4>
|
|
<pre>public boolean isEmpty()</pre>
|
|
<div class="block">Determine if this multiset is empty.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>True if this multiset is empty, false otherwise.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="clear()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>clear</h4>
|
|
<pre>public void clear()</pre>
|
|
<div class="block">Clear this multiset.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="copy(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>copy</h4>
|
|
<pre>public void copy(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Change this multiset to be a copy of the given multiset.
|
|
<P>
|
|
The element-multiplicity pairs of the given multiset are copied using the
|
|
<a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)"><code>getPair()</code></a> method.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset to copy.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>mset</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="size()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>size</h4>
|
|
<pre>public int size()</pre>
|
|
<div class="block">Returns the number of unique elements in this multiset. This is the
|
|
number of different elements, disregarding their multiplicities.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Number of unique elements.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="countAll()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>countAll</h4>
|
|
<pre>public long countAll()</pre>
|
|
<div class="block">Returns the number of elements in this multiset. This is the sum of the
|
|
elements' multiplicities.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>Number of elements.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="contains(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="contains(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>contains</h4>
|
|
<pre>public boolean contains(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Determine if this multiset contains the given element.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>True if this multiset contains <TT>elem</TT> at least once,
|
|
false otherwise.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="count(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="count(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>count</h4>
|
|
<pre>public long count(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Determine the multiplicity of the given element in this multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Number of occurrences of <TT>elem</TT> in this multiset (≥
|
|
0).</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="add(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="add(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>add</h4>
|
|
<pre>public void add(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Add one occurrence of the given element to this multiset.
|
|
<P>
|
|
If not already present, an element-multiplicity pair, created using the
|
|
<a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)"><code>getPair()</code></a> method, is added to this
|
|
multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="add(java.lang.Object,long)">
|
|
<!-- -->
|
|
</a><a name="add(E, long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>add</h4>
|
|
<pre>public void add(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem,
|
|
long count)</pre>
|
|
<div class="block">Add the given number of occurrences of the given element to this
|
|
multiset.
|
|
<P>
|
|
If not already present, an element-multiplicity pair, created using the
|
|
<a href="../../../edu/rit/util/LongMultiSet.html#getPair(E, long)"><code>getPair()</code></a> method, is added to this
|
|
multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd><dd><code>count</code> - Number of occurrences to add (≥ 0).</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <TT>count</TT> < 0.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="remove(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="remove(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre>public void remove(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Remove one occurrence of the given element from this multiset. If this
|
|
multiset does not contain any occurrences of <TT>elem</TT>, then
|
|
afterwards this multiset is unchanged.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="remove(java.lang.Object,long)">
|
|
<!-- -->
|
|
</a><a name="remove(E, long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre>public void remove(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem,
|
|
long count)</pre>
|
|
<div class="block">Remove the given number of occurrences of the given element from this
|
|
multiset. If this multiset contains <TT>count</TT> or fewer occurrences
|
|
of <TT>elem</TT>, then afterwards this multiset does not contain
|
|
<TT>elem</TT>.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd><dd><code>count</code> - Number of occurrences to remove (≥ 0).</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <TT>count</TT> < 0.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="removeAll(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="removeAll(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>removeAll</h4>
|
|
<pre>public void removeAll(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Remove all occurrences of the given element from this multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>elem</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isSubsetOf(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isSubsetOf</h4>
|
|
<pre>public boolean isSubsetOf(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Determine if this multiset is a subset of the given multiset. This is so
|
|
if every element of this multiset is also an element of the given
|
|
multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>True if this multiset is a subset of the given multiset, false
|
|
otherwise.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="union(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>union</h4>
|
|
<pre>public void union(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Change this multiset to be the union of itself and the given multiset.
|
|
The union consists of all elements that appear in this set or the given
|
|
set or both.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="intersection(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>intersection</h4>
|
|
<pre>public void intersection(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Change this multiset to be the intersection of itself and the given
|
|
multiset. The intersection consists of all elements that appear in this
|
|
multiset and the given multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="difference(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>difference</h4>
|
|
<pre>public void difference(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Change this multiset to be the difference of itself and the given
|
|
multiset. The difference consists of all elements that appear in this
|
|
multiset and not in the given multiset.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="symmetricDifference(edu.rit.util.LongMultiSet)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>symmetricDifference</h4>
|
|
<pre>public void symmetricDifference(<a href="../../../edu/rit/util/LongMultiSet.html" title="class in edu.rit.util">LongMultiSet</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> mset)</pre>
|
|
<div class="block">Change this multiset to be the symmetric difference of itself and the
|
|
given multiset. The symmetric difference consists of all elements that
|
|
appear in this multiset or the given multiset, but not both.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>mset</code> - Multiset.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="forEachItemDo(edu.rit.util.Action)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>forEachItemDo</h4>
|
|
<pre>public void forEachItemDo(<a href="../../../edu/rit/util/Action.html" title="interface in edu.rit.util">Action</a><<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>> action)</pre>
|
|
<div class="block">Perform the given action on each element in this multiset. For each
|
|
element in this multiset in an unspecified order, the given
|
|
<TT>action</TT>'s <TT>run()</TT> method is called, passing in a pair
|
|
consisting of the element (key) and the element's multiplicity (value).
|
|
The state of the element must not be altered. The multiplicity may be
|
|
altered. If the multiplicity is set to a value ≤ 0, the element is
|
|
removed from this multiset.
|
|
<P>
|
|
<B><I>Warning:</I></B> If the <TT>action</TT> adds elements to or removes
|
|
elements from the multiset, other than by setting the multiplicity, the
|
|
<TT>forEachItemDo()</TT> method's behavior is unspecified.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>action</code> - Action.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="forEachItemDo(edu.rit.util.ActionResult)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>forEachItemDo</h4>
|
|
<pre>public <R> R forEachItemDo(<a href="../../../edu/rit/util/ActionResult.html" title="interface in edu.rit.util">ActionResult</a><<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>,R> action)</pre>
|
|
<div class="block">Perform the given action on each element in this multiset and return a
|
|
result. For each element in this multiset in an unspecified order, the
|
|
given <TT>action</TT>'s <TT>run()</TT> method is called, passing in a
|
|
pair consisting of the element (key) and the element's multiplicity
|
|
(value). The state of the element must not be altered. The multiplicity
|
|
may be altered. If the multiplicity is set to a value ≤ 0, the element
|
|
is removed from this multiset. After all the elements have been
|
|
processed, the given <TT>action</TT>'s <TT>result()</TT> method is
|
|
called, and its result is returned.
|
|
<P>
|
|
<B><I>Warning:</I></B> If the <TT>action</TT> adds elements to or removes
|
|
elements from the multiset, other than by setting the multiplicity, the
|
|
<TT>forEachItemDo()</TT> method's behavior is unspecified.</div>
|
|
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>R</code> - Result data type.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>action</code> - Action.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Result of processing all the set elements.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toArray(edu.rit.util.LongPair[])">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toArray</h4>
|
|
<pre>public <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] toArray(<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] array)</pre>
|
|
<div class="block">Store this multiset's elements in the given array. Each unique element is
|
|
stored as a pair consisting of the element (key) and the element's
|
|
multiplicity (value). The elements are stored in an unspecified order.
|
|
The first element is stored at index 0, the second element at index 1,
|
|
and so on. The number of array elements stored is <TT>array.length</TT>.
|
|
If this multiset contains fewer than <TT>array.length</TT> unique
|
|
elements, the remaining array elements are set to null.
|
|
<P>
|
|
The <TT>toArray()</TT> method stores <I>references</I> to this multiset's
|
|
element-multiplicity pairs in the given array. The states of the elements
|
|
stored in the array must not be altered. The multiplicities stored in the
|
|
array must not be altered.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>array</code> - Array in which to store elements.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>The given array is returned.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>array</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toArray(edu.rit.util.LongPair[], int, int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toArray</h4>
|
|
<pre>public <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] toArray(<a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>>[] array,
|
|
int off,
|
|
int len)</pre>
|
|
<div class="block">Store this multiset's elements in the given array. Each unique element is
|
|
stored as a pair consisting of the element (key) and the element's
|
|
multiplicity (value). The elements are stored in an unspecified order.
|
|
The first element is stored at index <TT>off</TT>, the second element at
|
|
index <TT>off</TT>+1, and so on. The number of array elements stored is
|
|
<TT>len</TT>. If this multiset contains fewer than <TT>len</TT> unique
|
|
elements, the remaining array elements are set to null.
|
|
<P>
|
|
The <TT>toArray()</TT> method stores <I>references</I> to this multiset's
|
|
element-multiplicity pairs in the given array. The states of the elements
|
|
stored in the array must not be altered. The multiplicities stored in the
|
|
array must not be altered.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>array</code> - Array in which to store elements.</dd><dd><code>off</code> - Index at which to store first element.</dd><dd><code>len</code> - Number of elements to store.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>The given array is returned.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>array</TT> is null.</dd>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>off</TT> < 0, <TT>len</TT>
|
|
< 0, or <TT>off</TT>+<TT>len</TT> > <TT>array.length</TT>.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="writeOut(edu.rit.io.OutStream)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>writeOut</h4>
|
|
<pre>public void writeOut(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a> out)
|
|
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
|
|
<div class="block">Write this object's fields to the given out stream. The multiset elements
|
|
are written using <a href="../../../edu/rit/io/OutStream.html#writeObject(java.lang.Object)"><code>writeObject()</code></a>.
|
|
The elements' multiplicities are written using <a href="../../../edu/rit/io/OutStream.html#writeLong(long)"><code>writeLong()</code></a>.</div>
|
|
<dl>
|
|
<dt><strong>Specified by:</strong></dt>
|
|
<dd><code><a href="../../../edu/rit/io/Streamable.html#writeOut(edu.rit.io.OutStream)">writeOut</a></code> in interface <code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
|
|
<dt><span class="strong">Parameters:</span></dt><dd><code>out</code> - Out stream.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an element in this set is not streamable or serializable.
|
|
Thrown if an I/O error occurred.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="readIn(edu.rit.io.InStream)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>readIn</h4>
|
|
<pre>public void readIn(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a> in)
|
|
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
|
|
<div class="block">Read this object's fields from the given in stream. The multiset elements
|
|
are read using <a href="../../../edu/rit/io/InStream.html#readObject()"><code>readObject()</code></a>. The elements'
|
|
multiplicities are written using <a href="../../../edu/rit/io/InStream.html#readLong()"><code>readLong()</code></a>.</div>
|
|
<dl>
|
|
<dt><strong>Specified by:</strong></dt>
|
|
<dd><code><a href="../../../edu/rit/io/Streamable.html#readIn(edu.rit.io.InStream)">readIn</a></code> in interface <code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
|
|
<dt><span class="strong">Parameters:</span></dt><dd><code>in</code> - In stream.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getPair(java.lang.Object,long)">
|
|
<!-- -->
|
|
</a><a name="getPair(E, long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getPair</h4>
|
|
<pre>protected <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a>> getPair(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> key,
|
|
long value)</pre>
|
|
<div class="block">Create a pair containing the given element and multiplicity. Whenever
|
|
class LongMultiSet needs to create a pair, it does so by calling this
|
|
method.
|
|
<P>
|
|
The <TT>getPair()</TT> method in class LongMultiSet returns an instance
|
|
of class <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util">LongPair</a><E>. The given element is
|
|
copied using the <a href="../../../edu/rit/util/LongMultiSet.html#copyElement(E)"><code>copyElement()</code></a> method. A
|
|
subclass of class LongMultiSet can override the <TT>getPair()</TT> method
|
|
to return something else. Possibilities include:
|
|
<UL>
|
|
<P><LI>
|
|
Return an instance of a subclass of class <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util"><code>LongPair</code></a><E>, in which the <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><code>equals()</code></a>
|
|
and <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang"><code>hashCode()</code></a> methods have been overridden to
|
|
implement a different pair equality criterion.
|
|
<P><LI>
|
|
Return an instance of a subclass of class <a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util"><code>LongPair</code></a><E>, in which the <a href="../../../edu/rit/io/Streamable.html#writeOut(edu.rit.io.OutStream)"><code>writeOut()</code></a> and <a href="../../../edu/rit/io/Streamable.html#readIn(edu.rit.io.InStream)"><code>readIn()</code></a> methods
|
|
have been overridden to implement different streaming behavior.
|
|
</UL></div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - Key (element).</dd><dd><code>value</code> - Value (multiplicity).</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Pair consisting of (key, value).</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="copyElement(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="copyElement(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>copyElement</h4>
|
|
<pre>protected <a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> copyElement(<a href="../../../edu/rit/util/LongMultiSet.html" title="type parameter in LongMultiSet">E</a> elem)</pre>
|
|
<div class="block">Copy the given element. The <TT>copyElement()</TT> method in class
|
|
LongMultiSet merely returns the <TT>elem</TT> reference; this makes a
|
|
<I>shallow copy.</I> A subclass of class LongMultiSet can override the
|
|
<TT>copyElement()</TT> method to return something else. Possibilities
|
|
include:
|
|
<UL>
|
|
<P><LI>
|
|
Return a clone of the element, which makes a <I>deep copy.</I>
|
|
<P><LI>
|
|
Return an instance of a subclass of the element's class, in which the
|
|
<a href="../../../edu/rit/io/Streamable.html#writeOut(edu.rit.io.OutStream)"><code>writeOut()</code></a> and <a href="../../../edu/rit/io/Streamable.html#readIn(edu.rit.io.InStream)"><code>readIn()</code></a> methods have been overridden to
|
|
implement different streaming behavior.
|
|
</UL></div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Set element to copy.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Copy of <TT>elem</TT>.</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/LongMultiSet.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-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/util/LongList.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/LongPair.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/util/LongMultiSet.html" target="_top">Frames</a></li>
|
|
<li><a href="LongMultiSet.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>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><FONT SIZE="-2">Copyright © 2013–2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">@</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
|
|
</body>
|
|
</html>
|