|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.lists.AbstractSequence gnu.lists.TreeList
public class TreeList
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 | |
---|---|
int |
attrStart
If non-zero, gap is in an attribute starting (1 less than) here. |
protected static int |
BEGIN_ATTRIBUTE_LONG
The beginning of an attribute. |
protected static int |
BEGIN_DOCUMENT
Beginning of a document (or top-level value). |
char[] |
data
|
int |
docStart
If non-zero, gap is in an document starting (1 less than) here. |
protected static int |
END_DOCUMENT
End of a document. |
protected static int |
END_GROUP_LONG
End of a group, non-compact form. |
protected static int |
END_GROUP_SHORT
End of a group, compact form. |
int |
gapEnd
|
int |
gapStart
|
static int |
INT_FOLLOWS
A 32-bit integer, non-compact form. |
java.lang.Object[] |
objects
|
int |
oindex
|
protected static char |
POSITION_PAIR_FOLLOWS
A position triple referenceing some other "nodes". |
protected static int |
PROCESSING_INSTRUCTION
A processing-instruction node follows. |
Constructor Summary | |
---|---|
TreeList()
|
|
TreeList(TreeList list)
|
|
TreeList(TreeList list,
int startPosition,
int endPosition)
Make a copy of a sub-range of a TreeList. |
Method Summary | |
---|---|
TreeList |
append(char c)
|
TreeList |
append(java.lang.CharSequence csq)
|
TreeList |
append(java.lang.CharSequence csq,
int start,
int end)
|
java.lang.Object |
baseUriOfPos(int pos)
Return of the base-uri property, if known, of the node at pos. |
void |
beginAttribute(int index)
|
void |
beginAttribute(java.lang.String attrName,
java.lang.Object attrType)
Write a attribute for the current group. |
void |
beginDocument()
|
void |
beginGroup(int index)
|
void |
beginGroup(java.lang.String typeName,
java.lang.Object type)
|
void |
clear()
|
int |
compare(int ipos1,
int ipos2)
Compare two positions, and indicate their relative order. |
void |
consume(Consumer out)
|
void |
consume(SeqPosition position)
Consume node at current position. |
int |
consumeIRange(int startPosition,
int endPosition,
Consumer out)
|
boolean |
consumeNext(int ipos,
Consumer out)
Copy an element specified by a position pair to a Consumer. |
void |
consumePosRange(int startPos,
int endPos,
Consumer out)
|
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index. |
int |
createRelativePos(int istart,
int offset,
boolean isAfter)
|
void |
dump()
|
void |
dump(java.io.PrintWriter out)
|
void |
endAttribute()
|
void |
endDocument()
|
void |
endGroup(java.lang.String typeName)
|
void |
ensureSpace(int needed)
|
int |
find(java.lang.Object arg1)
|
int |
find(java.lang.Object arg1,
java.lang.Object arg2)
|
int |
firstAttributePos(int ipos)
Like firstChildPos. |
int |
firstChildPos(int ipos)
Get position before first child (of the element following position). |
java.lang.Object |
get(int index)
See java.util.List. |
protected int |
getIndexDifference(int ipos1,
int ipos0)
Get offset of (ipos1) relative to (ipos0). |
protected int |
getIntN(int index)
Get a 32-bit int from the data array. |
protected long |
getLongN(int index)
Get a 64-bit long from the data array. |
int |
getNextKind(int ipos)
|
protected int |
getNextTypeIndex(int ipos)
|
java.lang.String |
getNextTypeName(int ipos)
|
java.lang.Object |
getNextTypeObject(int ipos)
|
java.lang.Object |
getPosNext(int ipos)
Get the element following the specified position. |
int |
getPosNextInt(int ipos)
Return following value (like getPosNext), as an integer. |
java.lang.Object |
getPosPrevious(int ipos)
Get the element before the specified position. |
int |
gotoAttributesStart(int index)
|
boolean |
gotoAttributesStart(TreePosition pos)
|
int |
gotoChildrenStart(int index)
|
int |
hashCode()
|
boolean |
hasNext(int ipos)
|
boolean |
ignoring()
True if consumer is ignoring rest of group. |
boolean |
isEmpty()
|
int |
nextDataIndex(int pos)
|
int |
nextMatching(int startPos,
ElementPredicate predicate,
int endPos,
boolean descend)
Get next matching child or descendent (ignoring attributes). |
int |
nextNodeIndex(int pos,
int limit)
Skip all primitive content nodes. |
int |
nextPos(int position)
Return the next position following the argument. |
int |
parentPos(int ipos)
Get position of parent. |
int |
posToDataIndex(int ipos)
|
void |
resizeObjects()
|
void |
setIntN(int index,
int i)
|
int |
size()
See java.util.List. |
void |
statistics()
|
void |
statistics(java.io.PrintWriter out)
|
int |
stringValue(boolean inGroup,
int index,
java.lang.StringBuffer sbuf)
|
int |
stringValue(int index,
java.lang.StringBuffer sbuf)
|
void |
toString(java.lang.String sep,
java.lang.StringBuffer sbuf)
|
void |
write(char[] buf,
int off,
int len)
|
void |
writeBaseUri(java.lang.Object uri)
Write/set the base-uri property of the current element or document. |
void |
writeBoolean(boolean v)
|
void |
writeByte(int v)
|
void |
writeCDATA(char[] chars,
int offset,
int length)
|
void |
writeChar(int i)
|
void |
writeChars(java.lang.String str)
|
void |
writeComment(char[] chars,
int offset,
int length)
|
void |
writeDouble(double v)
|
void |
writeFloat(float v)
|
void |
writeInt(int v)
|
void |
writeLong(long v)
|
void |
writeObject(java.lang.Object v)
|
void |
writePosition(AbstractSequence seq,
int ipos)
Consume a single position pair. |
void |
writeProcessingInstruction(java.lang.String target,
char[] content,
int offset,
int length)
|
Methods inherited from class gnu.lists.AbstractSequence |
---|
add, add, addAll, addAll, addPos, compare, compare, contains, containsAll, copyPos, elements, endPos, equals, equals, fill, fill, fillPosRange, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIterator, getIterator, getIteratorAtPos, getLowBound, getSize, gotoChildrenStart, gotoParent, hasPrevious, indexOf, isAfterPos, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.Object[] objects
public int oindex
public char[] data
public int gapStart
public int gapEnd
public int attrStart
public int docStart
protected static final char POSITION_PAIR_FOLLOWS
public static final int INT_FOLLOWS
protected static final int PROCESSING_INSTRUCTION
protected static final int BEGIN_ATTRIBUTE_LONG
protected static final int BEGIN_DOCUMENT
protected static final int END_DOCUMENT
protected static final int END_GROUP_SHORT
protected static final int END_GROUP_LONG
Constructor Detail |
---|
public TreeList()
public TreeList(TreeList list, int startPosition, int endPosition)
list
- the TreeList to copystartPosition
- start of range, as a raw index in dataendPosition
- end of range, as a raw index in datapublic TreeList(TreeList list)
Method Detail |
---|
public void clear()
clear
in class AbstractSequence
public void ensureSpace(int needed)
public final void resizeObjects()
public int find(java.lang.Object arg1)
public int find(java.lang.Object arg1, java.lang.Object arg2)
protected final int getIntN(int index)
protected final long getLongN(int index)
public final void setIntN(int index, int i)
public void consume(SeqPosition position)
PositionConsumer
consume
in interface PositionConsumer
public void writePosition(AbstractSequence seq, int ipos)
PositionConsumer
writePosition
in interface PositionConsumer
public void writeObject(java.lang.Object v)
writeObject
in interface Consumer
public void writeBaseUri(java.lang.Object uri)
writeBaseUri
in interface XConsumer
public void writeComment(char[] chars, int offset, int length)
writeComment
in interface XConsumer
public void writeProcessingInstruction(java.lang.String target, char[] content, int offset, int length)
writeProcessingInstruction
in interface XConsumer
public void beginGroup(java.lang.String typeName, java.lang.Object type)
beginGroup
in interface Consumer
public void beginDocument()
beginDocument
in interface Consumer
public void endDocument()
endDocument
in interface Consumer
public void beginGroup(int index)
public void endGroup(java.lang.String typeName)
endGroup
in interface Consumer
public void beginAttribute(java.lang.String attrName, java.lang.Object attrType)
Consumer
beginAttribute
in interface Consumer
public void beginAttribute(int index)
public void endAttribute()
endAttribute
in interface Consumer
public void writeChar(int i)
writeChar
in interface Consumer
public void writeBoolean(boolean v)
writeBoolean
in interface Consumer
public void writeByte(int v)
public void writeInt(int v)
writeInt
in interface Consumer
public void writeLong(long v)
writeLong
in interface Consumer
public void writeFloat(float v)
writeFloat
in interface Consumer
public void writeDouble(double v)
writeDouble
in interface Consumer
public boolean ignoring()
Consumer
ignoring
in interface Consumer
public void writeChars(java.lang.String str)
writeChars
in interface Consumer
public void write(char[] buf, int off, int len)
write
in interface Consumer
public void writeCDATA(char[] chars, int offset, int length)
writeCDATA
in interface XConsumer
public TreeList append(char c)
append
in interface Consumer
append
in interface java.lang.Appendable
append
in class AbstractSequence
public TreeList append(java.lang.CharSequence csq)
append
in interface Consumer
append
in interface java.lang.Appendable
append
in class AbstractSequence
public TreeList append(java.lang.CharSequence csq, int start, int end)
append
in interface Consumer
append
in interface java.lang.Appendable
append
in class AbstractSequence
public boolean isEmpty()
isEmpty
in class AbstractSequence
public int size()
AbstractSequence
size
in class AbstractSequence
public int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertypublic final int posToDataIndex(int ipos)
public int firstChildPos(int ipos)
AbstractSequence
firstChildPos
in class AbstractSequence
ipos
- parent position. It is not released by this method.
public final int gotoChildrenStart(int index)
public int parentPos(int ipos)
AbstractSequence
parentPos
in class AbstractSequence
ipos
- child position. It is not released by this method.
public boolean gotoAttributesStart(TreePosition pos)
gotoAttributesStart
in class AbstractSequence
public int firstAttributePos(int ipos)
AbstractSequence
firstAttributePos
in class AbstractSequence
public int gotoAttributesStart(int index)
public java.lang.Object get(int index)
AbstractSequence
get
in class AbstractSequence
public boolean consumeNext(int ipos, Consumer out)
AbstractSequence
consumeNext
in class AbstractSequence
public void consumePosRange(int startPos, int endPos, Consumer out)
consumePosRange
in class AbstractSequence
public int consumeIRange(int startPosition, int endPosition, Consumer out)
public void toString(java.lang.String sep, java.lang.StringBuffer sbuf)
toString
in class AbstractSequence
public boolean hasNext(int ipos)
hasNext
in class AbstractSequence
public int getNextKind(int ipos)
getNextKind
in class AbstractSequence
protected int getNextTypeIndex(int ipos)
public java.lang.String getNextTypeName(int ipos)
getNextTypeName
in class AbstractSequence
public java.lang.Object getNextTypeObject(int ipos)
getNextTypeObject
in class AbstractSequence
public java.lang.Object getPosPrevious(int ipos)
AbstractSequence
getPosPrevious
in class AbstractSequence
ipos
- the specified position.
public int getPosNextInt(int ipos)
public java.lang.Object getPosNext(int ipos)
AbstractSequence
getPosNext
in class AbstractSequence
ipos
- the specified position.
public int stringValue(int index, java.lang.StringBuffer sbuf)
public int stringValue(boolean inGroup, int index, java.lang.StringBuffer sbuf)
public int createRelativePos(int istart, int offset, boolean isAfter)
createRelativePos
in class AbstractSequence
public final int nextNodeIndex(int pos, int limit)
public int nextMatching(int startPos, ElementPredicate predicate, int endPos, boolean descend)
AbstractSequence
nextMatching
in class AbstractSequence
startPos
- starting positionpredicate
- a test (predicate) to apply to selected elementsendPos
- stop before endPosdescend
- if true do depth-first traversal.
public int nextPos(int position)
AbstractSequence
nextPos
in class AbstractSequence
public final int nextDataIndex(int pos)
public java.lang.Object baseUriOfPos(int pos)
AbstractSequence
baseUriOfPos
in class AbstractSequence
public int compare(int ipos1, int ipos2)
compare
in class AbstractSequence
protected int getIndexDifference(int ipos1, int ipos0)
AbstractSequence
getIndexDifference
in class AbstractSequence
public int hashCode()
hashCode
in class AbstractSequence
public void consume(Consumer out)
consume
in interface Consumable
consume
in class AbstractSequence
public void statistics()
public void statistics(java.io.PrintWriter out)
public void dump()
public void dump(java.io.PrintWriter out)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |