An array with a gap in the middle, allowing efficient insert and delete.
The actual storage is delegated to a SimpleVector, so the element
type depends on the sub-class of SimpleVector used.
addPos
protected int addPos(int ipos,
Object value)
Add a value at a specified Pos.
- addPos in interface AbstractSequence
- the updated Pos, which is after the inserted value..
createPos
public int createPos(int index,
boolean isAfter)
Generate a position at a given index.
The result is a position cookie that must be free'd with releasePos.
- createPos in interface AbstractSequence
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter property
gapReserve
protected void gapReserve(int size)
Make sure gap is at least 'size' elements long.
gapReserve
protected void gapReserve(int where,
int size)
Adjust gap to 'where', and make sure it is least `size' elements long.
getSegment
public int getSegment(int where,
int len)
If needed, move the gap so the given segment is contiguous.
- the offset in the base array containing the segment,
or -1 if the parameters are bad.
isAfterPos
protected boolean isAfterPos(int ipos)
Tests whether the position has the "isAfter" property.
I.e. if something is inserted at the position, will
the iterator end up being after the new data?
- isAfterPos in interface AbstractSequence
nextIndex
protected int nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
- nextIndex in interface AbstractSequence
removePosRange
protected void removePosRange(int ipos0,
int ipos1)
Remove a range where each end-point is a position in a container.
- removePosRange in interface AbstractSequence
ipos0
- start of range, as a poistionipos1
- end of range
shiftGap
protected void shiftGap(int newGapStart)