Package com.globalmentor.collections
Class AbstractSuffixTree.AbstractNode
java.lang.Object
com.globalmentor.collections.AbstractSuffixTree.AbstractNode
- All Implemented Interfaces:
SuffixTree.Node
- Direct Known Subclasses:
CharSequenceSuffixTree.CharSequenceNode
- Enclosing class:
- AbstractSuffixTree<E extends SuffixTree.Edge>
Represents a node in a suffix tree. Each node defaults to having no suffix node.
- Author:
- Garret Wilson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This version compares node indexes.int
getIndex()
int
hashCode()
This version returns the node index.boolean
isLeaf()
protected void
setLeaf
(boolean leaf) Sets whether this node is a leaf.protected void
setParentNode
(SuffixTree.Node parentNode) Sets the node indicating this node's parent.protected void
setSuffixNode
(SuffixTree.Node suffixNode) Sets the node representing the next smaller suffix.toString()
This implementation returns a string in the form(index)*
, where '*' indicates a leaf node.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.globalmentor.collections.SuffixTree.Node
getChildEdges
-
Constructor Details
-
AbstractNode
public AbstractNode(int index) Index constructor. The node defaults to being a leaf node.- Parameters:
index
- The index of the node.
-
-
Method Details
-
getIndex
public int getIndex()- Specified by:
getIndex
in interfaceSuffixTree.Node
- Returns:
- The index of the node.
-
isLeaf
public boolean isLeaf()- Specified by:
isLeaf
in interfaceSuffixTree.Node
- Returns:
- Whether this node is a leaf node in the suffix tree.
-
setLeaf
protected void setLeaf(boolean leaf) Sets whether this node is a leaf.- Parameters:
leaf
- Whether this node is a leaf.
-
getParentNode
- Specified by:
getParentNode
in interfaceSuffixTree.Node
- Returns:
- The parent node of this node, or
null
if this node has no parent node (i.e. it is the root node).
-
setParentNode
Sets the node indicating this node's parent.- Parameters:
parentNode
- The node representing the parent of this node.- Throws:
NullPointerException
- if the given node isnull
.
-
getSuffixNode
- Specified by:
getSuffixNode
in interfaceSuffixTree.Node
- Returns:
- The node representing the next smaller suffix, or
null
if there is no known smaller suffix node.
-
setSuffixNode
Sets the node representing the next smaller suffix.- Parameters:
suffixNode
- The node representing the next smaller suffix.- Throws:
NullPointerException
- if the given node isnull
.
-
hashCode
public int hashCode()This version returns the node index. -
equals
This version compares node indexes. -
toString
This implementation returns a string in the form(index)*
, where '*' indicates a leaf node.
-