org.apache.xalan.xsltc.dom
Class BitArray

java.lang.Object
  extended by org.apache.xalan.xsltc.dom.BitArray
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class BitArray
extends java.lang.Object
implements java.io.Externalizable

See Also:
Serialized Form

Field Summary
private  int _bit
           
private  int[] _bits
           
private  int _bitSize
           
(package private)  int _first
           
private  int _int
           
private  int _intSize
           
(package private)  int _last
           
private  int _mask
           
private static int[] _masks
           
private  int _node
           
private  int _pos
          This method returns the Nth bit that is set in the bit array.
private static boolean DEBUG_ASSERTIONS
           
(package private) static long serialVersionUID
           
 
Constructor Summary
BitArray()
          Constructor.
BitArray(int size)
           
BitArray(int size, int[] bits)
           
 
Method Summary
 BitArray cloneArray()
           
 int[] data()
          Returns the integer array in which the bit array is contained
 boolean getBit(int bit)
          Returns true if the given bit is set
 int getBitNumber(int pos)
           
 int getMask()
          See setMask()
 int getNextBit(int startBit)
          Returns the next set bit from a given position
 BitArray merge(BitArray other)
          Merge two bit arrays.
 void readExternal(java.io.ObjectInput in)
          Read the whole tree from a file (serialized)
 void resize(int newSize)
          Resizes the bit array - try to avoid using this method!!!
 void setBit(int bit)
          Sets a given bit
 void setMask(int mask)
          Set the mask for this bit array.
 int size()
          Returns the size of this bit array (in bits).
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

_bits

private int[] _bits

_bitSize

private int _bitSize

_intSize

private int _intSize

_mask

private int _mask

_masks

private static final int[] _masks

DEBUG_ASSERTIONS

private static final boolean DEBUG_ASSERTIONS
See Also:
Constant Field Values

_pos

private int _pos
This method returns the Nth bit that is set in the bit array. The current position is cached in the following 4 variables and will help speed up a sequence of next() call in an index iterator. This method is a mess, but it is fast and it works, so don't change it.


_node

private int _node

_int

private int _int

_bit

private int _bit

_first

int _first

_last

int _last
Constructor Detail

BitArray

public BitArray()
Constructor. Defines the initial size of the bit array (in bits).


BitArray

public BitArray(int size)

BitArray

public BitArray(int size,
                int[] bits)
Method Detail

setMask

public void setMask(int mask)
Set the mask for this bit array. The upper 8 bits of this mask indicate the DOM in which the nodes in this array belong.


getMask

public int getMask()
See setMask()


size

public final int size()
Returns the size of this bit array (in bits).


getBit

public final boolean getBit(int bit)
Returns true if the given bit is set


getNextBit

public final int getNextBit(int startBit)
Returns the next set bit from a given position


getBitNumber

public final int getBitNumber(int pos)

data

public final int[] data()
Returns the integer array in which the bit array is contained


setBit

public final void setBit(int bit)
Sets a given bit


merge

public final BitArray merge(BitArray other)
Merge two bit arrays. This currently only works for nodes from a single DOM (because there is only one _mask per array).


resize

public final void resize(int newSize)
Resizes the bit array - try to avoid using this method!!!


cloneArray

public BitArray cloneArray()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read the whole tree from a file (serialized)

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException