public abstract class AbstractSequence<E>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int[] |
noInts |
Constructor and Description |
---|
AbstractSequence() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o)
See java.util.Collection.
|
void |
add(int index,
E o)
See java.util.List.
|
boolean |
addAll(java.util.Collection<? extends E> c)
See java.util.Collection.
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
See java.util.Collection.
|
protected int |
addPos(int ipos,
E value)
Add a value at a specified Pos.
|
Array<E> |
asImmutable() |
protected java.lang.RuntimeException |
badRank(int i) |
int |
boundedHash(int seed,
int limit) |
protected void |
checkCanWrite() |
protected void |
checkRank(int i) |
void |
clear() |
static int |
compare(AbstractSequence seq1,
int pos1,
AbstractSequence seq2,
int pos2)
This is used for the XML concept of "document order".
|
int |
compare(int ipos1,
int ipos2)
Compare two positions, and indicate their relative order.
|
int |
compare(SeqPosition i1,
SeqPosition i2) |
void |
consume(Consumer out) |
void |
consume(int fromIndex,
int toIndex,
Consumer out) |
boolean |
consumeNext(int ipos,
Consumer out)
Copy an element specified by a position pair to a Consumer.
|
void |
consumePosRange(int iposStart,
int iposEnd,
Consumer out) |
boolean |
contains(java.lang.Object o)
See java.util.List.
|
boolean |
containsAll(java.util.Collection<?> c)
See java.util.List.
|
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 |
createRelativePos(int pos,
int delta,
boolean isAfter) |
int |
effectiveIndex() |
int |
effectiveIndex(int index) |
int |
effectiveIndex(int[] indexes) |
int |
effectiveIndex(int i,
int j) |
int |
effectiveIndex(int i,
int j,
int k,
int... rest) |
java.util.Enumeration<E> |
elements() |
int |
endPos() |
boolean |
equals(int ipos1,
int ipos2)
Compare two positions, and indicate if they are the same position.
|
boolean |
equals(java.lang.Object o) |
void |
fill(E value) |
void |
fill(int fromIndex,
int toIndex,
E value) |
void |
fillPosRange(int fromPos,
int toPos,
E value) |
int |
firstAttributePos(int ipos)
Like firstChildPos.
|
int |
firstChildPos(int ipos)
Get position before first child (of the element following position).
|
int |
firstChildPos(int ipos,
ItemPredicate predicate) |
protected int |
fromEndIndex(int ipos) |
E |
get() |
E |
get(int i) |
E |
get(int[] indexes) |
E |
get(int i,
int j) |
E |
get(int i,
int j,
int k,
int... rest) |
java.lang.Object |
getAttribute(int index) |
int |
getAttributeLength() |
boolean |
getBooleanRaw(int index) |
byte |
getByteRaw(int index) |
char |
getCharRaw(int index) |
protected int |
getContainingSequenceSize(int ipos)
Get the size of the (sub-) sequence containing a given position.
|
double |
getDoubleRaw(int index) |
int |
getElementKind() |
float |
getFloatRaw(int index) |
protected int |
getIndexDifference(int ipos1,
int ipos0)
Get offset of (ipos1) relative to (ipos0).
|
int |
getInt() |
int |
getInt(int i) |
int |
getInt(int[] indexes) |
int |
getInt(int i,
int j) |
int |
getInt(int i,
int j,
int k,
int... rest) |
int |
getIntRaw(int index) |
SeqPosition<E,AbstractSequence<E>> |
getIterator() |
SeqPosition<E,AbstractSequence<E>> |
getIterator(int index) |
SeqPosition<E,AbstractSequence<E>> |
getIteratorAtPos(int ipos) |
long |
getLongRaw(int index) |
int |
getLowBound(int dim) |
int |
getNextKind(int ipos) |
java.lang.String |
getNextTypeName(int ipos) |
E |
getNextTypeObject(int ipos) |
java.lang.Object |
getPosNext(int ipos)
Get the element following the specified position.
|
java.lang.Object |
getPosPrevious(int ipos)
Get the element before the specified position.
|
E |
getRaw(int index) |
E |
getRowMajor(int index) |
short |
getShortRaw(int index) |
int |
getSize() |
int |
getSize(int dim) |
protected boolean |
gotoAttributesStart(TreePosition pos) |
boolean |
gotoChildrenStart(TreePosition pos)
Set position before first child (of the element following position).
|
protected boolean |
gotoParent(TreePosition pos) |
int |
hashCode() |
boolean |
hasNext(int ipos) |
protected boolean |
hasPrevious(int ipos)
Called by SeqPosition.hasPrevious.
|
int |
indexOf(java.lang.Object o)
See java.util.List.
|
protected boolean |
isAfterPos(int ipos)
Tests whether the position has the "isAfter" property.
|
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object o)
See java.util.List.
|
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
protected int |
nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
|
int |
nextIndex(SeqPosition pos) |
int |
nextMatching(int startPos,
ItemPredicate type,
int endPos,
boolean descend)
Get next matching child or descendent (ignoring attributes).
|
int |
nextPos(int ipos)
Return the next position following the argument.
|
int |
parentPos(int ipos)
Get position of parent.
|
int |
previousPos(int ipos)
Return the previous position following the argument.
|
int |
rank() |
protected void |
releasePos(int ipos)
Reclaim any resources used by the given position int.
|
E |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removePos(int ipos,
int count)
Remove one or more elements.
|
protected void |
removePosRange(int ipos0,
int ipos1)
Remove a range where each end-point is a position in a container.
|
boolean |
retainAll(java.util.Collection<?> c) |
void |
set(int[] indexes,
E value) |
E |
set(int index,
E value) |
void |
setAt(int index,
E value) |
protected void |
setBuffer(java.lang.Object obj) |
protected void |
setPosNext(int ipos,
E value) |
protected void |
setPosPrevious(int ipos,
E value) |
void |
setRaw(int index,
E value)
Given an "effective index", set selected element.
|
int |
size() |
int |
stableCompare(AbstractSequence other)
This is used for the XML concept of "document order".
|
int |
startPos() |
java.util.List<E> |
subList(int fromIx,
int toIx) |
Sequence |
subSequence(SeqPosition start,
SeqPosition end) |
protected Sequence<E> |
subSequencePos(int ipos0,
int ipos1) |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] arr) |
java.lang.String |
toString() |
void |
toString(java.lang.String sep,
java.lang.StringBuffer sbuf) |
protected java.lang.RuntimeException |
unsupported(java.lang.String text) |
static java.lang.RuntimeException |
unsupportedException(java.lang.String text) |
public int size()
public int getSize()
public boolean isEmpty()
public int rank()
protected void checkRank(int i)
protected java.lang.RuntimeException badRank(int i)
public E get()
public E get(int i)
public E get(int i, int j)
public E get(int i, int j, int k, int... rest)
public E get(int[] indexes)
protected void checkCanWrite()
public E getRowMajor(int index)
public int effectiveIndex()
public int effectiveIndex(int index)
public int effectiveIndex(int i, int j)
public int effectiveIndex(int i, int j, int k, int... rest)
public int effectiveIndex(int[] indexes)
public E getRaw(int index)
protected void setBuffer(java.lang.Object obj)
public void setRaw(int index, E value)
public boolean getBooleanRaw(int index)
public char getCharRaw(int index)
public byte getByteRaw(int index)
public short getShortRaw(int index)
public int getIntRaw(int index)
public long getLongRaw(int index)
public float getFloatRaw(int index)
public double getDoubleRaw(int index)
public int getInt()
public int getInt(int i)
public int getInt(int i, int j)
public int getInt(int i, int j, int k, int... rest)
public int getInt(int[] indexes)
public void set(int[] indexes, E value)
public int getLowBound(int dim)
public int getSize(int dim)
public int getElementKind()
protected java.lang.RuntimeException unsupported(java.lang.String text)
public static java.lang.RuntimeException unsupportedException(java.lang.String text)
public void setAt(int index, E value)
public void fill(E value)
public void fillPosRange(int fromPos, int toPos, E value)
public void fill(int fromIndex, int toIndex, E value)
public int indexOf(java.lang.Object o)
public int lastIndexOf(java.lang.Object o)
public int nextMatching(int startPos, ItemPredicate type, int endPos, boolean descend)
startPos
- starting positiontype
- a test (predicate) to apply to selected elementsendPos
- stop before endPosdescend
- if true do depth-first traversal.public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public final java.util.Enumeration<E> elements()
public final SeqPosition<E,AbstractSequence<E>> getIterator()
public SeqPosition<E,AbstractSequence<E>> getIterator(int index)
public SeqPosition<E,AbstractSequence<E>> getIteratorAtPos(int ipos)
public final java.util.Iterator<E> iterator()
public final java.util.ListIterator<E> listIterator()
public final java.util.ListIterator<E> listIterator(int index)
protected int addPos(int ipos, E value)
public boolean add(E o)
public void add(int index, E o)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean addAll(int index, java.util.Collection<? extends E> c)
public void removePos(int ipos, int count)
ipos
- position where elements should be removedcount
- if non-negative, remove that number of elements
following (poses, posNumber); if negative the negative of the number
of elements to remove before (poses, posNumber).java.lang.IndexOutOfBoundsException
- if (count >= 0 ? (index < 0 || index + count > size())
: (index + count < 0 || index > size()))
,
where index == nextIndex(ipos, xpos)
.protected void removePosRange(int ipos0, int ipos1)
ipos0
- start of range, as a poistionipos1
- end of rangejava.lang.IndexOutOfBoundsException
- if nextIndex(ipos0) > nextIndex(ipos1)
or nextIndex(ipos0) < 0
or nextIndex(ipos1) > size()
.public E remove(int index)
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public void clear()
protected boolean isAfterPos(int ipos)
public int createPos(int index, boolean isAfter)
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertyjava.lang.IndexOutOfBoundsException
- if index is out of boundspublic int createRelativePos(int pos, int delta, boolean isAfter)
public int startPos()
public int endPos()
protected void releasePos(int ipos)
ipos
- the Pos being free'd.public int copyPos(int ipos)
ipos
- the position being copied.protected int getIndexDifference(int ipos1, int ipos0)
protected int nextIndex(int ipos)
protected int fromEndIndex(int ipos)
protected int getContainingSequenceSize(int ipos)
public boolean hasNext(int ipos)
public int getNextKind(int ipos)
public java.lang.String getNextTypeName(int ipos)
public E getNextTypeObject(int ipos)
protected boolean hasPrevious(int ipos)
public int nextPos(int ipos)
public int previousPos(int ipos)
public final boolean gotoChildrenStart(TreePosition pos)
public int firstChildPos(int ipos)
ipos
- parent position. It is not released by this method.public int firstChildPos(int ipos, ItemPredicate predicate)
public int firstAttributePos(int ipos)
public int parentPos(int ipos)
ipos
- child position. It is not released by this method.protected boolean gotoParent(TreePosition pos)
public int getAttributeLength()
public java.lang.Object getAttribute(int index)
protected boolean gotoAttributesStart(TreePosition pos)
public java.lang.Object getPosNext(int ipos)
ipos
- the specified position.public java.lang.Object getPosPrevious(int ipos)
ipos
- the specified position.protected void setPosNext(int ipos, E value)
protected void setPosPrevious(int ipos, E value)
public final int nextIndex(SeqPosition pos)
public boolean equals(int ipos1, int ipos2)
public int compare(int ipos1, int ipos2)
public final int compare(SeqPosition i1, SeqPosition i2)
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] arr)
public int stableCompare(AbstractSequence other)
public static int compare(AbstractSequence seq1, int pos1, AbstractSequence seq2, int pos2)
public int hashCode()
hashCode
in class java.lang.Object
public int boundedHash(int seed, int limit)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public Sequence subSequence(SeqPosition start, SeqPosition end)
public java.util.List<E> subList(int fromIx, int toIx)
public boolean consumeNext(int ipos, Consumer out)
public void consumePosRange(int iposStart, int iposEnd, Consumer out)
public void consume(int fromIndex, int toIndex, Consumer out)
public void consume(Consumer out)
public void toString(java.lang.String sep, java.lang.StringBuffer sbuf)
public java.lang.String toString()
toString
in class java.lang.Object