|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectEDU.auburn.VGJ.graph.Set
This class is similar to Java's BitSet class (only it is not full of bugs). It is used to represent an ordered set of non-negative integers. The set automatically grows as more spaces are needed.
Here is the source.
Constructor Summary | |
Set()
Construct an empty Set. |
|
Set(int element)
Construct a Set with one element. |
Method Summary | |
java.lang.Object |
clone()
Make a copy of current set. |
void |
difference(Set s)
Modify the current set to the difference of current set and s (current - s). |
boolean |
equals(Set s)
Check if set s equals to current set. |
void |
fill(int n)
Put elements 0 to n - 1 into the current set. |
int |
first()
Find the first element of current set. |
void |
includeElement(int n)
Include element n into the current set. |
void |
indexedUnion(Set[] set_list,
Set index)
|
void |
intersect(Set s)
Modify the current set to the intersection of current set and set s. |
boolean |
intersects(Set set)
|
boolean |
isElement(int n)
Check if n is an element of currernt set. |
boolean |
isEmpty()
Check if current set is empty. |
boolean |
isSubset(Set s)
Check if set s is a subset of current set. |
int |
next()
Find the next element of current set. |
int |
numberOfElements()
Find the number of elements of current set. |
void |
removeElement(int n)
Remove element n from the current set. |
int |
searchNext(int n)
Start at position n to search next element. |
java.lang.String |
toShortString()
Convert set to "(0-2, 5, 9 ..., n)" String format. |
java.lang.String |
toString()
Convert set to "(0, 1, 2, ..., n)" String format. |
void |
union(Set s)
Modify the current set to the union of current set and set s. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Set()
public Set(int element)
Method Detail |
public int searchNext(int n)
n
- start position of searching
public boolean isEmpty()
public int first()
public int next()
public boolean isElement(int n)
n
- element to be checked
public void includeElement(int n)
n
- element to be includedpublic void removeElement(int n) throws java.util.NoSuchElementException
n
- element to removed
java.util.NoSuchElementException
public boolean isSubset(Set s)
s
- subset to be checked
public void intersect(Set s)
s
- set to be checked
public void union(Set s)
s
- set to be united
public void difference(Set s)
s
- set to be checked
public java.lang.Object clone()
public boolean equals(Set s)
s
- set to be check
public java.lang.String toString()
public java.lang.String toShortString()
public int numberOfElements()
public void fill(int n)
n
- number of elements to be includedpublic void indexedUnion(Set[] set_list, Set index)
public boolean intersects(Set set)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |