E
- public class IntTrie<E> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
IntTrie.EntryVisitor<E>
This defines an interface for a class which consumes keys stored in the
trie together with the value they are associated with.
|
Constructor and Description |
---|
IntTrie()
Creates a new instance that always uses HashMaps to connect it's states.
|
IntTrie(MapFactory factory)
This creates a new instance which builds the maps it uses by calling
the provided factory.
|
Modifier and Type | Method and Description |
---|---|
void |
foreach(Consumer<E> fn)
Applies the given consumer to all the values in this map.
|
void |
foreachValueForKeySets(List<IntSet> keySets,
Consumer<E> fn)
Applys the consumer to all the non-null value that can be reached with the
given keys.
|
void |
foreachWithKeys(IntTrie.EntryVisitor<E> visitor)
Applies the given visitor to every key value pair stored in the trie.
|
E |
get(int[] key)
Returns the value associate with the key, or null if there is no such value.
|
Collection<E> |
getValues()
Returns a collection of all the values stored in the trie.
|
void |
print(BiFunction<Integer,Integer,String> keyToString,
Function<E,String> valueToString)
Prints out the automaton with the given mappings for keys and values.
|
void |
printStatistics()
Prints a summary of the trie in its current states.
|
E |
put(int[] key,
E value)
Adds a new key value pair to the trie.
|
void |
setValueCounter(ToLongFunction<E> valueCounter)
The value counter is used to map entries in the try into longs, which
can then be added up to get some summary statistics.
|
IntTrie<E> |
step(int oneStepKey)
Obtais the subtrie reached with the given key.
|
String |
toString() |
public IntTrie(MapFactory factory)
factory
- public IntTrie()
public void setValueCounter(ToLongFunction<E> valueCounter)
valueCounter
- public E put(int[] key, E value)
key
- value
- public E get(int[] key)
key
- public IntTrie<E> step(int oneStepKey)
oneStepKey
- public void foreachValueForKeySets(List<IntSet> keySets, Consumer<E> fn)
keySets
- fn
- public void foreach(Consumer<E> fn)
fn
- public void foreachWithKeys(IntTrie.EntryVisitor<E> visitor)
visitor
- public Collection<E> getValues()
public void printStatistics()
public void print(BiFunction<Integer,Integer,String> keyToString, Function<E,String> valueToString)
keyToString
- valueToString
- Copyright © 2017. All rights reserved.