gnu.kawa.xml
Class Nodes

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.lists.TreeList
          extended by gnu.mapping.Values
              extended by gnu.kawa.xml.Nodes
All Implemented Interfaces:
Consumable, Consumer, PositionConsumer, XConsumer, Printable, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
SortedNodes

public class Nodes
extends Values

Manages a sequence of node references.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.mapping.Values
empty, noArgs
 
Fields inherited from class gnu.lists.TreeList
attrStart, BEGIN_ATTRIBUTE_LONG, BEGIN_ATTRIBUTE_LONG_SIZE, BEGIN_DOCUMENT, BEGIN_ELEMENT_LONG, BEGIN_ELEMENT_SHORT, BEGIN_ELEMENT_SHORT_INDEX_MAX, BEGIN_ENTITY, BEGIN_ENTITY_SIZE, data, docStart, DOCUMENT_URI, END_ATTRIBUTE_SIZE, END_DOCUMENT, END_ELEMENT_LONG, END_ELEMENT_SHORT, END_ENTITY, gapEnd, gapStart, INT_FOLLOWS, MAX_CHAR_SHORT, objects, oindex, POSITION_PAIR_FOLLOWS, PROCESSING_INSTRUCTION
 
Constructor Summary
Nodes()
           
 
Method Summary
 Consumer append(java.lang.CharSequence csq, int start, int end)
           
 void beginEntity(java.lang.Object base)
           
 void endAttribute()
          End of an attribute or end of an actual parameter.
 void endDocument()
           
 void endElement()
           
 void endEntity()
           
 int find(java.lang.Object seq)
           
 java.lang.Object get(int index)
          See java.util.List.
 int getLength()
           
 int getPos(int index)
          Optimization of ((SeqPosition) get(index)).
 java.lang.Object getPosNext(int ipos)
          Get the element following the specified position.
 AbstractSequence getSeq(int index)
          Optimization of ((SeqPosition) get(index)).sequence.
static KNode root(NodeTree seq, int ipos)
           
 int size()
          See java.util.List.
 void startAttribute(java.lang.Object attrType)
          Write a attribute for the current element.
 void startDocument()
           
 void startElement(java.lang.Object type)
           
 void write(char[] buf, int off, int len)
           
 void write(java.lang.CharSequence str, int start, int length)
           
 void write(int v)
           
 void write(java.lang.String str)
           
 void writeBoolean(boolean v)
           
 void writeCDATA(char[] chars, int offset, int length)
           
 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.mapping.Values
call_with, canonicalize, countValues, getValues, make, make, make, make, make, nextIndex, nextValue, print, readExternal, readResolve, values$V, writeExternal, writeValues
 
Methods inherited from class gnu.lists.TreeList
append, append, clear, compare, consume, consume, consumeIRange, consumeNext, consumePosRange, createPos, createRelativePos, documentUriOfPos, dump, dump, dump, ensureSpace, firstAttributePos, firstChildPos, getAttributeCount, getIndexDifference, getIntN, getLongN, getNextKind, getNextKindI, getNextTypeName, getNextTypeObject, getPosNextInt, getPosPrevious, gotoAttributesStart, gotoAttributesStart, gotoChildrenStart, hashCode, hasNext, ignoring, isEmpty, nextDataIndex, nextMatching, nextNodeIndex, nextPos, parentOrEntityI, parentOrEntityPos, parentPos, posToDataIndex, resizeObjects, setAttributeName, setElementName, setIntN, startAttribute, startElement, statistics, statistics, stringValue, stringValue, stringValue, toString, writeByte, writeDocumentUri, writeJoiner
 
Methods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, compare, compare, contains, containsAll, copyPos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstChildPos, 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, unsupportedException
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Nodes

public Nodes()
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

find

public int find(java.lang.Object seq)
Overrides:
find in class TreeList

writeObject

public void writeObject(java.lang.Object v)
Specified by:
writeObject in interface Consumer
Overrides:
writeObject in class TreeList

writeFloat

