org.apache.xalan.xsltc.dom

Class BitArray

Implemented Interfaces:
Externalizable

public class BitArray
extends java.lang.Object
implements Externalizable

Author:
Morten Jorgensen

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(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(ObjectOutput out)

Constructor Details

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 Details

cloneArray

public BitArray cloneArray()

data

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

getBit

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

getBitNumber

public final int getBitNumber(int pos)

getMask

public int getMask()
See setMask()

getNextBit

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

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).

readExternal

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

resize

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

setBit

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

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.

size

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

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException

Copyright B) 2005 Apache XML Project. All Rights Reserved.