Files
pj2/doc/edu/rit/util/MultiSet.html
2016-04-27 01:07:35 -04:00

903 lines
50 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>MultiSet (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="MultiSet (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/MultiSet.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/Map.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/util/Packing.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/MultiSet.html" target="_top">Frames</a></li>
<li><a href="MultiSet.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</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 MultiSet" class="title">Class MultiSet&lt;E&gt;</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.MultiSet&lt;E&gt;</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">MultiSet&lt;E&gt;</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 MultiSet 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> (an
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/MultiSet.html#getPair(E, int)"><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/MultiSet.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 MultiSet.
<P>
Class MultiSet is streamable. For object streaming to work properly, the
element class must be streamable or serializable.
<P>
<I>Note:</I> Class MultiSet 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">&nbsp;</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/MultiSet.html#MultiSet()">MultiSet</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/MultiSet.html#MultiSet(edu.rit.util.MultiSet)">MultiSet</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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">&nbsp;</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/MultiSet.html#add(E)">add</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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/MultiSet.html#add(E, int)">add</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem,
int&nbsp;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/MultiSet.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/MultiSet.html#contains(E)">contains</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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/MultiSet.html#copy(edu.rit.util.MultiSet)">copy</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html" title="type parameter in MultiSet">E</a></code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#copyElement(E)">copyElement</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem)</code>
<div class="block">Copy the given element.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#count(E)">count</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.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/MultiSet.html#difference(edu.rit.util.MultiSet)">difference</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html#forEachItemDo(edu.rit.util.Action)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/Action.html" title="interface in edu.rit.util">Action</a>&lt;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&gt;&nbsp;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>&lt;R&gt;&nbsp;R</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#forEachItemDo(edu.rit.util.ActionResult)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/ActionResult.html" title="interface in edu.rit.util">ActionResult</a>&lt;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;,R&gt;&nbsp;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/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#getPair(E, int)">getPair</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;key,
int&nbsp;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/MultiSet.html#intersection(edu.rit.util.MultiSet)">intersection</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.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/MultiSet.html#isSubsetOf(edu.rit.util.MultiSet)">isSubsetOf</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html#readIn(edu.rit.io.InStream)">readIn</a></strong>(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a>&nbsp;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/MultiSet.html#remove(E)">remove</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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/MultiSet.html#remove(E, int)">remove</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem,
int&nbsp;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/MultiSet.html#removeAll(E)">removeAll</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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/MultiSet.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/MultiSet.html#symmetricDifference(edu.rit.util.MultiSet)">symmetricDifference</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#toArray(edu.rit.util.IntPair[])">toArray</a></strong>(<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;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/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/MultiSet.html#toArray(edu.rit.util.IntPair[], int, int)">toArray</a></strong>(<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;array,
int&nbsp;off,
int&nbsp;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/MultiSet.html#union(edu.rit.util.MultiSet)">union</a></strong>(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html#writeOut(edu.rit.io.OutStream)">writeOut</a></strong>(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a>&nbsp;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&nbsp;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="MultiSet()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MultiSet</h4>
<pre>public&nbsp;MultiSet()</pre>
<div class="block">Construct a new empty multiset.</div>
</li>
</ul>
<a name="MultiSet(edu.rit.util.MultiSet)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MultiSet</h4>
<pre>public&nbsp;MultiSet(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html#getPair(E, int)"><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&nbsp;boolean&nbsp;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&nbsp;void&nbsp;clear()</pre>
<div class="block">Clear this multiset.</div>
</li>
</ul>
<a name="copy(edu.rit.util.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copy</h4>
<pre>public&nbsp;void&nbsp;copy(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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/MultiSet.html#getPair(E, int)"><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&nbsp;int&nbsp;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&nbsp;int&nbsp;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&nbsp;boolean&nbsp;contains(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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&nbsp;int&nbsp;count(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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 (&ge;
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&nbsp;void&nbsp;add(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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/MultiSet.html#getPair(E, int)"><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,int)">
<!-- -->
</a><a name="add(E, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem,
int&nbsp;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/MultiSet.html#getPair(E, int)"><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 (&ge; 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> &lt; 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&nbsp;void&nbsp;remove(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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,int)">
<!-- -->
</a><a name="remove(E, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public&nbsp;void&nbsp;remove(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem,
int&nbsp;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 (&ge; 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> &lt; 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&nbsp;void&nbsp;removeAll(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;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.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSubsetOf</h4>
<pre>public&nbsp;boolean&nbsp;isSubsetOf(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>union</h4>
<pre>public&nbsp;void&nbsp;union(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intersection</h4>
<pre>public&nbsp;void&nbsp;intersection(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>difference</h4>
<pre>public&nbsp;void&nbsp;difference(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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.MultiSet)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>symmetricDifference</h4>
<pre>public&nbsp;void&nbsp;symmetricDifference(<a href="../../../edu/rit/util/MultiSet.html" title="class in edu.rit.util">MultiSet</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;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&nbsp;void&nbsp;forEachItemDo(<a href="../../../edu/rit/util/Action.html" title="interface in edu.rit.util">Action</a>&lt;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&gt;&nbsp;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 &le; 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&nbsp;&lt;R&gt;&nbsp;R&nbsp;forEachItemDo(<a href="../../../edu/rit/util/ActionResult.html" title="interface in edu.rit.util">ActionResult</a>&lt;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;,R&gt;&nbsp;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 &le; 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.IntPair[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre>public&nbsp;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;toArray(<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;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.IntPair[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre>public&nbsp;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;toArray(<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;[]&nbsp;array,
int&nbsp;off,
int&nbsp;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> &lt; 0, <TT>len</TT>
&lt; 0, or <TT>off</TT>+<TT>len</TT> &gt; <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&nbsp;void&nbsp;writeOut(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a>&nbsp;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#writeInt(int)"><code>writeInt()</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>&nbsp;in interface&nbsp;<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&nbsp;void&nbsp;readIn(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a>&nbsp;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#readInt()"><code>readInt()</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>&nbsp;in interface&nbsp;<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,int)">
<!-- -->
</a><a name="getPair(E, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPair</h4>
<pre>protected&nbsp;<a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&gt;&nbsp;getPair(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;key,
int&nbsp;value)</pre>
<div class="block">Create a pair containing the given element and multiplicity. Whenever
class MultiSet needs to create a pair, it does so by calling this method.
<P>
The <TT>getPair()</TT> method in class MultiSet returns an instance of
class <a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util">IntPair</a>&lt;E&gt;. The given element is copied
using the <a href="../../../edu/rit/util/MultiSet.html#copyElement(E)"><code>copyElement()</code></a> method. A subclass
of class MultiSet 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/IntPair.html" title="class in edu.rit.util"><code>IntPair</code></a>&lt;E&gt;, 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/IntPair.html" title="class in edu.rit.util"><code>IntPair</code></a>&lt;E&gt;, 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&nbsp;<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;copyElement(<a href="../../../edu/rit/util/MultiSet.html" title="type parameter in MultiSet">E</a>&nbsp;elem)</pre>
<div class="block">Copy the given element. The <TT>copyElement()</TT> method in class
MultiSet merely returns the <TT>elem</TT> reference; this makes a
<I>shallow copy.</I> A subclass of class MultiSet 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/MultiSet.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/Map.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/util/Packing.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/MultiSet.html" target="_top">Frames</a></li>
<li><a href="MultiSet.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</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 &copy; 2013&ndash;2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">&#64;</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
</body>
</html>