Class TextContainer

java.lang.Object
com.pervasive.datarush.analytics.text.TextElement
com.pervasive.datarush.analytics.text.TextContainer
All Implemented Interfaces:
TextNode
Direct Known Subclasses:
TokenizedParagraph, TokenizedSentence, TokenizedText, TokenizedWord

public abstract class TextContainer extends TextElement implements TextNode
A tree node that can hold information on text elements.
  • Field Details

  • Constructor Details

    • TextContainer

      protected TextContainer()
      Default constructor for empty text container.
    • TextContainer

      protected TextContainer(TextElementType type, List<? extends TextContainer> children)
      Construct a container of element type with the specified children.
      Parameters:
      type - the type of this text element
      children - the children of this container
    • TextContainer

      protected TextContainer(TextElementType type, String value)
      Construct a container of element type with a specific value.
      Parameters:
      type - the type of this text element
      value - the text value of this container
  • Method Details

    • getChildCount

      public int getChildCount()
      Description copied from interface: TextNode
      Get the number of direct children of this node.
      Specified by:
      getChildCount in interface TextNode
      Returns:
      the child count of this node
    • getParent

      public TextNode getParent()
      Description copied from interface: TextNode
      Get the parent node of this node or null if this node is the root.
      Specified by:
      getParent in interface TextNode
      Returns:
      the parent node of this node
    • getPrevSibling

      public TextNode getPrevSibling()
      Description copied from interface: TextNode
      Get the left sibling of this node or null if this node has no left sibling.
      Specified by:
      getPrevSibling in interface TextNode
      Returns:
      the previous sibling node of this node
    • getNextSibling

      public TextNode getNextSibling()
      Description copied from interface: TextNode
      Get the right sibling of this node or null if this node has no right sibling.
      Specified by:
      getNextSibling in interface TextNode
      Returns:
      the next sibling node of this node
    • getChildren

      public List<TextContainer> getChildren()
      Description copied from interface: TextNode
      Get the ordered list of direct children of this node.
      Specified by:
      getChildren in interface TextNode
      Returns:
      a list of the child nodes
    • getIterator

      public ListIterator<TextContainer> getIterator()
      Description copied from interface: TextNode
      Get an iterator over all descendants of this node including this node.
      Specified by:
      getIterator in interface TextNode
      Returns:
      a list iterator over the node and all descendants
    • getIterator

      public ListIterator<TextContainer> getIterator(TextElementType type)
      Description copied from interface: TextNode
      Get an iterator over the node and all descendants of this node of the specified type.
      Specified by:
      getIterator in interface TextNode
      Parameters:
      type - the type of nodes to iterate over
      Returns:
      a list iterator over the selected nodes
    • getPostIterator

      public ListIterator<TextContainer> getPostIterator()
    • getPostIterator

      public ListIterator<TextContainer> getPostIterator(TextElementType type)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TextElement
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class TextElement
    • getEncoder

      public static TokenEncoder getEncoder()
    • getDecoder

      public static TokenDecoder getDecoder()