Package com.globalmentor.collections
Class CharSequenceSuffixTree.CharSequenceNode
java.lang.Object
AbstractSuffixTree<CharSequenceSuffixTree.CharSequenceEdge>.AbstractNode
com.globalmentor.collections.CharSequenceSuffixTree.CharSequenceNode
- All Implemented Interfaces:
SuffixTree.Node
- Enclosing class:
- CharSequenceSuffixTree
protected class CharSequenceSuffixTree.CharSequenceNode
extends AbstractSuffixTree<CharSequenceSuffixTree.CharSequenceEdge>.AbstractNode
Represents an edge between a parent node and a child node in a suffix tree.
- Author:
- Garret Wilson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEdge
(char firstChar) Retrieves the edge that extends from this and starts with the given character.boolean
startsWith
(CharSequence charSequence) Compares a character sequence with the characters starting at this node and continuing along child edges.boolean
startsWith
(CharSequence charSequence, int start, int end) Compares part of a character sequence with the characters starting at this node and continuing along child edges.Methods inherited from class com.globalmentor.collections.AbstractSuffixTree.AbstractNode
equals, getIndex, hashCode, isLeaf, setLeaf, setParentNode, setSuffixNode, toString
-
Constructor Details
-
CharSequenceNode
public CharSequenceNode(int index) Index constructor.- Parameters:
index
- The index of the node.
-
-
Method Details
-
getParentNode
- Specified by:
getParentNode
in interfaceSuffixTree.Node
- Overrides:
getParentNode
in classAbstractSuffixTree<CharSequenceSuffixTree.CharSequenceEdge>.AbstractNode
- Returns:
- The parent node of this node, or
null
if this node has no parent node (i.e. it is the root node).
-
getSuffixNode
- Specified by:
getSuffixNode
in interfaceSuffixTree.Node
- Overrides:
getSuffixNode
in classAbstractSuffixTree<CharSequenceSuffixTree.CharSequenceEdge>.AbstractNode
- Returns:
- The node representing the next smaller suffix, or
null
if there is no known smaller suffix node.
-
getChildEdges
- Returns:
- An iterable to the child edges of this node.
-
getEdge
Retrieves the edge that extends from this and starts with the given character.- Parameters:
firstChar
- The first character along the edge.- Returns:
- The edge extending from the node starting with the given character, or
null
if the node has no such edge.
-
startsWith
Compares a character sequence with the characters starting at this node and continuing along child edges.- Parameters:
charSequence
- The character sequence to compare.- Returns:
true
if there is a path matching the given character sequence starting at this node and continuing along child edges.- See Also:
-
startsWith
Compares part of a character sequence with the characters starting at this node and continuing along child edges.- Parameters:
charSequence
- The character sequence to compare.start
- The start of the character sequence to compare, inclusive.end
- The end of the character sequence to compare, exclusive.- Returns:
true
if there is a path matching the given character sequence starting at this node and continuing along child edges.- Throws:
StringIndexOutOfBoundsException
- ifstart
orend
are negative or greater thanlength()
, orstart
is greater thanend
.- See Also:
-