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>
protected abstract class AbstractSuffixTree.AbstractNode extends java.lang.Object implements SuffixTree.Node
Represents a node in a suffix tree. Each node defaults to having no suffix node.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description AbstractNode(int index)
Index constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
This version compares node indexes.int
getIndex()
SuffixTree.Node
getParentNode()
SuffixTree.Node
getSuffixNode()
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.java.lang.String
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
-
-
-
-
Method Detail
-
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
public SuffixTree.Node 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
protected void setParentNode(SuffixTree.Node parentNode)
Sets the node indicating this node's parent.- Parameters:
parentNode
- The node representing the parent of this node.- Throws:
java.lang.NullPointerException
- if the given node isnull
.
-
getSuffixNode
public SuffixTree.Node 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
protected void setSuffixNode(SuffixTree.Node suffixNode)
Sets the node representing the next smaller suffix.- Parameters:
suffixNode
- The node representing the next smaller suffix.- Throws:
java.lang.NullPointerException
- if the given node isnull
.
-
hashCode
public int hashCode()
This version returns the node index.- Overrides:
hashCode
in classjava.lang.Object
- See Also:
getIndex()
-
equals
public boolean equals(java.lang.Object object)
This version compares node indexes.- Overrides:
equals
in classjava.lang.Object
- See Also:
getIndex()
-
toString
public java.lang.String toString()
This implementation returns a string in the form(index)*
, where '*' indicates a leaf node.- Overrides:
toString
in classjava.lang.Object
-
-