Top Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.dom

public Class BitArray

extends Object
implements Externalizable
Class Inheritance
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, com.sun.org.apache.xml.internal.dtm.DTMAxisIterator

Author
Morten Jorgensen

Field Summary

Modifier and TypeField and Description
private int
private int[]
private int
pack-priv int
private int
private int
pack-priv int
private int
private static final int[]
private int
private int
_pos

This method returns the Nth bit that is set in the bit array.

private static final boolean
pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
BitArray()

Constructor.

public
BitArray(int size)

public
BitArray(int size, int[] bits)

Method Summary

Modifier and TypeMethod and Description
public BitArray
public final int[]
data()

Returns the integer array in which the bit array is contained

public final boolean
getBit(int bit)

Returns true if the given bit is set

public final int
getBitNumber(int pos)

public int
getMask()

See setMask()

public final int
getNextBit(int startBit)

Returns the next set bit from a given position

public final BitArray
merge(BitArray other)

Merge two bit arrays.

public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Implements java.io.Externalizable.readExternal.

Read the whole tree from a file (serialized)

public final void
resize(int newSize)

Resizes the bit array - try to avoid using this method!!!

public final void
setBit(int bit)

Sets a given bit

public void
setMask(int mask)

Set the mask for this bit array.

public final int
size()

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

public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bitback to summary
private int _bit
_bitsback to summary
private int[] _bits
_bitSizeback to summary
private int _bitSize
_firstback to summary
pack-priv int _first
_intback to summary
private int _int
_intSizeback to summary
private int _intSize
_lastback to summary
pack-priv int _last
_maskback to summary
private int _mask
_masksback to summary
private static final int[] _masks
_nodeback to summary
private int _node
_posback to summary
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.

DEBUG_ASSERTIONSback to summary
private static final boolean DEBUG_ASSERTIONS
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Constructor Detail

BitArrayback to summary
public BitArray()

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

BitArrayback to summary
public BitArray(int size)
BitArrayback to summary
public BitArray(int size, int[] bits)

Method Detail

cloneArrayback to summary
public BitArray cloneArray()
databack to summary
public final int[] data()

Returns the integer array in which the bit array is contained

getBitback to summary
public final boolean getBit(int bit)

Returns true if the given bit is set

getBitNumberback to summary
public final int getBitNumber(int pos)
getMaskback to summary
public int getMask()

See setMask()

getNextBitback to summary
public final int getNextBit(int startBit)

Returns the next set bit from a given position

mergeback to summary
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).

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Read the whole tree from a file (serialized)

Parameters
in:ObjectInput

Doc from java.io.Externalizable.readExternal.

the stream to read data from in order to restore the object

Exceptions
IOException:

Doc from java.io.Externalizable.readExternal.

if I/O errors occur

ClassNotFoundException:

Doc from java.io.Externalizable.readExternal.

If the class for an object being restored cannot be found.

resizeback to summary
public final void resize(int newSize)

Resizes the bit array - try to avoid using this method!!!

setBitback to summary
public final void setBit(int bit)

Sets a given bit

setMaskback to summary
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.

sizeback to summary
public final int size()

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

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Exceptions
IOException:
Includes any I/O exceptions that may occur