|
|||||||||
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
public class GapVector
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.
Field Summary | |
---|---|
SimpleVector |
base
|
int |
gapEnd
|
int |
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 | |
---|---|
GapVector(SimpleVector base)
|
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object o)
See java.util.List. |
protected int |
addPos(int ipos,
java.lang.Object value)
Add a value at a specified Pos. |
void |
consumePosRange(int iposStart,
int iposEnd,
Consumer out)
|
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index. |
void |
fill(java.lang.Object value)
|
void |
fillPosRange(int fromPos,
int toPos,
java.lang.Object value)
|
protected void |
gapReserve(int size)
Make sure gap is at least 'size' elements long. |
protected void |
gapReserve(int where,
int size)
Adjust gap to 'where', and make sure it is least `size' elements long. |
java.lang.Object |
get(int index)
See java.util.List. |
int |
getNextKind(int ipos)
|
boolean |
hasNext(int ipos)
|
protected boolean |
isAfterPos(int ipos)
Tests whether the position has the "isAfter" property. |
protected int |
nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie. |
protected void |
removePosRange(int ipos0,
int ipos1)
Remove a range where each end-point is a position in a container. |
java.lang.Object |
set(int index,
java.lang.Object value)
|
protected void |
shiftGap(int newGapStart)
|
int |
size()
See java.util.List. |
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 |
---|
public SimpleVector base
public int gapStart
public int gapEnd
Constructor Detail |
---|
public GapVector(SimpleVector base)
Method Detail |
---|
public int size()
AbstractSequence
size
in interface Sequence
size
in interface java.util.Collection
size
in interface java.util.List
size
in class AbstractSequence
public boolean hasNext(int ipos)
hasNext
in class AbstractSequence
public int getNextKind(int ipos)
getNextKind
in class AbstractSequence
public java.lang.Object get(int index)
AbstractSequence
get
in interface Sequence
get
in interface java.util.List
get
in class AbstractSequence
public java.lang.Object set(int index, java.lang.Object value)
set
in interface java.util.List
set
in class AbstractSequence
public void fill(java.lang.Object value)
fill
in interface Sequence
fill
in class AbstractSequence
public void fillPosRange(int fromPos, int toPos, java.lang.Object value)
fillPosRange
in class AbstractSequence
protected void shiftGap(int newGapStart)
protected void gapReserve(int size)
protected void gapReserve(int where, int size)
protected int addPos(int ipos, java.lang.Object value)
AbstractSequence
addPos
in class AbstractSequence
public void add(int index, java.lang.Object o)
AbstractSequence
add
in interface java.util.List
add
in class AbstractSequence
protected void removePosRange(int ipos0, int ipos1)
AbstractSequence
removePosRange
in class AbstractSequence
ipos0
- start of range, as a poistionipos1
- end of rangepublic int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertyprotected boolean isAfterPos(int ipos)
AbstractSequence
isAfterPos
in class AbstractSequence
protected int nextIndex(int ipos)
AbstractSequence
nextIndex
in class AbstractSequence
public void consumePosRange(int iposStart, int iposEnd, Consumer out)
consumePosRange
in class AbstractSequence
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |