com.JLex
Class JavaLexBitSet

java.lang.Object
  extended by com.JLex.JavaLexBitSet
All Implemented Interfaces:
java.lang.Cloneable

final class JavaLexBitSet
extends java.lang.Object
implements java.lang.Cloneable

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

Author:
Arthur van Hoff, revised by Elliot Joel Berk

Field Summary
(package private)  long[] bits
           
(package private) static int BITS
           
(package private) static int MASK
           
 
Constructor Summary
JavaLexBitSet()
          Creates an empty set.
JavaLexBitSet(int nbits)
          Creates an empty set with the specified size.
 
Method Summary
 void and(JavaLexBitSet set)
          Logically ANDs this bit set with the specified set of bits.
 void clear(int bit)
          Clears a bit.
 java.lang.Object clone()
          Clones the JavaLexBitSet.
 boolean equals(java.lang.Object obj)
          Compares this object against the specified object.
 boolean get(int bit)
          Gets a bit.
 int hashCode()
          Gets the hashcode.
private  int nbits2size(int nbits)
           
 void or(JavaLexBitSet set)
          Logically ORs this bit set with the specified set of bits.
private  void resize(int nbits)
           
 void set(int bit)
          Sets a bit.
 int size()
          Calculates and returns the set's size
 java.lang.String toString()
          Converts the JavaLexBitSet to a String.
 void xor(JavaLexBitSet 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
 

Field Detail

BITS

static final int BITS
See Also:
Constant Field Values

MASK

static final int MASK
See Also:
Constant Field Values

bits

long[] bits
Constructor Detail

JavaLexBitSet

public JavaLexBitSet()
Creates an empty set.


JavaLexBitSet

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

Parameters:
nbits - the size of the set
Method Detail

nbits2size

private int nbits2size(int nbits)

resize

private void resize(int nbits)

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(JavaLexBitSet 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(JavaLexBitSet 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(JavaLexBitSet 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 java.lang.Object

size

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


equals

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

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with
Returns:
true if the objects are the same; false otherwise.

clone

public java.lang.Object clone()
Clones the JavaLexBitSet.

Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Converts the JavaLexBitSet to a String.

Overrides:
toString in class java.lang.Object