Top Description Inners Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref

pack-priv final Class ChunkedIntArray

extends Object
Class Inheritance
Imports
com.sun.org.apache.xml.internal.res.XMLErrorResources, .XMLMessages

ChunkedIntArray is an extensible array of blocks of integers. (I'd consider Vector, but it's unable to handle integers except by turning them into Objects.)

Making this a separate class means some call-and-return overhead. But doing it all inline tends to be fragile and expensive in coder time, not to mention driving up code size. If you want to inline it, feel free. The Java text suggest that private and Final methods may be inlined, and one can argue that this beast need not be made subclassable...

%REVIEW% This has strong conceptual overlap with the IntVector class. It would probably be a good thing to merge the two, when time permits.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv ChunkedIntArray.ChunksVector
pack-priv final int[]
pack-priv int
pack-priv static final int
pack-priv static final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
ChunkedIntArray(int slotsize)

Create a new CIA with specified record size.

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

the index at which this record was inserted.
appendSlot
(int w0, int w1, int w2, int w3)

Append a 4-integer record to the CIA, starting with record 1.

pack-priv void
discardLast()

Disard the highest-numbered record.

pack-priv int
readEntry(int
int Record number
position
,
int
int Column number
offset
)

Retrieve an integer from the CIA by record number and column within the record, both 0-based (though position 0 is reserved for special purposes).

pack-priv void
readSlot(int
int Record number
position
,
int[]
int[] Integer array provided by user, must be large enough to hold a complete record.
buffer
)

Retrieve the contents of a record into a user-supplied buffer array.

pack-priv int

Returns:

int index of highest-numbered record currently in use
slotsUsed
()

pack-priv int
specialFind(int startPos, int position)

pack-priv void
writeEntry(int
int Record number
position
,
int
int Column number
offset
,
int
int New contents
value
)

Overwrite the integer found at a specific record and column.

pack-priv void
writeSlot(int
integer Record number
position
,
int
int
w0
,
int
int
w1
,
int
int
w2
,
int
int
w3
)

Overwrite an entire (4-integer) record at the specified index.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chunkallocback to summary
pack-priv static final int chunkalloc
chunksback to summary
pack-priv ChunkedIntArray.ChunksVector chunks
fastArrayback to summary
pack-priv final int[] fastArray
lastUsedback to summary
pack-priv int lastUsed
lowbitsback to summary
pack-priv static final int lowbits
lowmaskback to summary
pack-priv static final int lowmask
slotsizeback to summary
pack-priv final int slotsize

Constructor Detail

ChunkedIntArrayback to summary
pack-priv ChunkedIntArray(int slotsize)

Create a new CIA with specified record size. Currently record size MUST be a power of two... and in fact is hardcoded to 4.

Method Detail

appendSlotback to summary
pack-priv int appendSlot(int w0, int w1, int w2, int w3)

Append a 4-integer record to the CIA, starting with record 1. (Since arrays are initialized to all-0, 0 has been reserved as the "unknown" value in DTM.)

Returns:int

the index at which this record was inserted.

discardLastback to summary
pack-priv void discardLast()

Disard the highest-numbered record. This is used in the string-buffer CIA; when only a single characters() chunk has been recieved, its index is moved into the Text node rather than being referenced by indirection into the text accumulator.

readEntryback to summary
pack-priv int readEntry(int position, int offset) throws ArrayIndexOutOfBoundsException

Retrieve an integer from the CIA by record number and column within the record, both 0-based (though position 0 is reserved for special purposes).

Parameters
position:int

int Record number

offset:int

int Column number

readSlotback to summary
pack-priv void readSlot(int position, int[] buffer)

Retrieve the contents of a record into a user-supplied buffer array. Used to reduce addressing overhead when code will access several columns of the record.

Parameters
position:int

int Record number

buffer:int[]

int[] Integer array provided by user, must be large enough to hold a complete record.

slotsUsedback to summary
pack-priv int slotsUsed()
Returns:int

int index of highest-numbered record currently in use

specialFindback to summary
pack-priv int specialFind(int startPos, int position)
writeEntryback to summary
pack-priv void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException

Overwrite the integer found at a specific record and column. Used to back-patch existing records, most often changing their "next sibling" reference from 0 (unknown) to something meaningful

Parameters
position:int

int Record number

offset:int

int Column number

value:int

int New contents

writeSlotback to summary
pack-priv void writeSlot(int position, int w0, int w1, int w2, int w3)

Overwrite an entire (4-integer) record at the specified index. Mostly used to create record 0, the Document node.

Parameters
position:int

integer Record number

w0:int

int

w1:int

int

w2:int

int

w3:int

int

com.sun.org.apache.xml.internal.dtm.ref back to summary

pack-priv Class ChunkedIntArray.ChunksVector

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.org.apache.xml.internal.dtm.ref.ChunkedIntArray.ChunksVector

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv int[][]
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addElement(int[] value)

pack-priv final int[]
elementAt(int pos)

pack-priv final int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BLOCKSIZEback to summary
pack-priv final int BLOCKSIZE
m_mapback to summary
pack-priv int[][] m_map
m_mapSizeback to summary
pack-priv int m_mapSize
posback to summary
pack-priv int pos

Constructor Detail

ChunksVectorback to summary
pack-priv ChunksVector()

Method Detail

addElementback to summary
pack-priv void addElement(int[] value)
elementAtback to summary
pack-priv final int[] elementAt(int pos)
sizeback to summary
pack-priv final int size()