public class SuffixTrie<I> extends Object implements Graph<SuffixTrieNode<I>,SuffixTrieNode<I>>
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_GRAPH_REPRESENTABLE |
protected List<SuffixTrieNode<I>> |
nodes |
protected SuffixTrieNode<I> |
root |
Modifier | Constructor and Description |
---|---|
|
SuffixTrie()
Constructor.
|
|
SuffixTrie(boolean graphRepresentable)
Constructor.
|
protected |
SuffixTrie(boolean graphRepresentable,
SuffixTrieNode<I> root)
Internal constructor.
|
protected |
SuffixTrie(SuffixTrieNode<I> root)
Internal constructor.
|
Modifier and Type | Method and Description |
---|---|
SuffixTrieNode<I> |
add(I symbol,
SuffixTrieNode<I> parent)
Adds a word to the trie.
|
GraphDOTHelper<SuffixTrieNode<I>,SuffixTrieNode<I>> |
getGraphDOTHelper() |
Collection<SuffixTrieNode<I>> |
getNodes()
Retrieves an (unmodifiable) collection of the nodes in this graph.
|
Collection<SuffixTrieNode<I>> |
getOutgoingEdges(SuffixTrieNode<I> node)
Retrieves the outgoing edges of a given node.
|
SuffixTrieNode<I> |
getRoot()
Returns the root of this trie.
|
SuffixTrieNode<I> |
getTarget(SuffixTrieNode<I> edge)
Retrieves, for a given edge, its target node.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDynamicNodeMapping, createStaticNodeMapping
forEach, spliterator
public static final boolean DEFAULT_GRAPH_REPRESENTABLE
protected final SuffixTrieNode<I> root
protected final List<SuffixTrieNode<I>> nodes
public SuffixTrie()
public SuffixTrie(boolean graphRepresentable)
graphRepresentable
- whether the trie should be graph representable.protected SuffixTrie(SuffixTrieNode<I> root)
root
- the root node.protected SuffixTrie(boolean graphRepresentable, SuffixTrieNode<I> root)
graphRepresentable
- whether the trie should be graph representable.root
- the root node.public Collection<SuffixTrieNode<I>> getNodes()
Graph
getNodes
in interface Graph<SuffixTrieNode<I>,SuffixTrieNode<I>>
public Collection<SuffixTrieNode<I>> getOutgoingEdges(SuffixTrieNode<I> node)
IndefiniteGraph
getOutgoingEdges
in interface IndefiniteGraph<SuffixTrieNode<I>,SuffixTrieNode<I>>
node
- the node.Collection
of all outgoing edges, or null
if
the node has no outgoing edges.public SuffixTrieNode<I> getTarget(SuffixTrieNode<I> edge)
IndefiniteGraph
getTarget
in interface IndefiniteGraph<SuffixTrieNode<I>,SuffixTrieNode<I>>
edge
- the edge.public GraphDOTHelper<SuffixTrieNode<I>,SuffixTrieNode<I>> getGraphDOTHelper()
getGraphDOTHelper
in interface Graph<SuffixTrieNode<I>,SuffixTrieNode<I>>
public SuffixTrieNode<I> add(I symbol, SuffixTrieNode<I> parent)
symbol
- the first symbol of the word.parent
- the remaining suffix of the word.public SuffixTrieNode<I> getRoot()
Copyright © 2015. All rights reserved.