| java.lang.Object gnu.lists.AbstractSequence gnu.lists.TreeList
All known Subclasses: gnu.mapping.Values, gnu.mapping.ValueStack,
TreeList | public class TreeList extends AbstractSequence implements Consumer,PositionConsumer,Consumable(Code) | | A compact representation of a tree, that is a nested list structure.
The data structure can store anything that can be emitted to a Consumer.
This data structure is optimized for efficient forwards traversal
through the data structure, not random access.
It does have an "insertion point"; insertions and deletions are
efficient through the use of a buffer gap.
It is a reasonable choice for a "DOM" for XML data.
|
Field Summary | |
final static int | BEGIN_ATTRIBUTE_LONG The beginning of an attribute.
[BEGIN_ATTRIBUTE_LONG]
[index], 2 shorts, where objects[index] is the attribute type name
and objects[index+1] is the attribute type object.
[end_offset], 2 shorts, giving the location of the following
END_ATTRIBUTE. | final static int | BEGIN_DOCUMENT Beginning of a document.
No parameters. | final static int | BEGIN_GROUP_LONG Begin of a group, non-compact form.
[BEGIN_GROUP_LONG]
[end_offset], in 2 shorts. | final static int | BEGIN_GROUP_SHORT Beginning of a group, compact form.
[BEGIN_GROUP_SHORT + index], where objects[index] is the group's
type name and objects[index+1] is the type object.
[end_offset], the unsigned offset (from the initial word)
to the corresponding END_GROUP_SHORT.
[parent_offset], the (unsigned absolute value of the) offset
to the outer BEGIN_GROUP_SHORT/BEGIN_GROUP_LONG. | final static int | BEGIN_GROUP_SHORT_INDEX_MAX | final static char | BOOL_FALSE The value used to encode false. | final static char | BOOL_TRUE The value used to encode true. | final static int | BYTE_PREFIX Encoding prefix that indicates a byte value. | final static int | CHAR_FOLLOWS A 16-bit (non-compact) Unicode char follows. | final static int | CHAR_PAIR_FOLLOWS A surrogate pair follows. | final static int | DOUBLE_FOLLOWS A 64-bit double floating-pointer number. | final static int | END_ATTRIBUTE The end of an attribute of a node. | final static int | END_GROUP_LONG End of a group, non-compact form.
[END_GROUP_LONG]
[index], 2 shorts where objects[index] is the group's type name and
objects[index+1] is the type object.
[begin_offset], in 2 shorts. | final static int | END_GROUP_SHORT End of a group, compact form.
[END_GROUP_SHORT]
[begin_offset], the unsigned absolute value of the offset to the
matching BEGIN. | final static int | FLOAT_FOLLOWS A 64-bit float floating-pointer number. | final static int | INT_FOLLOWS A 32-bit integer, non-compact form. | final static int | INT_SHORT_ZERO The value used to encode the integer zero. | final static int | LONG_FOLLOWS A 64-bit long integer. | final static int | MAX_CHAR_SHORT The largest Unicode character that can be encoded in one char. | final static int | MAX_INT_SHORT The largest integer that can use the short int encoding. | final static int | MIN_INT_SHORT The smallest integer that can use the short int encoding. | final static char | OBJECT_REF_FOLLOWS Followed by 2 chars that provide an index into objects. | final static int | OBJECT_REF_SHORT The value used to encode the object in objects[0]. | final static int | OBJECT_REF_SHORT_INDEX_MAX The maximum offset in the objects array for a short object-ref. | final static char | POSITION_REF_FOLLOWS Followed by 2 chars that provide an index into objects. | final static char | POSITION_TRIPLE_FOLLOWS A position triple referenceing some other "nodes".
Followed by index of squence (2 chars), ipos (2 chars), and
index of xpos or -1 if xpos==null (2 chars). | public int | attrStart If non-zero, gap is in an attribute starting (1 less than) here. | final static Object | availObject | int | currentBeginGroup | public char[] | data | public int | gapEnd | public int | gapStart | public Object[] | objects |
Method Summary | |
public void | beginAttribute(String attrName, Object attrType) | public void | beginAttribute(int index) | public void | beginDocument() | public void | beginGroup(String typeName, Object type) | public void | beginGroup(int index) | public void | clear() | public boolean | consume(TreePosition position) | public void | consume(Consumer out) | public boolean | consumeNext(int ipos, Object xpos, Consumer out) | public int | consumeRange(int startPosition, int endPosition, Consumer out) | public void | dump() | public void | dump(java.io.PrintWriter out) | public void | endAttribute() | public void | endDocument() | public void | endGroup(String typeName) | public void | ensureSpace(int needed) | protected int | find(Object arg1) | protected int | find(Object arg1, Object arg2) | public Object | get(int index) | final protected int | getIntN(int index) Get a 32-bit int from the data array. | final protected long | getLongN(int index) Get a 64-bit long from the data array. | public Object | getNext(int ipos, Object xpos) | public int | getNextKind(int ipos, Object xpos) | protected int | getNextTypeIndex(int ipos, Object xpos) | public String | getNextTypeName(int ipos, Object xpos) | public Object | getNextTypeObject(int ipos, Object xpos) | public boolean | gotoAttributesStart(TreePosition pos) | public int | gotoAttributesStart(int index) | public boolean | gotoChildrenStart(TreePosition pos) | public int | gotoChildrenStart(int index) | public boolean | hasNext(int ipos, Object xpos) | public boolean | ignoring() | public boolean | isEmpty() | protected void | makePosition(int index, boolean isAfter, PositionContainer posSet, int posNumber) | protected void | makeRelativePosition(int istart, Object xstart, int offset, boolean isAfter, PositionContainer posSet, int posNumber) | public int | nextDataIndex(int pos) | final public void | resizeObjects() | final public void | setIntN(int index, int i) | public int | size() | public int | stringValue(int index, StringBuffer sbuf) | public int | stringValue(boolean inGroup, int index, StringBuffer sbuf) | public void | write(char[] buf, int off, int len) | public void | writeBoolean(boolean v) | public void | writeByte(int v) | public void | writeChar(int i) | public void | writeChars(String str) | public void | writeDouble(double v) | public void | writeFloat(float v) | public void | writeInt(int v) | public void | writeLong(long v) | public void | writeObject(Object v) | public boolean | writePosition(AbstractSequence seq, int ipos, Object xpos) |
BEGIN_ATTRIBUTE_LONG | final static int BEGIN_ATTRIBUTE_LONG(Code) | | The beginning of an attribute.
[BEGIN_ATTRIBUTE_LONG]
[index], 2 shorts, where objects[index] is the attribute type name
and objects[index+1] is the attribute type object.
[end_offset], 2 shorts, giving the location of the following
END_ATTRIBUTE. If the attribute straddles the gap, then
end_offset is a negative offset relative to data.length.
(Therefore allocating more space for the gap does not require
adjusting end_offset.) Otherwise, the end_offset is relative
to the BEGIN_ATTRIBUTE_LONG word.
|
BEGIN_DOCUMENT | final static int BEGIN_DOCUMENT(Code) | | Beginning of a document.
No parameters. Used to distinguish a document from its element node.
|
BEGIN_GROUP_LONG | final static int BEGIN_GROUP_LONG(Code) | | Begin of a group, non-compact form.
[BEGIN_GROUP_LONG]
[end_offset], in 2 shorts. The position of the matching END_GROUP_LONG.
If the group straddles the gap, then end_offset is a negative offset
relative to data.length. (Therefore allocating more space for the
gap does not require adjusting any end_offset.) If the group and
and its children are all on the same side of the gap, then end_offset
is a positive offset relative to the BEGIN_GROUP_LONG word. (Hence
shifting an entire group when the gap is moved does not require
changing its end_offset.)
Note that the space taken by a BEGIN_GROUP_LONG is the same that
needed for a BEGIN_GROUP_SHORT (but a END_GROUP_LONG takes much
more space than a END_GROUP_SHORT). This is to make it easier
to convert a BEGIN_GROUP_LONG to a BEGIN_GROUP_SHORT or vice
versa, as needed.
|
BEGIN_GROUP_SHORT | final static int BEGIN_GROUP_SHORT(Code) | | Beginning of a group, compact form.
[BEGIN_GROUP_SHORT + index], where objects[index] is the group's
type name and objects[index+1] is the type object.
[end_offset], the unsigned offset (from the initial word)
to the corresponding END_GROUP_SHORT.
[parent_offset], the (unsigned absolute value of the) offset
to the outer BEGIN_GROUP_SHORT/BEGIN_GROUP_LONG. (If this is the
outermost group, then parent_offset==0.)
This should is used when index < BEGIN_GROUP_SHORT_INDEX_MAX,
both end_offset and parent_offset fit in 16 bits,
and the group does not straddle the gap.
|
BEGIN_GROUP_SHORT_INDEX_MAX | final static int BEGIN_GROUP_SHORT_INDEX_MAX(Code) | | |
BOOL_FALSE | final static char BOOL_FALSE(Code) | | The value used to encode false.
|
BOOL_TRUE | final static char BOOL_TRUE(Code) | | The value used to encode true.
|
BYTE_PREFIX | final static int BYTE_PREFIX(Code) | | Encoding prefix that indicates a byte value.
|
CHAR_FOLLOWS | final static int CHAR_FOLLOWS(Code) | | A 16-bit (non-compact) Unicode char follows.
|
CHAR_PAIR_FOLLOWS | final static int CHAR_PAIR_FOLLOWS(Code) | | A surrogate pair follows. (not implemented).
|
DOUBLE_FOLLOWS | final static int DOUBLE_FOLLOWS(Code) | | A 64-bit double floating-pointer number.
[DOUBLE_FOLLOWS]
[word1], [word2], [word3], [word4]: The big-endian bits of the double.
|
END_ATTRIBUTE | final static int END_ATTRIBUTE(Code) | | The end of an attribute of a node.
|
END_GROUP_LONG | final static int END_GROUP_LONG(Code) | | End of a group, non-compact form.
[END_GROUP_LONG]
[index], 2 shorts where objects[index] is the group's type name and
objects[index+1] is the type object.
[begin_offset], in 2 shorts. The position of the matching
BEGIN_GROUP_LONG. If the group straddles the gap, then begin_offset
is the actual index (i.e. relative to the start of data) of the
matching BEGIN_GROUP_LONG. (Therefore allocating more space for the
gap does not require adjusting begin_offset.) If the group does not
straddle the gap, then begin_offset is a negative offset relative
to the END_GROUP_LONG word. (Hence shifting an entire group when
the gap is moved does not require changing its begin_offset.)
relative to data.length.
[parent_offset], in 2 shorts. The position of the outer BEGIN_GROUP_LONG
or BEGIN_GROUP_SHORT. If the difference straddles the gap (i.e.
either this group straddles the gap or the parent group does and the
gap precedes this group), then parent_offset is the actual index
of the parent group. Otherwise, then parent_offset is a negative
offset relative to the END_GROUP_LONG word.
|
END_GROUP_SHORT | final static int END_GROUP_SHORT(Code) | | End of a group, compact form.
[END_GROUP_SHORT]
[begin_offset], the unsigned absolute value of the offset to the
matching BEGIN. (This is the same as the matching end_offset.)
|
FLOAT_FOLLOWS | final static int FLOAT_FOLLOWS(Code) | | A 64-bit float floating-pointer number.
[FLOAT_FOLLOWS]
[word1], [word2]: The big-endian bits of the float.
|
INT_FOLLOWS | final static int INT_FOLLOWS(Code) | | A 32-bit integer, non-compact form.
[INT_FOLLOWS]
[word1], [word2]: The big-endian bits of the integer.
|
INT_SHORT_ZERO | final static int INT_SHORT_ZERO(Code) | | The value used to encode the integer zero.
|
LONG_FOLLOWS | final static int LONG_FOLLOWS(Code) | | A 64-bit long integer.
[LONG_FOLLOWS]
[word1], [word2], [word3], [word4]: The big-endian bits of the long.
|
MAX_CHAR_SHORT | final static int MAX_CHAR_SHORT(Code) | | The largest Unicode character that can be encoded in one char.
|
MAX_INT_SHORT | final static int MAX_INT_SHORT(Code) | | The largest integer that can use the short int encoding.
|
MIN_INT_SHORT | final static int MIN_INT_SHORT(Code) | | The smallest integer that can use the short int encoding.
|
OBJECT_REF_FOLLOWS | final static char OBJECT_REF_FOLLOWS(Code) | | Followed by 2 chars that provide an index into objects.
|
OBJECT_REF_SHORT | final static int OBJECT_REF_SHORT(Code) | | The value used to encode the object in objects[0].
|
OBJECT_REF_SHORT_INDEX_MAX | final static int OBJECT_REF_SHORT_INDEX_MAX(Code) | | The maximum offset in the objects array for a short object-ref.
|
POSITION_REF_FOLLOWS | final static char POSITION_REF_FOLLOWS(Code) | | Followed by 2 chars that provide an index into objects.
|
POSITION_TRIPLE_FOLLOWS | final static char POSITION_TRIPLE_FOLLOWS(Code) | | A position triple referenceing some other "nodes".
Followed by index of squence (2 chars), ipos (2 chars), and
index of xpos or -1 if xpos==null (2 chars).
|
attrStart | public int attrStart(Code) | | If non-zero, gap is in an attribute starting (1 less than) here.
|
currentBeginGroup | int currentBeginGroup(Code) | | |
gapStart | public int gapStart(Code) | | |
TreeList | public TreeList()(Code) | | |
TreeList | public TreeList(TreeList list, int startPosition, int endPosition)(Code) | | Make a copy of a sub-range of a TreeList.
Parameters: list - the TreeList to copy Parameters: startPosition - start of range, as a raw index in data Parameters: endPosition - end of range, as a raw index in data |
beginAttribute | public void beginAttribute(int index)(Code) | | |
beginDocument | public void beginDocument()(Code) | | |
beginGroup | public void beginGroup(int index)(Code) | | |
clear | public void clear()(Code) | | |
consumeRange | public int consumeRange(int startPosition, int endPosition, Consumer out)(Code) | | |
endAttribute | public void endAttribute()(Code) | | |
endDocument | public void endDocument()(Code) | | |
ensureSpace | public void ensureSpace(int needed)(Code) | | |
getIntN | final protected int getIntN(int index)(Code) | | Get a 32-bit int from the data array.
|
getLongN | final protected long getLongN(int index)(Code) | | Get a 64-bit long from the data array.
|
getNextKind | public int getNextKind(int ipos, Object xpos)(Code) | | |
getNextTypeIndex | protected int getNextTypeIndex(int ipos, Object xpos)(Code) | | |
gotoAttributesStart | public int gotoAttributesStart(int index)(Code) | | |
gotoChildrenStart | public int gotoChildrenStart(int index)(Code) | | |
ignoring | public boolean ignoring()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
makeRelativePosition | protected void makeRelativePosition(int istart, Object xstart, int offset, boolean isAfter, PositionContainer posSet, int posNumber)(Code) | | |
nextDataIndex | public int nextDataIndex(int pos)(Code) | | |
resizeObjects | final public void resizeObjects()(Code) | | |
setIntN | final public void setIntN(int index, int i)(Code) | | |
write | public void write(char[] buf, int off, int len)(Code) | | |
writeBoolean | public void writeBoolean(boolean v)(Code) | | |
writeByte | public void writeByte(int v)(Code) | | |
writeChar | public void writeChar(int i)(Code) | | |
writeDouble | public void writeDouble(double v)(Code) | | |
writeFloat | public void writeFloat(float v)(Code) | | |
writeInt | public void writeInt(int v)(Code) | | |
writeLong | public void writeLong(long v)(Code) | | |
Methods inherited from gnu.lists.AbstractSequence | protected void add(PositionContainer posSet, int posNumber, Object value)(Code)(Java Doc) public boolean add(Object o)(Code)(Java Doc) public void add(int index, Object o)(Code)(Java Doc) public boolean addAll(Collection c)(Code)(Java Doc) public boolean addAll(int index, Collection c)(Code)(Java Doc) public void clear()(Code)(Java Doc) public int compare(int ipos1, Object xpos1, int ipos2, Object xpos2)(Code)(Java Doc) final public int compare(SeqPosition i1, SeqPosition i2)(Code)(Java Doc) protected void consume(int iposStart, Object xposStart, int iposEnd, Object xposEnd, Consumer out)(Code)(Java Doc) public void consume(Consumer out)(Code)(Java Doc) public boolean consumeNext(int ipos, Object xpos, Consumer out)(Code)(Java Doc) public boolean contains(Object o)(Code)(Java Doc) public boolean containsAll(Collection c)(Code)(Java Doc) public void copyPosition(int ipos, Object xpos, PositionContainer posSet, int posNumber)(Code)(Java Doc) public Enumeration elements()(Code)(Java Doc) public boolean equals(int ipos1, Object xpos1, int ipos2, Object xpos2)(Code)(Java Doc) public boolean equals(Object o)(Code)(Java Doc) public void fill(Object value)(Code)(Java Doc) public void fill(int fromIndex, int toIndex, Object value)(Code)(Java Doc) protected int fromEndIndex(int ipos, Object xpos)(Code)(Java Doc) abstract public Object get(int index)(Code)(Java Doc) public Object get(int[] indexes)(Code)(Java Doc) public Object getAttribute(int index)(Code)(Java Doc) public int getAttributeLength()(Code)(Java Doc) protected int getContainingSequenceSize(int ipos, Object xpos)(Code)(Java Doc) public int getEffectiveIndex(int[] indexes)(Code)(Java Doc) protected int getIndexDifference(int ipos1, Object xpos1, int ipos0, Object xpos0)(Code)(Java Doc) public SeqPosition getIterator()(Code)(Java Doc) protected Object getNext(int ipos, Object xpos)(Code)(Java Doc) public int getNextKind(int ipos, Object xpos)(Code)(Java Doc) public String getNextTypeName(int ipos, Object xpos)(Code)(Java Doc) public Object getNextTypeObject(int ipos, Object xpos)(Code)(Java Doc) protected Object getPrevious(int ipos, Object xpos)(Code)(Java Doc) protected boolean gotoAttributesStart(TreePosition pos)(Code)(Java Doc) public boolean gotoChildrenStart(TreePosition pos)(Code)(Java Doc) public boolean gotoNext(PositionContainer posSet, int posNumber)(Code)(Java Doc) public boolean gotoNext(SeqPosition pos)(Code)(Java Doc) protected boolean gotoParent(TreePosition pos)(Code)(Java Doc) protected boolean gotoPrevious(PositionContainer posSet, int posNumber)(Code)(Java Doc) protected boolean hasNext(int ipos, Object xpos)(Code)(Java Doc) protected boolean hasPrevious(int ipos, Object xpos)(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public int indexOf(Object o)(Code)(Java Doc) protected boolean isAfter(int ipos, Object xpos)(Code)(Java Doc) public boolean isEmpty()(Code)(Java Doc) public Iterator iterator()(Code)(Java Doc) public int lastIndexOf(Object o)(Code)(Java Doc) public ListIterator listIterator()(Code)(Java Doc) public ListIterator listIterator(int index)(Code)(Java Doc) public void makeEndPosition(SeqPosition pos)(Code)(Java Doc) protected void makeEndPosition(PositionContainer poses, int positionNumber)(Code)(Java Doc) final protected void makePosition(int index, SeqPosition pos)(Code)(Java Doc) public void makePosition(int index, boolean isAfter, SeqPosition pos)(Code)(Java Doc) abstract protected void makePosition(int index, boolean isAfter, PositionContainer posSet, int posNumber)(Code)(Java Doc) protected void makeRelativePosition(int istart, Object xstart, int offset, boolean isAfter, PositionContainer posSet, int posNumber)(Code)(Java Doc) public void makeStartPosition(SeqPosition pos)(Code)(Java Doc) protected void makeStartPosition(PositionContainer poses, int positionNumber)(Code)(Java Doc) protected int nextIndex(int ipos, Object xpos)(Code)(Java Doc) final public int nextIndex(SeqPosition pos)(Code)(Java Doc) public int rank()(Code)(Java Doc) protected void releasePosition(int ipos, Object xpos)(Code)(Java Doc) final protected void releasePosition(SeqPosition pos)(Code)(Java Doc) protected void releasePosition(PositionContainer posSet, int posNumber)(Code)(Java Doc) protected void remove(int ipos, Object xpos, int count)(Code)(Java Doc) protected void remove(int ipos0, Object xpos0, int ipos1, Object xpos1)(Code)(Java Doc) public Object remove(int index)(Code)(Java Doc) public boolean remove(Object o)(Code)(Java Doc) public boolean removeAll(Collection c)(Code)(Java Doc) public boolean retainAll(Collection c)(Code)(Java Doc) public Object set(int[] indexes, Object value)(Code)(Java Doc) public Object set(int index, Object element)(Code)(Java Doc) protected void setNext(int ipos, Object xpos, Object value)(Code)(Java Doc) protected void setPrevious(int ipos, Object xpos, Object value)(Code)(Java Doc) abstract public int size()(Code)(Java Doc) public List subList(int fromIx, int toIx)(Code)(Java Doc) public Sequence subSequence(SeqPosition start, SeqPosition end)(Code)(Java Doc) protected Sequence subSequence(int ipos0, Object xpos0, int ipos1, Object xpos1)(Code)(Java Doc) public Object[] toArray()(Code)(Java Doc) public Object[] toArray(Object[] arr)(Code)(Java Doc) protected RuntimeException unsupported(String text)(Code)(Java Doc)
|
|
|