|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.util.Set
A simple implementation of imperative sets. Set's may not contain null.
Field Summary | |
private java.util.Hashtable |
ht
We contain the element e iff ht has the mapping e -> e. |
Constructor Summary | |
Set()
Create an empty set |
|
Set(java.util.Enumeration e)
Create a set from the elements of an Enumeration |
Method Summary | |
boolean |
add(java.lang.Object o)
Add an element Return 'true' iff the element was already in the set. |
void |
addEnumeration(java.util.Enumeration e)
Add all the elements of a given enumeration |
void |
clear()
Remove all our elements |
java.lang.Object |
clone()
|
boolean |
contains(java.lang.Object o)
Do we contain a particular element? |
boolean |
containsAny(Set s)
Returns whether or not the set has any element in common with s . |
java.util.Enumeration |
elements()
Return an enumeration of our elements |
void |
intersect(Set s)
Remove all elements not contained in another set. |
boolean |
isEmpty()
Do we contain no elements? |
boolean |
remove(java.lang.Object o)
Remove a particular element if we contain it. |
int |
size()
Return the number of elements we hold. |
java.lang.String |
toString()
|
boolean |
union(Set s)
Adds all elements in another set. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.util.Hashtable ht
All mappings of ht are of the form e' -> e' for some e'.
Constructor Detail |
public Set()
public Set(java.util.Enumeration e)
Method Detail |
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.util.Enumeration elements()
public java.lang.String toString()
public void clear()
public boolean add(java.lang.Object o)
public void addEnumeration(java.util.Enumeration e)
public boolean remove(java.lang.Object o)
public void intersect(Set s)
public boolean union(Set s)
public boolean containsAny(Set s)
s
. Thus, if the intersection of the sets is empty,
that is, if the sets are disjoint, then false
is returned.
The operation leaves both sets unchanged.
public java.lang.Object clone()
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |