|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.lists.AbstractSequence gnu.lists.GapVector gnu.lists.StableVector
public class StableVector
Implements a stable sequence with sticky positions. I.e if you have a position, it gets automatically updated after insertions and deletions.
Field Summary | |
---|---|
protected int |
free
The index of the first free element in positions, or -1 if none. |
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. |
Fields inherited from class gnu.lists.GapVector |
---|
base, gapEnd, gapStart |
Fields inherited from interface gnu.lists.Sequence |
---|
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, GROUP_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 |
Constructor Summary | |
---|---|
StableVector(SimpleVector base)
|
Method Summary | |
---|---|
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 size)
Make sure gap is at least 'size' 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()
At all free elements in positions to FREE_POSITION. |
Methods inherited from class gnu.lists.GapVector |
---|
add, fill, gapReserve, get, getNextKind, set, size |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gnu.lists.Sequence |
---|
elements, isEmpty |
Methods inherited from interface java.util.List |
---|
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, subList, toArray, toArray |
Methods inherited from interface gnu.lists.Consumable |
---|
consume |
Field Detail |
---|
protected int[] positions
protected int free
protected static final int FREE_POSITION
Constructor Detail |
---|
public StableVector(SimpleVector base)
Method Detail |
---|
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
createPos
in class GapVector
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertyprotected boolean isAfterPos(int ipos)
AbstractSequence
isAfterPos
in class GapVector
public boolean hasNext(int ipos)
hasNext
in class GapVector
public int nextPos(int ipos)
AbstractSequence
nextPos
in class AbstractSequence
public int nextIndex(int ipos)
AbstractSequence
nextIndex
in class GapVector
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 shiftGap(int newGapStart)
shiftGap
in class GapVector
protected void adjustPositions(int low, int high, int delta)
protected void gapReserve(int size)
GapVector
gapReserve
in class GapVector
protected int addPos(int ipos, java.lang.Object value)
AbstractSequence
addPos
in class GapVector
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |