public class SetOf
extends java.lang.Object
This package also defines classes for iterating through SetOf objects: an Enumeration class (SetEnumeration) an IndexEnumeration class (SetIndices), and an Iterator class (SetIterator).
NB: There are some caveats to be aware of when using SetOf:
SetEnumeration,
SetIndices,
SetIterator| Constructor and Description |
|---|
SetOf(java.util.AbstractList base)
Constructs a new (empty) set with the specified AbstractList base.
|
SetOf(java.util.AbstractList base,
java.util.BitSet carrier)
Constructs a new set with the specified base and underlying bitset
representation.
|
SetOf(java.util.AbstractList base,
int index)
Constructs a new singleton set containing the single
specified index with the specified AbstractList base.
|
SetOf(java.util.AbstractList base,
java.lang.Object object)
Constructs a new singleton set containing the single
specified object with the specified AbstractList base.
|
SetOf(java.lang.Object[] base)
Constructs a new (empty) set with the specified array base.
|
SetOf(java.lang.Object[] base,
java.util.BitSet carrier)
Constructs a new set with the specified base and underlying bitset
representation.
|
SetOf(java.lang.Object[] base,
boolean synchronize)
Constructs a new (empty) set with the specified array base,
which is built as a Vector if synchronize
is true, or as an ArrayList otherwise.
|
SetOf(java.lang.Object[] base,
int index)
Constructs a new singleton set containing the single
specified index with the specified array base.
|
SetOf(java.lang.Object[] base,
java.lang.Object object)
Constructs a new singleton set containing the single
specified object with the specified array base.
|
SetOf(SetOf set)
Constructs a copy of the specified set.
|
| Modifier and Type | Method and Description |
|---|---|
SetOf |
add(int index)
Adds the element of specified index into this set.
|
SetOf |
add(java.lang.Object object)
Adds a specified object into this set.
|
static SetOf |
add(SetOf s,
int index)
Returns a new set obtained from the given set after adding
the given index.
|
boolean |
contains(int index)
Returns true iff the specified index is that of an element of this set.
|
boolean |
contains(java.lang.Object object)
Returns true iff the specified object is an element of this set.
|
java.util.Enumeration |
elements()
Returns an Enumeration over the object elements of this set.
|
boolean |
equals(java.lang.Object other)
Returns true iff the specified object is a set equal to this.
|
java.lang.Object |
firstElement()
Returns the first element in this set.
|
int |
firstIndex()
Returns the base index of the first element in this set.
|
int |
hashCode()
Returns a hashcode for this set.
|
int |
indexOf(java.lang.Object object)
Returns the index of a specified object element of this set.
|
IndexEnumeration |
indices()
Returns an enumeration-like object over the base structure's indices for
the elements of this set.
|
SetOf |
intersection(SetOf other)
Modifies this set to the intersection of this set and the specified set.
|
static SetOf |
intersection(SetOf s1,
SetOf s2)
Returns the intersection of two sets without modifying either one.
|
boolean |
isEmpty()
Returns true iff this set is empty.
|
boolean |
isEqualTo(SetOf other)
Returns true iff this set is equal to the specified set.
|
boolean |
isFull()
Returns true iff this set contains all the base structure's elements.
|
boolean |
isStrictSubsetOf(SetOf other)
Returns true iff this set is strictly included in the
specified set.
|
boolean |
isSubsetOf(SetOf other)
Returns true iff this set is included in or equal to the
specified set.
|
java.util.Iterator |
iterator()
Returns an Iterator over the object elements of this set.
|
SetOf |
minus(SetOf other)
Modifies this set to the difference of this set and the specified set.
|
static SetOf |
minus(SetOf s1,
SetOf s2)
Returns the difference of two sets without modifying either one.
|
SetOf |
not()
Modifies this set to its complement (relative to the base).
|
static SetOf |
not(SetOf s)
Returns the complement (relative to the base) of the specified set
without modifying it.
|
SetOf |
remove(int index)
Removes the element of specified index from this set.
|
SetOf |
remove(java.lang.Object object)
Removes the specified object from this set.
|
static SetOf |
remove(SetOf s,
int index)
Returns a new set obtained from the given set after removing
the given index.
|
int |
size()
Returns the number of elements in this set.
|
java.lang.String |
toBitString()
Returns a string representation of this set as a bit string of 0's and 1's.
|
java.lang.String |
toBitString(char out,
char in)
Returns a string representation of this set as a bit string of two
specified characters standing for "absent" and "present" respectively.
|
SetOf |
top()
Returns a set representing the reference set; that is, a set
containing all the base structure's elements.
|
java.lang.String |
toString()
Returns a string representation of this set as a comma-separated
list of elements between curly braces.
|
SetOf |
union(SetOf other)
Modifies this set to the union of this set and the specified set.
|
static SetOf |
union(SetOf s1,
SetOf s2)
Returns the union of two sets without modifying either one.
|
public SetOf(java.lang.Object[] base,
boolean synchronize)
base - the reference set as an arraysynchronize - if true, the base structure is synchronizedpublic SetOf(java.lang.Object[] base)
base - the reference set as an arraypublic SetOf(java.util.AbstractList base)
base - the reference set as an AbstractList.public SetOf(java.util.AbstractList base,
int index)
base - the reference set as a AbstractListindex - the index of the objectpublic SetOf(java.lang.Object[] base,
int index)
base - the reference set as an arrayindex - the index of the objectpublic SetOf(java.util.AbstractList base,
java.lang.Object object)
base - the reference set as a AbstractListobject - the objectpublic SetOf(java.lang.Object[] base,
java.lang.Object object)
base - the reference set as an arrayobject - the objectpublic SetOf(SetOf set)
set - the set to copypublic SetOf(java.lang.Object[] base,
java.util.BitSet carrier)
base - the reference set as an arraycarrier - the bitset representationpublic SetOf(java.util.AbstractList base,
java.util.BitSet carrier)
base - the reference set as a AbstractListcarrier - the bitset representationpublic final int size()
public final SetOf top()
public final boolean isFull()
public final boolean isEmpty()
public final int indexOf(java.lang.Object object)
object - the objectpublic final SetOf add(int index)
index - the indexpublic final SetOf add(java.lang.Object object)
object - the objectpublic static final SetOf add(SetOf s, int index)
s - a setindex - the indexpublic final SetOf remove(int index)
index - the indexpublic final SetOf remove(java.lang.Object object)
object - the objectpublic static final SetOf remove(SetOf s, int index)
s - a setindex - the indexpublic final int firstIndex()
public final java.lang.Object firstElement()
public final SetOf union(SetOf other)
other - a setpublic static final SetOf union(SetOf s1, SetOf s2)
s1 - a sets2 - a setpublic final SetOf intersection(SetOf other)
other - a setpublic static final SetOf intersection(SetOf s1, SetOf s2)
s1 - a sets2 - a setpublic final SetOf minus(SetOf other)
other - a setpublic static final SetOf minus(SetOf s1, SetOf s2)
s1 - a sets2 - a setpublic final SetOf not()
public static final SetOf not(SetOf s)
s - a setpublic final boolean contains(int index)
index - the indexpublic final boolean contains(java.lang.Object object)
object - the objectpublic final boolean isSubsetOf(SetOf other)
other - a setpublic final boolean isStrictSubsetOf(SetOf other)
other - a setpublic final boolean isEqualTo(SetOf other)
other - a setpublic final boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - an objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.String toBitString()
public final java.lang.String toBitString(char out,
char in)
out - a characterin - a characterpublic final java.util.Enumeration elements()
public final java.util.Iterator iterator()
public final IndexEnumeration indices()