Class PrefixTree<T>
java.lang.Object
com.e1c.langtool.v8.dt.internal.ui.refactoring.PrefixTree<T>
Naive prefix tree implementation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NonNull PrefixTree<T>Create new, empty prefix tree.@Nullable TFind value, associated with givenkey.@Nullable TgetValue()Return value, associated with current node ornullif no value associated.@Nullable TAdd or replace value, associated withkey.@Nullable TSet current node value.toSegmentedKeyMap(@NonNull Predicate<Character> splitter) Convert current tree to the map of form <List of key segments, Value>
Key segment boundary computed as follows: Last character terminate current segment Character for which predicatesplitterreturnstrueterminate current segment
-
Method Details
-
createPrefixTree
Create new, empty prefix tree.- Type Parameters:
T- Value item type- Returns:
- New empty tree
-
getValue
Return value, associated with current node ornullif no value associated.- Returns:
- Current node value
-
setValue
Set current node value. Will return previous value, associated with current node, if any.- Parameters:
value- New value- Returns:
- Previous value or
null
-
insert
Add or replace value, associated withkey.- Parameters:
key- Keyvalue- Associated value- Returns:
- Previous value, associated with same
key, if any
-
find
Find value, associated with givenkey.- Parameters:
key- Key- Returns:
- Value, associated with
keyornullif no associated value found.
-
toSegmentedKeyMap
Convert current tree to the map of form <List of key segments, Value>
Key segment boundary computed as follows:- Last character terminate current segment
- Character for which predicate
splitterreturnstrueterminate current segment
- Parameters:
splitter- Predicate, allowing additional key breaks insertion- Returns:
- Current tree, converted to map
-