864 lines
46 KiB
HTML
864 lines
46 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:12 EDT 2016 -->
|
|
<title>Set (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="Set (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/Set.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/Searching.Short.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/Sorting.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/Set.html" target="_top">Frames</a></li>
|
|
<li><a href="Set.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 Set" class="title">Class Set<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.Set<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>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang">Cloneable</a></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="strong">Set<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>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang">Cloneable</a></pre>
|
|
<div class="block">Class Set provides a set of elements. 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 set, the state of the element must not be altered.
|
|
<P>
|
|
The set calls the protected <a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method
|
|
to make a copy of an element being added to the set. The default is to copy
|
|
just the element reference. This behavior can be changed by overriding the
|
|
<a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method in a subclass of class Set.
|
|
<P>
|
|
The set uses the protected <a href="../../../edu/rit/util/Set.html#same(E, E)"><code>same()</code></a> and <a href="../../../edu/rit/util/Set.html#hashOf(E)"><code>hashOf()</code></a> methods when searching for an element. The default
|
|
is to use the element class's <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. This behavior can be changed by
|
|
overriding the <a href="../../../edu/rit/util/Set.html#same(E, E)"><code>same()</code></a> and <a href="../../../edu/rit/util/Set.html#hashOf(E)"><code>hashOf()</code></a> methods in a subclass of class Set.
|
|
<P>
|
|
Class Set is streamable. For object streaming to work properly, the element
|
|
class must be streamable or serializable.
|
|
<P>
|
|
<I>Note:</I> Class Set 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/Set.html#Set()">Set</a></strong>()</code>
|
|
<div class="block">Construct a new empty set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a href="../../../edu/rit/util/Set.html#Set(edu.rit.util.Set)">Set</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Construct a new set that is a copy of the given set.</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>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#add(E)">add</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Add the given element to this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#clear()">clear</a></strong>()</code>
|
|
<div class="block">Clear this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><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></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#clone()">clone</a></strong>()</code>
|
|
<div class="block">Create a clone of this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#contains(E)">contains</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Determine if this set contains the given element.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#copy(edu.rit.util.Set)">copy</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Change this set to be a copy of the given set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>protected <a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#copyElement(E)">copyElement</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Copy 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/Set.html#difference(edu.rit.util.Set)">difference</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Change this set to be the difference of itself and the given set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.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/Set.html" title="type parameter in Set">E</a>> action)</code>
|
|
<div class="block">Perform the given action on each element in this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><R> R</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.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/Set.html" title="type parameter in Set">E</a>,R> action)</code>
|
|
<div class="block">Perform the given action on each element in this set and return a result.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#get(E)">get</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Get the given element in this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>protected int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#hashOf(E)">hashOf</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Returns a hash value for the given element.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#intersection(edu.rit.util.Set)">intersection</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Change this set to be the intersection of itself and the given set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#isEmpty()">isEmpty</a></strong>()</code>
|
|
<div class="block">Determine if this set is empty.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#isSubsetOf(edu.rit.util.Set)">isSubsetOf</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Determine if this set is a subset of the given set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.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="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#remove(E)">remove</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</code>
|
|
<div class="block">Remove the given element from this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#removeEachItemIf(edu.rit.util.Predicate)">removeEachItemIf</a></strong>(<a href="../../../edu/rit/util/Predicate.html" title="interface in edu.rit.util">Predicate</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> predicate)</code>
|
|
<div class="block">Evaluate the given predicate on, and possibly remove, each element in
|
|
this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>protected boolean</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#same(E, E)">same</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem1,
|
|
<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem2)</code>
|
|
<div class="block">Determine if the given elements are the same.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#size()">size</a></strong>()</code>
|
|
<div class="block">Returns the number of elements in this set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#symmetricDifference(edu.rit.util.Set)">symmetricDifference</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Change this set to be the symmetric difference of itself and the given
|
|
set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[]</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#toArray(E[])">toArray</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] array)</code>
|
|
<div class="block">Store this set's elements in the given array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[]</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#toArray(E[], int, int)">toArray</a></strong>(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] array,
|
|
int off,
|
|
int len)</code>
|
|
<div class="block">Store this set's elements in a portion of the given array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.html#union(edu.rit.util.Set)">union</a></strong>(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</code>
|
|
<div class="block">Change this set to be the union of itself and the given set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/util/Set.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#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="Set()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>Set</h4>
|
|
<pre>public Set()</pre>
|
|
<div class="block">Construct a new empty set.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="Set(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>Set</h4>
|
|
<pre>public Set(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Construct a new set that is a copy of the given set.
|
|
<P>
|
|
The elements of the given set are copied using the <a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set 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>set</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 set is empty.</div>
|
|
<dl><dt><span class="strong">Returns:</span></dt><dd>True if this set 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 set.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="copy(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>copy</h4>
|
|
<pre>public <a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> copy(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Change this set to be a copy of the given set.
|
|
<P>
|
|
The elements of the given set are copied using the <a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set to copy.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>This set.</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>set</TT> is null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="clone()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>clone</h4>
|
|
<pre>public <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> clone()</pre>
|
|
<div class="block">Create a clone of this set. The clone is a new set that contains copies
|
|
of the elements in this set.
|
|
<P>
|
|
The elements of this set are copied using the <a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method.</div>
|
|
<dl>
|
|
<dt><strong>Overrides:</strong></dt>
|
|
<dd><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></code> in class <code><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></code></dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>New set.</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 elements in this set.</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/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Determine if this set 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 set contains <TT>elem</TT>, 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="get(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="get(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public <a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> get(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Get the given element in this set. This method returns a reference to the
|
|
actual element in this set that is equal to <TT>elem</TT>; this might or
|
|
might not be the same object as <TT>elem</TT>. If this set does not
|
|
contain such an element, null is returned.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem</code> - Element.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>Element in this set that is equal to <TT>elem</TT>, or null if
|
|
this set does not contain such an 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)">
|
|
<!-- -->
|
|
</a><a name="add(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>add</h4>
|
|
<pre>public boolean add(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Add the given element to this set.
|
|
<P>
|
|
If not already present, a copy of the given element, created using the
|
|
<a href="../../../edu/rit/util/Set.html#copyElement(E)"><code>copyElement()</code></a> method, is added to this set.</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 set did not previously contain <TT>elem</TT>, 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="remove(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="remove(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre>public boolean remove(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Remove the given element from this set.</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 set previously contained <TT>elem</TT>, 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="isSubsetOf(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isSubsetOf</h4>
|
|
<pre>public boolean isSubsetOf(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Determine if this set is a subset of the given set. This is so if every
|
|
element of this set is also an element of the given set.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set.</dd>
|
|
<dt><span class="strong">Returns:</span></dt><dd>True if this set is a subset of the given set, false otherwise.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="union(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>union</h4>
|
|
<pre>public void union(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Change this set to be the union of itself and the given set. 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>set</code> - Set.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="intersection(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>intersection</h4>
|
|
<pre>public void intersection(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Change this set to be the intersection of itself and the given set. The
|
|
intersection consists of all elements that appear in this set and the
|
|
given set.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="difference(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>difference</h4>
|
|
<pre>public void difference(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Change this set to be the difference of itself and the given set. The
|
|
difference consists of all elements that appear in this set and not in
|
|
the given set.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="symmetricDifference(edu.rit.util.Set)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>symmetricDifference</h4>
|
|
<pre>public void symmetricDifference(<a href="../../../edu/rit/util/Set.html" title="class in edu.rit.util">Set</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> set)</pre>
|
|
<div class="block">Change this set to be the symmetric difference of itself and the given
|
|
set. The symmetric difference consists of all elements that appear in
|
|
this set or the given set, but not both.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - Set.</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/Set.html" title="type parameter in Set">E</a>> action)</pre>
|
|
<div class="block">Perform the given action on each element in this set. For each element in
|
|
this set in an unspecified order, the given <TT>action</TT>'s
|
|
<TT>run()</TT> method is called, passing in the element. The state of the
|
|
element must not be altered.
|
|
<P>
|
|
<B><I>Warning:</I></B> If the <TT>action</TT> adds elements to or removes
|
|
elements from the set, 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/Set.html" title="type parameter in Set">E</a>,R> action)</pre>
|
|
<div class="block">Perform the given action on each element in this set and return a result.
|
|
For each element in this set in an unspecified order, the given
|
|
<TT>action</TT>'s <TT>run()</TT> method is called, passing in the
|
|
element. The state of the element must not be altered. 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 set, 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="removeEachItemIf(edu.rit.util.Predicate)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>removeEachItemIf</h4>
|
|
<pre>public void removeEachItemIf(<a href="../../../edu/rit/util/Predicate.html" title="interface in edu.rit.util">Predicate</a><<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>> predicate)</pre>
|
|
<div class="block">Evaluate the given predicate on, and possibly remove, each element in
|
|
this set. For each element in this set in an unspecified order, the given
|
|
<TT>predicate</TT>'s <TT>test()</TT> method is called, passing in the
|
|
element. The state of the element must not be altered. If the
|
|
<TT>test()</TT> method returns true, the element is removed from this
|
|
set.
|
|
<P>
|
|
<B><I>Warning:</I></B> If the <TT>predicate</TT> adds elements to or
|
|
removes elements from the set, other than by returning true, the
|
|
<TT>removeEachItemIf()</TT> method's behavior is not specified.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>predicate</code> - Predicate.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toArray(java.lang.Object[])">
|
|
<!-- -->
|
|
</a><a name="toArray(E[])">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toArray</h4>
|
|
<pre>public <a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] toArray(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] array)</pre>
|
|
<div class="block">Store this set's elements in the given array. 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 set contains fewer than
|
|
<TT>array.length</TT> elements, the remaining array elements are set to
|
|
null.
|
|
<P>
|
|
The <TT>toArray()</TT> method stores <I>references</I> to the set
|
|
elements in the given array. The states of the set elements 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(java.lang.Object[],int,int)">
|
|
<!-- -->
|
|
</a><a name="toArray(E[], int, int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toArray</h4>
|
|
<pre>public <a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] toArray(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a>[] array,
|
|
int off,
|
|
int len)</pre>
|
|
<div class="block">Store this set's elements in a portion of the given array. 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 set contains
|
|
fewer than <TT>len</TT> elements, the remaining array elements are set to
|
|
null.
|
|
<P>
|
|
The <TT>toArray()</TT> method stores <I>references</I> to the set
|
|
elements in the given array. The states of the set elements 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 set elements are
|
|
written using <a href="../../../edu/rit/io/OutStream.html#writeObject(java.lang.Object)"><code>writeObject()</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 set elements are
|
|
read using <a href="../../../edu/rit/io/InStream.html#readObject()"><code>readObject()</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="copyElement(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="copyElement(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>copyElement</h4>
|
|
<pre>protected <a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> copyElement(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Copy the given element. The <TT>copyElement()</TT> method in class Set
|
|
merely returns the <TT>elem</TT> reference; this makes a <I>shallow
|
|
copy.</I> A subclass of class Set 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>
|
|
<a name="same(java.lang.Object,java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="same(E, E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>same</h4>
|
|
<pre>protected boolean same(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem1,
|
|
<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem2)</pre>
|
|
<div class="block">Determine if the given elements are the same. The <TT>same()</TT> method
|
|
in class Set returns <TT>elem1.equals(elem2)</TT>. A subclass of class
|
|
Set can override the <TT>same()</TT> method to use a different criterion
|
|
for whether the given elements are the same.
|
|
<P>
|
|
If the <TT>same()</TT> method says that two elements are the same, then
|
|
the <a href="../../../edu/rit/util/Set.html#hashOf(E)"><code>hashOf()</code></a> method must return the same hash
|
|
value for both elements.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>elem1</code> - First element; an element in this set.</dd><dd><code>elem2</code> - Second element; an element that might or might not be in
|
|
this set.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="hashOf(java.lang.Object)">
|
|
<!-- -->
|
|
</a><a name="hashOf(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>hashOf</h4>
|
|
<pre>protected int hashOf(<a href="../../../edu/rit/util/Set.html" title="type parameter in Set">E</a> elem)</pre>
|
|
<div class="block">Returns a hash value for the given element. The <TT>hashOf()</TT> method
|
|
in class Set returns <TT>elem.hashCode()</TT>. A subclass of class Set
|
|
can override the <TT>hashOf()</TT> method to calculate the hash value
|
|
differently.
|
|
<P>
|
|
If the <a href="../../../edu/rit/util/Set.html#same(E, E)"><code>same()</code></a> method says that two elements
|
|
are the same, then the <TT>hashOf()</TT> method must return the same hash
|
|
value for both elements.</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>
|
|
</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/Set.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/Searching.Short.html" title="class in edu.rit.util"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/util/Sorting.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/Set.html" target="_top">Frames</a></li>
|
|
<li><a href="Set.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>
|