- 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 Summary
Fields Modifier and Type Field Description protected List<TextContainer>
children
protected TextContainer
nextSibling
protected TextContainer
parent
protected TextContainer
prevSibling
-
Constructor Summary
Constructors Modifier Constructor Description protected
TextContainer()
Default constructor for empty text container.protected
TextContainer(TextElementType type, String value)
Construct a container of element type with a specific value.protected
TextContainer(TextElementType type, List<? extends TextContainer> children)
Construct a container of element type with the specified children.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getChildCount()
Get the number of direct children of this node.List<TextContainer>
getChildren()
Get the ordered list of direct children of this node.static TokenDecoder
getDecoder()
static TokenEncoder
getEncoder()
ListIterator<TextContainer>
getIterator()
Get an iterator over all descendants of this node including this node.ListIterator<TextContainer>
getIterator(TextElementType type)
Get an iterator over the node and all descendants of this node of the specified type.TextNode
getNextSibling()
Get the right sibling of this node or null if this node has no right sibling.TextNode
getParent()
Get the parent node of this node or null if this node is the root.ListIterator<TextContainer>
getPostIterator()
ListIterator<TextContainer>
getPostIterator(TextElementType type)
TextNode
getPrevSibling()
Get the left sibling of this node or null if this node has no left sibling.int
hashCode()
String
toString()
-
Methods inherited from class com.pervasive.datarush.analytics.text.TextElement
getType, getValue
-
-
-
-
Field Detail
-
children
protected final List<TextContainer> children
-
parent
protected TextContainer parent
-
prevSibling
protected TextContainer prevSibling
-
nextSibling
protected TextContainer nextSibling
-
-
Constructor Detail
-
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 elementchildren
- 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 elementvalue
- the text value of this container
-
-
Method Detail
-
getChildCount
public int getChildCount()
Description copied from interface:TextNode
Get the number of direct children of this node.- Specified by:
getChildCount
in interfaceTextNode
- 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.
-
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 interfaceTextNode
- 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 interfaceTextNode
- 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 interfaceTextNode
- 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 interfaceTextNode
- 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 interfaceTextNode
- 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)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTextElement
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classTextElement
-
getEncoder
public static TokenEncoder getEncoder()
-
getDecoder
public static TokenDecoder getDecoder()
-
-