Class DuplicatorTrie<E>
java.lang.Object
java.util.AbstractMap<K,V>
org.apache.commons.collections4.trie.AbstractBitwiseTrie<K,V>
org.apache.commons.collections4.trie.PatriciaTrie<E>
io.github.douira.glsl_transformer.ast.query.DuplicatorTrie<E>
- All Implemented Interfaces:
Serializable,Map<String,,E> SortedMap<String,,E> Get<String,,E> IterableGet<String,,E> IterableMap<String,,E> IterableSortedMap<String,,E> OrderedMap<String,,E> Put<String,,E> Trie<String,E>
- Direct Known Subclasses:
PermutermTrie,PrefixSuffixTrie
Base class for trie variants that insert more than one entry per key.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charprotected final charprotected intThe number of times thisTriehas been modified. -
Constructor Summary
ConstructorsConstructorDescriptionDuplicatorTrie(char marker) DuplicatorTrie(Map<? extends String, ? extends E> m) DuplicatorTrie(Map<? extends String, ? extends E> m, char marker) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Comparator<? super String>booleandistinctPrefixQuery(String prefix) entrySet()firstKey()Gets the first key currently in this map.protected abstract voiditerateKeyVariations(String key, Consumer<String> consumer) keySet()lastKey()Gets the last key currently in this map.Obtains anOrderedMapIteratorover the map.Gets the next key after the one specified.Returns a view of thisTrieof all elements that are prefixed by the given key.prefixMapRaw(String key) protected StringprepareKey(Object k) previousKey(String key) Gets the previous key before the one specified.Note that the return type is Object, rather than V as in the Map interface.protected StringsanitizeKey(String key) Returns theMap.Entrywhose key is closest in a bitwise XOR metric to the given key.Returns the key that is closest in a bitwise XOR metric to the provided key.selectValue(String key) Returns the value whose key is closest in a bitwise XOR metric to the provided key.intsize()values()Methods inherited from class org.apache.commons.collections4.trie.AbstractBitwiseTrie
getKeyAnalyzer, toStringMethods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, putAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.collections4.Get
containsValue, isEmptyMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
DEFAULT_MARKER
public static final char DEFAULT_MARKER- See Also:
-
marker
protected final char marker -
modCount
protected transient int modCount
-
-
Constructor Details
-
DuplicatorTrie
public DuplicatorTrie() -
DuplicatorTrie
-
DuplicatorTrie
public DuplicatorTrie(char marker) -
DuplicatorTrie
-
-
Method Details
-
iterateKeyVariations
-
prepareKey
-
sanitizeKey
-
containsKey
- Specified by:
containsKeyin interfaceGet<String,E> - Specified by:
containsKeyin interfaceMap<String,E> - Parameters:
k- key whose presence in this map is to be tested- Returns:
trueif this map contains a mapping for the specified key- See Also:
-
get
-
headMap
-
nextKey
Description copied from interface:OrderedMapGets the next key after the one specified.- Specified by:
nextKeyin interfaceOrderedMap<String,E> - Parameters:
key- the key to search for next from- Returns:
- the next key, null if no match or at end
-
prefixMap
Description copied from interface:TrieReturns a view of thisTrieof all elements that are prefixed by the given key.In a
Triewith fixed size keys, this is essentially aMap.get(Object)operation.For example, if the
Triecontains 'Anna', 'Anael', 'Analu', 'Andreas', 'Andrea', 'Andres', and 'Anatole', then a lookup of 'And' would return 'Andreas', 'Andrea', and 'Andres'. -
prefixMapRaw
-
previousKey
Description copied from interface:OrderedMapGets the previous key before the one specified.- Specified by:
previousKeyin interfaceOrderedMap<String,E> - Parameters:
key- the key to search for previous from- Returns:
- the previous key, null if no match or at start
-
put
Description copied from interface:PutNote that the return type is Object, rather than V as in the Map interface. See the class Javadoc for further info.- Specified by:
putin interfaceMap<String,E> - Specified by:
putin interfacePut<String,E> - Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with
key, ornullif there was no mapping forkey. (Anullreturn can also indicate that the map previously associatednullwithkey, if the implementation supportsnullvalues.) - See Also:
-
remove
-
select
Returns theMap.Entrywhose key is closest in a bitwise XOR metric to the given key. This is NOT lexicographic closeness. For example, given the keys:- D = 1000100
- H = 1001000
- L = 1001100
Triecontained 'H' and 'L', a lookup of 'D' would return 'L', because the XOR distance between D & L is smaller than the XOR distance between D & H.- Parameters:
key- the key to use in the search- Returns:
- the
Map.Entrywhose key is closest in a bitwise XOR metric to the provided key
-
selectKey
Returns the key that is closest in a bitwise XOR metric to the provided key. This is NOT lexicographic closeness! For example, given the keys:- D = 1000100
- H = 1001000
- L = 1001100
Triecontained 'H' and 'L', a lookup of 'D' would return 'L', because the XOR distance between D & L is smaller than the XOR distance between D & H.- Parameters:
key- the key to use in the search- Returns:
- the key that is closest in a bitwise XOR metric to the provided key
-
subMap
-
tailMap
-
distinctPrefixQuery
-
clear
public void clear() -
size
public int size() -
selectValue
Returns the value whose key is closest in a bitwise XOR metric to the provided key. This is NOT lexicographic closeness! For example, given the keys:- D = 1000100
- H = 1001000
- L = 1001100
Triecontained 'H' and 'L', a lookup of 'D' would return 'L', because the XOR distance between D & L is smaller than the XOR distance between D & H.- Parameters:
key- the key to use in the search- Returns:
- the value whose key is closest in a bitwise XOR metric to the provided key
-
entrySet
-
keySet
-
values
-
comparator
-
firstKey
Description copied from interface:OrderedMapGets the first key currently in this map.- Returns:
- the first key currently in this map
-
lastKey
Description copied from interface:OrderedMapGets the last key currently in this map.- Returns:
- the last key currently in this map
-
mapIterator
Description copied from interface:OrderedMapObtains anOrderedMapIteratorover the map.A ordered map iterator is an efficient way of iterating over maps in both directions.
- Returns:
- a map iterator
-