Package com.globalmentor.collections
Class CharSequenceSuffixTree.CharSequenceNode
- java.lang.Object
-
- com.globalmentor.collections.AbstractSuffixTree.AbstractNode
-
- com.globalmentor.collections.CharSequenceSuffixTree.CharSequenceNode
-
- All Implemented Interfaces:
SuffixTree.Node
- Enclosing class:
- CharSequenceSuffixTree
protected class CharSequenceSuffixTree.CharSequenceNode extends AbstractSuffixTree.AbstractNode
Represents an edge between a parent node and a child node in a suffix tree.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description CharSequenceNode(int index)
Index constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<CharSequenceSuffixTree.CharSequenceEdge>
getChildEdges()
CharSequenceSuffixTree.CharSequenceEdge
getEdge(char firstChar)
Retrieves the edge that extends from this and starts with the given character.CharSequenceSuffixTree.CharSequenceNode
getParentNode()
CharSequenceSuffixTree.CharSequenceNode
getSuffixNode()
boolean
startsWith(java.lang.CharSequence charSequence)
Compares a character sequence with the characters starting at this node and continuing along child edges.boolean
startsWith(java.lang.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
-
-
-
-
Method Detail
-
getParentNode
public CharSequenceSuffixTree.CharSequenceNode getParentNode()
- Specified by:
getParentNode
in interfaceSuffixTree.Node
- Overrides:
getParentNode
in classAbstractSuffixTree.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
public CharSequenceSuffixTree.CharSequenceNode getSuffixNode()
- Specified by:
getSuffixNode
in interfaceSuffixTree.Node
- Overrides:
getSuffixNode
in classAbstractSuffixTree.AbstractNode
- Returns:
- The node representing the next smaller suffix, or
null
if there is no known smaller suffix node.
-
getChildEdges
public java.lang.Iterable<CharSequenceSuffixTree.CharSequenceEdge> getChildEdges()
- Returns:
- An iterable to the child edges of this node.
-
getEdge
public CharSequenceSuffixTree.CharSequenceEdge getEdge(char firstChar)
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
public boolean startsWith(java.lang.CharSequence charSequence)
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:
CharSequenceSuffixTree.CharSequenceEdge.startsWith(CharSequence)
-
startsWith
public boolean startsWith(java.lang.CharSequence charSequence, int start, int end)
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:
java.lang.StringIndexOutOfBoundsException
- ifstart
orend
are negative or greater thanlength()
, orstart
is greater thanend
.- See Also:
CharSequenceSuffixTree.CharSequenceEdge.startsWith(CharSequence, int, int)
-
-