gnu.lists

Class ExtSequence

Known Direct Subclasses:
LList

public abstract class ExtSequence
extends AbstractSequence

Abstract helper class for Sequences that use an ExtPosition. That is sequences where it is inefficient to represent a position just using a Pos int.

Method Summary

int
copyPos(int ipos)
Make a copy of a position int.
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
releasePos(int ipos)
Reclaim any resources used by the given position int.

Methods inherited from class gnu.lists.AbstractSequence

add, add, addAll, addAll, addPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, hashCode, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, size, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported, unsupportedException

Method Details

copyPos

public int copyPos(int ipos)
Make a copy of a position int. For simple positions returns the argument. However, if the positions are magic cookies that are actively managed by the sequence (as opposed to for example a simple index), then making a copy may need to increment a reference count, or maybe allocate a new position cookie. In any case, the new position is initialized to the same offset (and isAfter property) as the original.
Overrides:
copyPos in interface AbstractSequence
Parameters:
ipos - the position being copied.
Returns:
the new position

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?
Overrides:
isAfterPos in interface AbstractSequence

nextIndex

protected int nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
Overrides:
nextIndex in interface AbstractSequence

releasePos

protected void releasePos(int ipos)
Reclaim any resources used by the given position int.
Overrides:
releasePos in interface AbstractSequence
Parameters:
ipos - the Pos being free'd.