Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Nested classes | Public fields | Properties | Public Member Functions | List of all members
Loyc.Collections.Impl.CPByteTrie< TValue > Class Template Reference

A compact patricia trie that uses byte arrays as keys. More...


Source file:
Inheritance diagram for Loyc.Collections.Impl.CPByteTrie< TValue >:
Loyc.Collections.CPTrie< T > Loyc.Collections.Impl.CPByteTrie< TValue >.Enumerator Loyc.Collections.Impl.CPByteTrie< TValue >.Enumerator

Remarks

A compact patricia trie that uses byte arrays as keys.

Template Parameters
TValueType of value associated with each key.

Nested classes

class  Enumerator
 

Public fields

TValue this[byte[] key
 Finds the specified key and returns its associated value. If the key did not exist, TryGetValue returns defaultValue instead. More...
 

Properties

ICollection< byte[]> Keys [get]
 
CPValueCollection< TValue > Values [get]
 
new int Count [get]
 
bool IsReadOnly [get]
 
bool IsEmpty [get]
 

Public Member Functions

 CPByteTrie (CPTrie< TValue > clone)
 
new int CountMemoryUsage (int sizeOfT)
 
void Add (byte[] key, TValue value)
 Adds the specified key-value pair to the trie, throwing an exception if the key is already present. More...
 
void Add (byte[] key, int offset, int length, TValue value)
 Adds the specified key-value pair to the trie, throwing an exception if the key is already present. More...
 
bool TryAdd (byte[] key, TValue value)
 Adds the specified key-value pair only if the specified key is not already present in the trie. More...
 
bool TryAdd (byte[] key, int offset, int length, TValue value)
 
bool TryAdd (byte[] key, int offset, int length, ref TValue value)
 Adds the specified key-value pair only if the specified key is not already present in the trie. More...
 
bool ContainsKey (byte[] key)
 Searches for the specified key, returning true if it is present in the trie. More...
 
bool ContainsKey (byte[] key, int offset, int length)
 Searches for the specified key, returning true if it is present in the trie. More...
 
bool Remove (byte[] key)
 Removes the specified key and associated value, returning true if the entry was found and removed. More...
 
bool Remove (byte[] key, int offset, int length)
 
bool Remove (byte[] key, int offset, int length, ref TValue oldValue)
 Removes the specified key and associated value, returning true if the entry was found and removed. More...
 
bool TryGetValue (byte[] key, out TValue value)
 Finds the specified key and gets its associated value, returning true if the key was found. More...
 
bool TryGetValue (byte[] key, int offset, int length, out TValue value)
 
void Add (KeyValuePair< byte[], TValue > item)
 
new void Clear ()
 
bool Contains (KeyValuePair< byte[], TValue > item)
 
void CopyTo (KeyValuePair< byte[], TValue >[] array, int arrayIndex)
 
bool Remove (KeyValuePair< byte[], TValue > item)
 
Enumerator GetEnumerator ()
 
Enumerator FindAtLeast (byte[] key)
 
Enumerator FindExact (byte[] key)
 
bool Find (byte[] key, out Enumerator e)
 
bool Find (byte[] key, int offset, int length, out Enumerator e)
 
CPByteTrie< TValue > Clone ()
 
- Public Member Functions inherited from Loyc.Collections.CPTrie< T >
 CPTrie (CPTrie< T > copy)
 

Additional Inherited Members

- Protected Member Functions inherited from Loyc.Collections.CPTrie< T >
bool Find (ref KeyWalker key, CPEnumerator< T > e)
 
bool Find (ref KeyWalker key, ref T value)
 Retrieves the value associated with the specified key; does nothing if the key does not exist. More...
 
bool ContainsKey (ref KeyWalker key)
 
bool Set (ref KeyWalker key, ref T value, CPMode mode)
 Associates the specified value with the specified key. More...
 
bool Remove (ref KeyWalker key, ref T value)
 Removes the specified key and associated value. More...
 
bool Remove (ref KeyWalker key)
 
void Clear ()
 
int CountMemoryUsage (int sizeOfT)
 Calculates the memory usage of this object, assuming a 32-bit architecture. More...
 
- Static Protected Member Functions inherited from Loyc.Collections.CPTrie< T >
static StringBuilder BytesToStringBuilder (byte[] key, int keyLength)
 
- Protected static fields inherited from Loyc.Collections.CPTrie< T >
static Comparer< T > DefaultComparer = Comparer<T>.Default
 

Member Function Documentation

void Loyc.Collections.Impl.CPByteTrie< TValue >.Add ( byte[]  key,
TValue  value 
)
inline

Adds the specified key-value pair to the trie, throwing an exception if the key is already present.

References Loyc.Localize.Localized().

void Loyc.Collections.Impl.CPByteTrie< TValue >.Add ( byte[]  key,
int  offset,
int  length,
TValue  value 
)
inline

Adds the specified key-value pair to the trie, throwing an exception if the key is already present.

Parameters
keyAn array that contains the key to add. The offset and length parameters specify a substring of this array to use as the key.

References Loyc.Localize.Localized().

bool Loyc.Collections.Impl.CPByteTrie< TValue >.ContainsKey ( byte[]  key)
inline

Searches for the specified key, returning true if it is present in the trie.

bool Loyc.Collections.Impl.CPByteTrie< TValue >.ContainsKey ( byte[]  key,
int  offset,
int  length 
)
inline

Searches for the specified key, returning true if it is present in the trie.

Parameters
keyAn array that contains the key to find. The offset and length parameters specify a substring of this array to use as the key.
bool Loyc.Collections.Impl.CPByteTrie< TValue >.Remove ( byte[]  key)
inline

Removes the specified key and associated value, returning true if the entry was found and removed.

References Loyc.Collections.Remove.

bool Loyc.Collections.Impl.CPByteTrie< TValue >.Remove ( byte[]  key,
int  offset,
int  length,
ref TValue  oldValue 
)
inline

Removes the specified key and associated value, returning true if the entry was found and removed.

Parameters
keyAn array that contains the key to find. The offset and length parameters specify a substring of this array to use as the key.
oldValueIf the key is found, the associated value is assigned to this parameter. Otherwise, this parameter is not changed.
bool Loyc.Collections.Impl.CPByteTrie< TValue >.TryAdd ( byte[]  key,
TValue  value 
)
inline

Adds the specified key-value pair only if the specified key is not already present in the trie.

Parameters
valueA value to associate with the specified key if the key does not already exist.
Returns
Returns true if the key-value pair was added or false if the key already existed. In the false case, the trie is not modified.
bool Loyc.Collections.Impl.CPByteTrie< TValue >.TryAdd ( byte[]  key,
int  offset,
int  length,
ref TValue  value 
)
inline

Adds the specified key-value pair only if the specified key is not already present in the trie.

Parameters
keyAn array that contains the key to find. The offset and length parameters specify a substring of this array to use as the key.
valueOn entry, value specifies the value to associate with the specified key, but if the key already exists, value is changed to the value associated with the existing key.
Returns
Returns true if the key-value pair was added or false if the key already existed. In the false case, the trie is not modified.
bool Loyc.Collections.Impl.CPByteTrie< TValue >.TryGetValue ( byte[]  key,
out TValue  value 
)
inline

Finds the specified key and gets its associated value, returning true if the key was found.

Member Data Documentation

TValue this[byte[] Loyc.Collections.Impl.CPByteTrie< TValue >.key
getset

Finds the specified key and returns its associated value. If the key did not exist, TryGetValue returns defaultValue instead.