public class SuffixTrie<I> extends Object implements Graph<SuffixTrieNode<I>,SuffixTrieNode<I>>
SimpleGraph.NormalGraphView<N,G extends SimpleGraph<N>>
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_GRAPH_REPRESENTABLE |
protected @Nullable 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.
|
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.
|
VisualizationHelper<SuffixTrieNode<I>,SuffixTrieNode<I>> |
getVisualizationHelper() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asNormalGraph
adjacentTargetsIterator, adjacentTargetsStream, getAdjacentTargets, getEdgesBetween, outgoingEdges, outgoingEdgesIterator, outgoingEdgesStream
iterator, nodeIDs, nodesStream, size
adjacentTargets, createDynamicNodeMapping, createStaticNodeMapping, isConnected
forEach, spliterator
public static final boolean DEFAULT_GRAPH_REPRESENTABLE
protected final SuffixTrieNode<I> root
protected final @Nullable List<SuffixTrieNode<I>> nodes
public SuffixTrie()
public SuffixTrie(boolean graphRepresentable)
graphRepresentable
- whether the trie should be graph representable.protected SuffixTrie(boolean graphRepresentable, SuffixTrieNode<I> root)
graphRepresentable
- whether the trie should be graph representable.root
- the root node.protected SuffixTrie(SuffixTrieNode<I> root)
root
- the root node.public Collection<SuffixTrieNode<I>> getNodes()
SimpleGraph
getNodes
in interface SimpleGraph<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 VisualizationHelper<SuffixTrieNode<I>,SuffixTrieNode<I>> getVisualizationHelper()
getVisualizationHelper
in interface Graph<SuffixTrieNode<I>,SuffixTrieNode<I>>
getVisualizationHelper
in interface SimpleGraph<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 © 2020. All rights reserved.