Class TertiarySearchTrie<TValue>
- Namespace
- AlgorithmsSW.String
- Assembly
- AlgorithmsSW.dll
public class TertiarySearchTrie<TValue> : IStringSymbolTable<TValue>, ISymbolTable<string, TValue>, IReadOnlySymbolTable<string, TValue>, IStringCollection
Type Parameters
TValue
- Inheritance
-
TertiarySearchTrie<TValue>
- Implements
-
IStringSymbolTable<TValue>ISymbolTable<string, TValue>IReadOnlySymbolTable<string, TValue>
- Inherited Members
- Extension Methods
Properties
Comparer
public IComparer<string> Comparer { get; }
Property Value
Count
Gets the number of key/value pairs contained in the symbol table.
public int Count { get; }
Property Value
Keys
Gets an IEnumerable<T> containing the keys of the symbol table.
public IEnumerable<string> Keys { get; }
Property Value
SupportsEmptyKeys
public bool SupportsEmptyKeys { get; }
Property Value
Methods
Add(string, TValue)
Adds the specified key and value to the symbol table.
public void Add(string key, TValue value)
Parameters
key
stringThe key of the element to add.
value
TValueThe value of the element to add.
KeysThatMatch(string)
Returns all keys in the symbol table that match the given pattern.
public IEnumerable<string> KeysThatMatch(string pattern)
Parameters
pattern
stringThe pattern used to search for keys.
Returns
KeysWithPrefix(string)
Returns all keys in the symbol table that have the given prefix.
public IEnumerable<string> KeysWithPrefix(string prefix)
Parameters
prefix
stringThe prefix used to search for keys.
Returns
LongestPrefixOf(string)
Returns the longest string that is a prefix of the given string.
public string? LongestPrefixOf(string str)
Parameters
str
string
Returns
- string
The longest string that is a prefix of the given string; null if no keys are a prefix of the given string.
RemoveKey(string)
Removes the element with the specified key from the symbol table.
public void RemoveKey(string key)
Parameters
key
stringThe key of the element to remove.
TryGetValue(string, out TValue)
Tries to get the value associated with the specified key from the symbol table.
public bool TryGetValue(string key, out TValue value)
Parameters
key
stringThe key of the value to get.
value
TValueWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Returns
- bool
true
if the symbol table contains an element with the specified key; otherwise,false
.