|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.neu.ccs.demeterf.lib.Set<X>
public class Set<X>
Represents a Set of comparable Elements, implemented with RBTrees.
Nested Class Summary | |
---|---|
static class |
Set.Merge<X>
Function Class to help in the merging of Sets. |
static class |
Set.tree
Field Class |
Constructor Summary | |
---|---|
Set(java.util.Comparator<X> c,
X... xs)
Construct a Set from a parameter array. |
|
Set(List<X> l)
Construct a Set from a List of Comparable elements. |
|
Set(RBTree<Wrap<X>> t)
Construct a Set from a tree of Wrapped (Comparable) elements. |
|
Set(X... xs)
Construct a Set from a parameter array of Comparable elements. |
Method Summary | ||
---|---|---|
Set<X> |
add(X x)
Returns a new Set that also contains the given element. |
|
boolean |
contains(X x)
Is the given element present in this Set? |
|
static
|
create()
Construct the empty Set of Comparable elements. |
|
static
|
create(java.util.Comparator<X> c)
Construct the empty Set with a separate Comparator. |
|
static
|
create(List<X> l)
Construct a Set from a List of Comparable elements. |
|
static
|
create(List<X> l,
java.util.Comparator<X> c)
Construct a Set from a List with a separate Comparator. |
|
static
|
create(X... xs)
Construct a Set from a number of Comparable elements. |
|
Set<X> |
difference(Set<X> s)
Returns a new Set that is the difference of this and the given Set. |
|
boolean |
equals(java.lang.Object o)
Set equality (s == t) is (s.subset(t) && t.subset(s)). |
|
int |
hashCode()
Return the combined underlying elements HashCode |
|
Set<X> |
intersect(Set<X> s)
Returns a new Set that is the intersection of this and the given Set. |
|
boolean |
isEmpty()
Is this set empty? |
|
java.util.Iterator<X> |
iterator()
Returns an iterator for this Set, in the order defined by the Comparator. |
|
Set<X> |
merge(Set<X> s,
Set.Merge<X> m)
Merge two sets with like elements merged by the given function object |
|
Set<X> |
merge(X x,
Set.Merge<X> m)
Merge a single element merged by the given function object |
|
Set<X> |
remove(X x)
Returns a new Set that no longer contains the given element. |
|
int |
size()
Return the nuber of elements in this Set |
|
boolean |
subseteq(Set<X> s)
Is this Set a subset of (or equal to) the given set? |
|
List<X> |
toList()
Returns this Set as a List, in the order defined by the Comparator. |
|
java.lang.String |
toString()
Produce a string representation of this Set. |
|
Set<X> |
union(Set<X> s)
Returns a new Set that is the union of this and the given Set. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Set(List<X> l)
public Set(X... xs)
public Set(java.util.Comparator<X> c, X... xs)
public Set(RBTree<Wrap<X>> t)
Method Detail |
---|
public static <X extends java.lang.Comparable<X>> Set<X> create()
public static <X> Set<X> create(java.util.Comparator<X> c)
public static <X extends java.lang.Comparable<X>> Set<X> create(List<X> l)
public static <X> Set<X> create(List<X> l, java.util.Comparator<X> c)
public static <X extends java.lang.Comparable<X>> Set<X> create(X... xs)
public boolean contains(X x)
public boolean isEmpty()
public int size()
public Set<X> add(X x)
public Set<X> remove(X x)
public boolean subseteq(Set<X> s)
public Set<X> union(Set<X> s)
public Set<X> intersect(Set<X> s)
public Set<X> difference(Set<X> s)
public List<X> toList()
public java.util.Iterator<X> iterator()
iterator
in interface java.lang.Iterable<X>
public Set<X> merge(Set<X> s, Set.Merge<X> m)
public Set<X> merge(X x, Set.Merge<X> m)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |