All Packages Class Hierarchy This Package Previous Next Index
Class structure.BitSet
java.lang.Object

+structure.BitSet
 public class BitSet
 extends Object
A simple class implementing a set of numbered bits.
 See Also:
 java.util.BitSet

BitSet()
 Constructs an empty bitset.

BitSet(int)
 Constructs an empty bitset with potential to hold values between
0..count1.

add(int)
 Adds a bit to the bitset, if not already there.

clear()
 Remove all bits from the set.

clear(int)
 Remove bits from set; set size to count.

clone()
 Returns a copy of the set.

contains(int)
 Determine if a bit is a member of the set.

difference(BitSet)
 Computes the difference between this set and the other.

equals(Object)
 Return true iff this set and o contain the same elements.

intersection(BitSet)
 Return the intersection of this set and the other.

isEmpty()
 Determine if a set is empty.

remove(int)
 Remove bit i from the bitset.

subset(BitSet)
 Returns true iff this set is a subset of the other.

toString()
 Constructs string representing set.

union(BitSet)
 Compute a new set that is the union of this set and other.
BitSet
public BitSet()
 Constructs an empty bitset.
 Postcondition:
 constructs an empty set of small integers
BitSet
public BitSet(int count)
 Constructs an empty bitset with potential to hold values between
0..count1.
 Postcondition:
 constructs an empty set with count potential elements
 Parameters:
 count  The number of distinct values possibly in set.
add
public void add(int i)
 Adds a bit to the bitset, if not already there.
Set is potentially extended.
 Precondition:
 i >= 0
 Postcondition:
 i is added to the set
 Parameters:
 i  The number of the bit to be added.
remove
public void remove(int i)
 Remove bit i from the bitset.
 Precondition:
 i >= 0
 Postcondition:
 removes i from set if present
 Parameters:
 i  The index of the bit to be removed.
contains
public boolean contains(int i)
 Determine if a bit is a member of the set.
 Precondition:
 i >= 0
 Postcondition:
 returns true iff i in set
 Parameters:
 i  The bit index of potential bit.
 Returns:
 True iff bit i is in the set.
clear
public void clear()
 Remove all bits from the set.
 Postcondition:
 removes all values from set
clear
public void clear(int count)
 Remove bits from set; set size to count.
 Postcondition:
 removes all values from set, sets set size to count
 Parameters:
 count  The new capacity of the newly empty set.
clone
public Object clone()
 Returns a copy of the set.
 Postcondition:
 constructs a copy of the set
 Returns:
 A new BitSet with the same values as this.
 Overrides:
 clone in class Object
union
public Object union(BitSet other)
 Compute a new set that is the union of this set and other.
Elements of the new set appear in at least one of the two sets.
 Precondition:
 other is nonnull
 Postcondition:
 constructs set w/elements from this and other
 Parameters:
 other  The set to be unioned with this.
 Returns:
 The union of the two sets.
intersection
public Object intersection(BitSet other)
 Return the intersection of this set and the other.
A bit is in the result if it is in this set and other.
 Precondition:
 other is not null
 Postcondition:
 constructs set w/elements in this and other
 Parameters:
 other  The other set to be intersected with this.
difference
public Object difference(BitSet other)
 Computes the difference between this set and the other.
An element is in the difference if it is in this, but not in other.
 Precondition:
 other is not null
 Postcondition:
 constructs set w/elements from this but not other
 Parameters:
 other  The difference between this set and other.
subset
public boolean subset(BitSet other)
 Returns true iff this set is a subset of the other.
A set is a subset of another if its elements are elements
of the other.
 Precondition:
 other is not null
 Postcondition:
 returns true iff elements of this are all in other
 Parameters:
 other  The potential superset.
 Returns:
 The difference between this and other.
isEmpty
public boolean isEmpty()
 Determine if a set is empty.
 Postcondition:
 returns true iff this set is empty
 Returns:
 True iff this set is empty.
equals
public boolean equals(Object o)
 Return true iff this set and o contain the same elements.
 Precondition:
 o is not null
 Postcondition:
 returns true iff this and o have same elements
 Parameters:
 o  Another nonnull bitset.
 Returns:
 True iff this set has the same elements as o.
 Overrides:
 equals in class Object
toString
public String toString()
 Constructs string representing set.
 Postcondition:
 returns string representation of set
 Returns:
 String representing bitset.
 Overrides:
 toString in class Object
All Packages Class Hierarchy This Package Previous Next Index