public void writeFloat(float v)
Specified by:
writeFloat in interface Consumer
Overrides:
writeFloat in class TreeList

writeDouble

public void writeDouble(double v)
Specified by:
writeDouble in interface Consumer
Overrides:
writeDouble in class TreeList

writeLong

public void writeLong(long v)
Specified by:
writeLong in interface Consumer
Overrides:
writeLong in class TreeList

writeInt

public void writeInt(int v)
Specified by:
writeInt in interface Consumer
Overrides:
writeInt in class TreeList

writeBoolean

public void writeBoolean(boolean v)
Specified by:
writeBoolean in interface Consumer
Overrides:
writeBoolean in class TreeList

write

public void write(int v)
Specified by:
write in interface Consumer
Overrides:
write in class TreeList

append

public Consumer append(java.lang.CharSequence csq,
                       int start,
                       int end)
Overrides:
append in class TreeList

write

public void write(char[] buf,
                  int off,
                  int len)
Specified by:
write in interface Consumer
Overrides:
write in class TreeList

write

public void write(java.lang.CharSequence str,
                  int start,
                  int length)
Specified by:
write in interface Consumer
Overrides:
write in class TreeList

write

public void write(java.lang.String str)
Specified by:
write in interface Consumer
Overrides:
write in class TreeList

startElement

public void startElement(java.lang.Object type)
Specified by:
startElement in interface Consumer
Overrides:
startElement in class TreeList

endElement

public void endElement()
Specified by:
endElement in interface Consumer
Overrides:
endElement in class TreeList

startAttribute

public void startAttribute(java.lang.Object attrType)
Description copied from interface: Consumer
Write a attribute for the current element. This is only allowed immediately after a startElement.

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

endAttribute

public void endAttribute()
Description copied from interface: Consumer
End of an attribute or end of an actual parameter. The former use matches a startAttribute; the latter may not, and can be used to separate parameters in a parameter list. This double duty suggsts the method should at least be re-named.

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

writeComment

public void writeComment(char[] chars,
                         int offset,
                         int length)
Specified by:
writeComment in interface XConsumer
Overrides:
writeComment in class TreeList

writeCDATA

public void writeCDATA(char[] chars,
                       int offset,
                       int length)
Specified by:
writeCDATA in interface XConsumer
Overrides:
writeCDATA in class TreeList

writeProcessingInstruction

public void writeProcessingInstruction(java.lang.String target,
                                       char[] content,
                                       int offset,
                                       int length)
Specified by:
writeProcessingInstruction in interface XConsumer
Overrides:
writeProcessingInstruction in class TreeList

startDocument

public void startDocument()
Specified by:
startDocument in interface Consumer
Overrides:
startDocument in class TreeList

endDocument

public void endDocument()
Specified by:
endDocument in interface Consumer
Overrides:
endDocument in class TreeList

beginEntity

public void beginEntity(java.lang.Object base)
Specified by:
beginEntity in interface XConsumer
Overrides:
beginEntity in class TreeList

endEntity

public void endEntity()
Specified by:
endEntity in interface XConsumer
Overrides:
endEntity in class TreeList

size

public int size()
Description copied from class: AbstractSequence
See java.util.List.

Overrides:
size in class TreeList

getLength

public int getLength()

get

public java.lang.Object get(int index)
Description copied from class: AbstractSequence
See java.util.List.

Overrides:
get in class TreeList

getPosNext

public java.lang.Object getPosNext(int ipos)
Description copied from class: AbstractSequence
Get the element following the specified position.

Overrides:
getPosNext in class TreeList
Parameters:
ipos - the specified position.
Returns:
the following element, or eofValue if there is none. Called by SeqPosition.getNext.

getSeq

public AbstractSequence getSeq(int index)
Optimization of ((SeqPosition) get(index)).sequence. However returns null instead of throwing IndexOutOfBoundsException if index >= count.


getPos

public int getPos(int index)
Optimization of ((SeqPosition) get(index)). ipos.


root

public static KNode root(NodeTree seq,
                         int ipos)