xxl.util
Class BitSet

java.lang.Object
  |
  +--xxl.util.BitSet

public class BitSet
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable, Convertable

This class is a replacement for java.util.BitSet which neither implements Covertable nor Comparable.


Field Summary
protected  long[] bits
           
protected  int precision
           
 
Constructor Summary
BitSet()
           
BitSet(BitSet b)
           
BitSet(int precision)
          Creates a new BitSet.
 
Method Summary
 void clear(int bitIndex)
           
 java.lang.Object clone()
           
 int compare(BitSet b, int nobits)
          Compares two BitSets and returns a negative value if BitSet a is smaller than BitSet b, a positive value if BitSet b is smaller, else 0 is returned.
 int compare(BitSet b, int nobits, int dim, int maxDim)
          Compares two BitSets with regard to only one dimension .
 int compareTo(java.lang.Object o)
          Compares two BitSets and returns a negative value if BitSet a is smaller than BitSet b, a positive value if BitSet b is smaller, else 0 is returned.
 int diff(BitSet b)
          Compares two BitSets and returns the index of the first bit that differs.
 int diff(BitSet b, int nobits)
          Compares the first bits of two BitSets and returns the index of the first bit that differs.
 boolean get(int bitIndex)
           
static void main(java.lang.String[] args)
           
 void read(java.io.DataInput in)
           
 void set(int bitIndex)
           
 int size()
           
 int sizeOf()
           
 java.lang.String toString()
           
 int write(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bits

protected long[] bits

precision

protected int precision
Constructor Detail

BitSet

public BitSet()

BitSet

public BitSet(int precision)
Creates a new BitSet.
Parameters:
precision - the number of bits stored by this BitSet

BitSet

public BitSet(BitSet b)
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

set

public void set(int bitIndex)

get

public boolean get(int bitIndex)

clear

public void clear(int bitIndex)

size

public int size()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

read

public void read(java.io.DataInput in)
          throws java.io.IOException
Specified by:
read in interface Convertable

write

public int write(java.io.DataOutput out)
          throws java.io.IOException
Specified by:
write in interface Convertable

sizeOf

public int sizeOf()
Specified by:
sizeOf in interface Convertable

diff

public int diff(BitSet b,
                int nobits)
Compares the first bits of two BitSets and returns the index of the first bit that differs.

diff

public int diff(BitSet b)
Compares two BitSets and returns the index of the first bit that differs.

compare

public int compare(BitSet b,
                   int nobits,
                   int dim,
                   int maxDim)
Compares two BitSets with regard to only one dimension .

compare

public int compare(BitSet b,
                   int nobits)
Compares two BitSets and returns a negative value if BitSet a is smaller than BitSet b, a positive value if BitSet b is smaller, else 0 is returned.
Parameters:
bits - maximum number of bits to compare

compareTo

public int compareTo(java.lang.Object o)
Compares two BitSets and returns a negative value if BitSet a is smaller than BitSet b, a positive value if BitSet b is smaller, else 0 is returned.
Specified by:
compareTo in interface java.lang.Comparable

main

public static void main(java.lang.String[] args)