Package gnu.kawa.xml

Class Nodes

All Implemented Interfaces:
Consumable, Consumer, PositionConsumer, Externalizable, Serializable, Appendable, Consumer<Object>, DoubleConsumer, IntConsumer, LongConsumer, NodeList
Direct Known Subclasses:
SortedNodes

public class Nodes extends Values.FromList<SeqPosition> implements PositionConsumer, NodeList, Consumer
Manages a sequence of node references.
See Also:
  • Field Details

  • Constructor Details

    • Nodes

      public Nodes()
  • Method Details

    • append

      public Consumer append(char c)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface Consumer
    • append

      public Consumer append(CharSequence csq)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface Consumer
    • ignoring

      public boolean ignoring()
      Description copied from interface: Consumer
      True if consumer is ignoring rest of element. The producer can use this information to skip ahead.
      Specified by:
      ignoring in interface Consumer
    • 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
    • writePosition

      public void writePosition(SeqPosition position)
      Description copied from interface: PositionConsumer
      Consume node at current position. The caller may invalidate or change the position after consume returns, so if the consumer wants to save it, it needs to copy it.
      Specified by:
      writePosition in interface PositionConsumer
    • writeObject

      public void writeObject(Object v)
      Specified by:
      writeObject in interface Consumer
    • writeFloat

      public void writeFloat(float v)
      Specified by:
      writeFloat in interface Consumer
    • writeDouble

      public void writeDouble(double v)
      Specified by:
      writeDouble in interface Consumer
    • writeLong

      public void writeLong(long v)
      Specified by:
      writeLong in interface Consumer
    • writeInt

      public void writeInt(int v)
      Specified by:
      writeInt in interface Consumer
    • writeBoolean

      public void writeBoolean(boolean v)
      Specified by:
      writeBoolean in interface Consumer
    • write

      public void write(int v)
      Specified by:
      write in interface Consumer
    • append

      public Consumer append(CharSequence csq, int start, int end)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface Consumer
    • write

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

      public void write(CharSequence str, int start, int length)
      Specified by:
      write in interface Consumer
    • write

      public void write(String str)
      Specified by:
      write in interface Consumer
    • startElement

      public void startElement(Object type)
      Specified by:
      startElement in interface Consumer
    • endElement

      public void endElement()
      Specified by:
      endElement in interface Consumer
    • startAttribute

      public void startAttribute(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
    • 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
    • writeComment

      public void writeComment(char[] chars, int offset, int length)
    • writeCDATA

      public void writeCDATA(char[] chars, int offset, int length)
    • writeProcessingInstruction

      public void writeProcessingInstruction(String target, char[] content, int offset, int length)
    • startDocument

      public void startDocument()
      Specified by:
      startDocument in interface Consumer
    • endDocument

      public void endDocument()
      Specified by:
      endDocument in interface Consumer
    • beginEntity

      public void beginEntity(Object base)
    • endEntity

      public void endEntity()
    • getLength

      public int getLength()
      Specified by:
      getLength in interface NodeList
    • item

      public Node item(int index)
      Specified by:
      item in interface NodeList
    • 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.
    • consumePosRange

      public void consumePosRange(int iposStart, int iposEnd, Consumer out)
      Overrides:
      consumePosRange in class AbstractSequence<SeqPosition>
    • root

      public static KNode root(NodeTree seq, int ipos)