Package eu.bandm.tools.util
Class Trie<K extends Comparable<? super K>,V>
java.lang.Object
eu.bandm.tools.util.Trie<K,V>
Implementation of optimized prefix retrieval data structures.
The data is of form K* -> V.
The implementaiion follows the paradigm of
Rose trees.
The Trie data are immutable, all operations on them are executed by
a separate Trie.Evaluator
.
This must be equipped with a Monoid for V, to realizes the combination of data
when combining Tries.
Both key K and values V are non-optional: null is not allowed, because ".hashCode" is called on them. The contents of an instance of Trie are always prefixed closed, i.e. if there is a value for the key "a.b.c", then one can retrieve values fo "a" and "a.b". In many application contexts the inner leaves are mapped to the neutral element of V.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
Trie.Evaluator<K extends Comparable<? super K>,
V> Realizes alebraic operation on Tries.static class
Trie.Functor<K extends Comparable<? super K>>
static class
Trie.Node<K extends Comparable<? super K>,
V> Immutable data, each instance represents one cell (inner node or leaf) of the whole Trie. -
Method Summary
Modifier and TypeMethodDescriptionstatic <K extends Comparable<? super K>>
Function<Boolean,Trie<K, Boolean>> static <K extends Comparable<? super K>>
Trie<K,Boolean> empty()
Empty Set, when using Tries to represent "sets of K*", by V=Boolean.static <K extends Comparable<? super K>>
Trie<K,Boolean> epsilon()
Set containing the empty K-string, when using Tries to represent "sets of K*", by V=Boolean.boolean
evidentboolean
evidentint
hashCode()
evidentprotected static <A,
B> SortedEntryList<A, B> list()
Auxiliary factory method to construct an empty list of the given type.static void
protected static <A,
B> BisectionMap<A, B> map
(SortedEntryList<A, B> entries) FIXME ???static <K extends Comparable<? super K>,
V>
Trie<K,V> static <K extends Comparable<? super K>>
Trie<K,Boolean> singleton
(K key) Singlteon set containing a K-string with length=1, when using Tries to represent "sets of K*", by V=Boolean.static <K extends Comparable<? super K>,
V>
Trie<K,V> singleton
(V pre, K key, V post) toString()
evidentstatic <K extends Comparable<? super K>,
V>
Trie<K,V> unit
(V value)
-
Method Details
-
toString
evident -
hashCode
public int hashCode()evident -
equals
evident -
equals
evident -
list
Auxiliary factory method to construct an empty list of the given type. -
map
FIXME ??? -
unit
-
singleton
-
sequence
public static <K extends Comparable<? super K>,V> Trie<K,V> sequence(V pre, Iterable<? extends K> keys, V post) -
empty
Empty Set, when using Tries to represent "sets of K*", by V=Boolean. -
epsilon
Set containing the empty K-string, when using Tries to represent "sets of K*", by V=Boolean. -
singleton
Singlteon set containing a K-string with length=1, when using Tries to represent "sets of K*", by V=Boolean. -
append
-
automaton
-
main
-