Package com.globalmentor.collections
Class CharSequenceSuffixTrees.AbstractCharSequenceVisitor
java.lang.Object
com.globalmentor.collections.CharSequenceSuffixTrees.AbstractCharSequenceVisitor
- All Implemented Interfaces:
SuffixTrees.Visitor<CharSequenceSuffixTree.CharSequenceNode,
CharSequenceSuffixTree.CharSequenceEdge>
- Enclosing class:
- CharSequenceSuffixTrees
public abstract static class CharSequenceSuffixTrees.AbstractCharSequenceVisitor
extends Object
implements SuffixTrees.Visitor<CharSequenceSuffixTree.CharSequenceNode,CharSequenceSuffixTree.CharSequenceEdge>
An abstract implementation of a visitor for character sequences. This implementation keeps track of the current sequence being visited for each node.
- Author:
- Garret Wilson
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor starting an empty sequence.AbstractCharSequenceVisitor
(CharSequence charSequence) Character sequence constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
visit
(SuffixTree suffixTree, CharSequenceSuffixTree.CharSequenceNode node, CharSequenceSuffixTree.CharSequenceEdge parentEdge, int length) Visits the given node.abstract boolean
visit
(SuffixTree suffixTree, CharSequenceSuffixTree.CharSequenceNode node, CharSequenceSuffixTree.CharSequenceEdge parentEdge, CharSequence charSequence) Visits the given node.
-
Constructor Details
-
AbstractCharSequenceVisitor
public AbstractCharSequenceVisitor()Default constructor starting an empty sequence. -
AbstractCharSequenceVisitor
Character sequence constructor. This constructor is useful for creating a visitor that will begin on a non-root node.- Parameters:
charSequence
- The initial character sequence.- Throws:
NullPointerException
- if the given character sequence isnull
.
-
-
Method Details
-
visit
public final boolean visit(SuffixTree suffixTree, CharSequenceSuffixTree.CharSequenceNode node, CharSequenceSuffixTree.CharSequenceEdge parentEdge, int length) Description copied from interface:SuffixTrees.Visitor
Visits the given node.- Specified by:
visit
in interfaceSuffixTrees.Visitor<CharSequenceSuffixTree.CharSequenceNode,
CharSequenceSuffixTree.CharSequenceEdge> - Parameters:
suffixTree
- The suffix tree being visited.node
- The node being visited.parentEdge
- The parent edge of the node being visited, ornull
if the node has no parent.length
- The length of elements up to the visited node, including the length of the parent edge.- Returns:
true
if visiting should continue to other nodes.
-
visit
public abstract boolean visit(SuffixTree suffixTree, CharSequenceSuffixTree.CharSequenceNode node, CharSequenceSuffixTree.CharSequenceEdge parentEdge, CharSequence charSequence) Visits the given node. The provided sequence will be modified on further visits; if it is desired that the sequence should be stored, a copy of it should first be made.- Parameters:
suffixTree
- The suffix tree being visited.node
- The node being visited.parentEdge
- The parent edge of the node being visited, ornull
if the node has no parent.charSequence
- The current sequence from the root to the node being visited.- Returns:
true
if visiting should continue to other nodes.
-