java.util
Class BitSet

java.lang.Object
  |
  +--java.util.BitSet
All Implemented Interfaces:
Cloneable

public final class BitSet
extends Object
implements Cloneable

A set of bits. The set automatically grows as more bits are needed.


Constructor Summary
BitSet()
          Creates an empty set.
BitSet(int nbits)
          Creates an empty set with the specified size.
 
Method Summary
 void and(BitSet set)
          Logically ANDs this bit set with the specified set of bits.
 void clear(int bit)
          Clears a bit.
 Object clone()
          Clones the BitSet.
 boolean equals(Object obj)
          Compares this object against the specified object.
 boolean get(int bit)
          Gets a bit.
 int hashCode()
          Gets the hashcode.
 void or(BitSet set)
          Logically ORs this bit set with the specified set of bits.
 void set(int bit)
          Sets a bit.
 int size()
          Calculates and returns the set's size
 String toString()
          Converts the BitSet to a String.
 void xor(BitSet set)
          Logically XORs this bit set with the specified set of bits.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BitSet

public BitSet()
Creates an empty set.


BitSet

public BitSet(int nbits)
Creates an empty set with the specified size.

Parameters:
nbits - the size of the set
Method Detail

set

public void set(int bit)
Sets a bit.

Parameters:
bit - the bit to be set

clear

public void clear(int bit)
Clears a bit.

Parameters:
bit - the bit to be cleared

get

public boolean get(int bit)
Gets a bit.

Parameters:
bit - the bit to be gotten

and

public void and(BitSet set)
Logically ANDs this bit set with the specified set of bits.

Parameters:
set - the bit set to be ANDed with

or

public void or(BitSet set)
Logically ORs this bit set with the specified set of bits.

Parameters:
set - the bit set to be ORed with

xor

public void xor(BitSet set)
Logically XORs this bit set with the specified set of bits.

Parameters:
set - the bit set to be XORed with

hashCode

public int hashCode()
Gets the hashcode.

Overrides:
hashCode in class Object
See Also:
Hashtable

size

public int size()
Calculates and returns the set's size


equals

public boolean equals(Object obj)
Compares this object against the specified object.

Overrides:
equals in class Object
Parameters:
obj - the object to commpare with
Returns:
true if the objects are the same; false otherwise.
See Also:
Hashtable

clone

public Object clone()
Clones the BitSet.

Overrides:
clone in class Object
Returns:
a clone of this Object.

toString

public String toString()
Converts the BitSet to a String.

Overrides:
toString in class Object