public class StableVector extends GapVector
Modifier and Type | Field and Description |
---|---|
protected int |
free
The head of the free elements in position, if they are chained.
|
protected static int |
FREE_POSITION
An invalid value for an in-use element of positions.
|
protected int[] |
positions
This array maps from the exported ipos values (indexes in the positions
array) to the ipos of the underlying SimpleVector base.
|
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE
Modifier | Constructor and Description |
---|---|
protected |
StableVector() |
|
StableVector(SimpleVector base) |
Modifier and Type | Method and Description |
---|---|
protected int |
addPos(int ipos,
java.lang.Object value)
Add a value at a specified Pos.
|
protected void |
adjustPositions(int low,
int high,
int delta)
Add a delta to all positions elements that point into a given range.
|
protected int |
allocPositionIndex() |
protected void |
chainFreelist()
Put all free elements in positions in a chain starting with free.
|
void |
consumePosRange(int iposStart,
int iposEnd,
Consumer out) |
int |
copyPos(int ipos)
Make a copy of a position int.
|
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index.
|
int |
endPos() |
void |
fillPosRange(int fromPos,
int toPos,
java.lang.Object value) |
protected void |
gapReserve(int where,
int needed)
Adjust gap to 'where', and make sure it is least `needed'
elements long.
|
boolean |
hasNext(int ipos) |
protected boolean |
isAfterPos(int ipos)
Tests whether the position has the "isAfter" property.
|
int |
nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
|
int |
nextPos(int ipos)
Return the next position following the argument.
|
void |
releasePos(int ipos)
Reclaim any resources used by the given position int.
|
protected void |
removePosRange(int ipos0,
int ipos1)
Remove a range where each end-point is a position in a container.
|
protected void |
shiftGap(int newGapStart) |
int |
startPos() |
protected void |
unchainFreelist()
Set all free elements in positions to FREE_POSITION.
|
add, fill, gapReserve, get, getNextKind, getSegment, set, size
add, addAll, addAll, clear, compare, compare, compare, consume, consume, consumeNext, contains, containsAll, createRelativePos, elements, equals, equals, fill, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasPrevious, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, retainAll, set, setPosNext, setPosPrevious, stableCompare, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported, unsupportedException
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
consume
protected int[] positions
protected int free
protected static final int FREE_POSITION
public StableVector(SimpleVector base)
protected StableVector()
protected void chainFreelist()
protected void unchainFreelist()
public int startPos()
startPos
in class AbstractSequence
public int endPos()
endPos
in class AbstractSequence
protected int allocPositionIndex()
public int createPos(int index, boolean isAfter)
AbstractSequence
protected boolean isAfterPos(int ipos)
AbstractSequence
isAfterPos
in class GapVector
public int nextPos(int ipos)
AbstractSequence
nextPos
in class AbstractSequence
public int nextIndex(int ipos)
AbstractSequence
public void releasePos(int ipos)
AbstractSequence
releasePos
in class AbstractSequence
ipos
- the Pos being free'd.public int copyPos(int ipos)
AbstractSequence
copyPos
in class AbstractSequence
ipos
- the position being copied.public void fillPosRange(int fromPos, int toPos, java.lang.Object value)
fillPosRange
in class GapVector
protected void gapReserve(int where, int needed)
gapReserve
in class GapVector
protected void adjustPositions(int low, int high, int delta)
x==positions[i]
, then if
(unsigned)x>=(unsigned)low && (unsigned)x <= (unsigned)high
,
then add delta
to positions[i]
.
Using unsigned comparisons allows us to compare ipos values,
which include both the index and the isAfter low-order bit.protected int addPos(int ipos, java.lang.Object value)
AbstractSequence
protected void removePosRange(int ipos0, int ipos1)
AbstractSequence
removePosRange
in class GapVector
ipos0
- start of range, as a poistionipos1
- end of rangepublic void consumePosRange(int iposStart, int iposEnd, Consumer out)
consumePosRange
in class GapVector