gnu.xml
Class NodeTree

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.lists.TreeList
          extended by gnu.xml.NodeTree
All Implemented Interfaces:
Consumable, Consumer, PositionConsumer, XConsumer, java.lang.Appendable

public class NodeTree
extends TreeList

Use to represent a Document or Document Fragment, in the XML DOM sense. More compact than traditional DOM, since it uses many fewer objects.


Field Summary
 
Fields inherited from class gnu.lists.TreeList
attrStart, BEGIN_ATTRIBUTE_LONG, BEGIN_DOCUMENT, data, docStart, END_DOCUMENT, END_GROUP_LONG, END_GROUP_SHORT, gapEnd, gapStart, INT_FOLLOWS, objects, oindex, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTION
 
Constructor Summary
NodeTree()
           
 
Method Summary
 int getId()
          Get/create a new unique number.
 SeqPosition getIteratorAtPos(int ipos)
           
static NodeTree make()
           
 int nextPos(int position)
          Return the next position following the argument.
 int posFirstChild(int ipos)
           
 boolean posHasAttributes(int ipos)
           
 boolean posIsDefaultNamespace(int ipos, java.lang.String namespaceURI)
           
 java.lang.String posLocalName(int ipos)
           
 java.lang.String posLookupNamespaceURI(int ipos, java.lang.String prefix)
           
 java.lang.String posLookupPrefix(int ipos, java.lang.String namespaceURI)
           
 java.lang.String posNamespaceURI(int ipos)
           
 java.lang.String posPrefix(int ipos)
           
 java.lang.String posTarget(int ipos)
          Get the target of a process-instruction.
 int stableCompare(AbstractSequence other)
          This is used for the XML concept of "document order".
 java.lang.String toString()
           
 java.lang.Object typedValue(int ipos)
          Return the type-value of the node at the specified position.
 void writeObject(java.lang.Object v)
          If v is a node, make a copy of it.
 void writePosition(AbstractSequence seq, int ipos)
          Consume a single position pair.
 
Methods inherited from class gnu.lists.TreeList
append, append, append, baseUriOfPos, beginAttribute, beginAttribute, beginDocument, beginGroup, beginGroup, clear, compare, consume, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, dump, dump, endAttribute, endDocument, endGroup, ensureSpace, find, find, firstAttributePos, firstChildPos, get, getIndexDifference, getIntN, getLongN, getNextKind, getNextTypeIndex, getNextTypeName, getNextTypeObject, getPosNext, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hashCode, hasNext, ignoring, isEmpty, nextDataIndex, nextMatching, nextNodeIndex, parentPos, posToDataIndex, resizeObjects, setIntN, size, statistics, statistics, stringValue, stringValue, toString, write, writeBaseUri, writeBoolean, writeByte, writeCDATA, writeChar, writeChars, writeComment, writeDouble, writeFloat, writeInt, writeLong, writeProcessingInstruction
 
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, 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, startPos, subList, subSequence, subSequencePos, toArray, toArray, unsupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeTree

public NodeTree()
Method Detail

writePosition

public void writePosition(AbstractSequence seq,
                          int ipos)
Description copied from interface: PositionConsumer
Consume a single position pair. This PositionConsumer may assume the sequence does no reference management; i.e. that copyPos is trivial and releasePos is a no-op. If that is not the case, use consume(TreePosition) instead.

Specified by:
writePosition in interface PositionConsumer
Overrides:
writePosition in class TreeList

writeObject

public void writeObject(java.lang.Object v)
If v is a node, make a copy of it.

Specified by:
writeObject in interface Consumer
Overrides:
writeObject in class TreeList

nextPos

public int nextPos(int position)
Description copied from class: AbstractSequence
Return the next position following the argument. The new position has the isAfter property. The argument is implicitly released (as in releasePos). Returns 0 if we are already at end of file.

Overrides:
nextPos in class TreeList

make

public static NodeTree make()

getId

public int getId()
Get/create a new unique number.


stableCompare

public int stableCompare(AbstractSequence other)
Description copied from class: AbstractSequence
This is used for the XML concept of "document order".

Overrides:
stableCompare in class AbstractSequence

getIteratorAtPos

public SeqPosition getIteratorAtPos(int ipos)
Overrides:
getIteratorAtPos in class AbstractSequence

posNamespaceURI

public java.lang.String posNamespaceURI(int ipos)

posPrefix

public java.lang.String posPrefix(int ipos)

posLocalName

public java.lang.String posLocalName(int ipos)

posIsDefaultNamespace

public boolean posIsDefaultNamespace(int ipos,
                                     java.lang.String namespaceURI)

posLookupNamespaceURI

public java.lang.String posLookupNamespaceURI(int ipos,
                                              java.lang.String prefix)

posLookupPrefix

public java.lang.String posLookupPrefix(int ipos,
                                        java.lang.String namespaceURI)

posFirstChild

public int posFirstChild(int ipos)

posHasAttributes

public boolean posHasAttributes(int ipos)

typedValue

public java.lang.Object typedValue(int ipos)
Return the type-value of the node at the specified position.


posTarget

public java.lang.String posTarget(int ipos)
Get the target of a process-instruction.


toString

public java.lang.String toString()
Overrides:
toString in class AbstractSequence