The TIStringHashTable class implements and manages a hash table of string-interface associations. It stores interfaces (IUnknown and its descendants) indexed by a string key. Hash tables provide constant time O(C) search access to any value in the table (using the key) as the table grows (unlike a TStringList where to search for an item is O(n). The TIStringHashTable object provides properties and methods to:
• Add or delete the interfaces in the table. • Locate and access interfaces in the table. |
Note |
---|
For a small numbers of items, this class may be slower than a TStringList because its retrieval time constant is larger. It also consumes more memory than a TStringList. |
Namespace: RSInterfaceCollections
TPersistent |
Delphi |
type |
|
|
Setting the value this way overwrites the value for an existing key, but does not raise an exception. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add key-value pair even when key already exists. AddOrSetValue adds a key-value pair to a dictionary even if the key already exists. The key cannot be nil, but the value can. This method checks to see if the key exists in the dictionary, and if it does, it is equivalent to Items[key] := value;. Otherwise it is equivalent to Add(key, value);. An OnKeyNotify event and an OnValueNotify event occur indicating an entry was added to the dictionary. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method AfterConstruction. (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copies the input source to the hash table. If the input source is a TStrings class, the strings are copied as keys into the hash table; the values are just default values.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method AssignTo(TPersistent). (Inherited from RSGenerics.Collections.TRSStringHashTable<TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defers change events and discards notify events until EndUpdate is called. This method allows faster processing of multiple items by deferring or discarding events. There must be an equal number of EndUpdate method calls for every BeginUpdate method calls to reenable events. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Calls the OnChange event (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clear all data. Clear removes all keys and values from the dictionary. The Count property is set to 0. The capacity is also set to 0. This operation requires O(n) time, where n is Count, the number of dictionary entries.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clears the index from the cache. This index is used by ItemByIndex to ensure quick iteration over the hash table. (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Equivalent to ContainsValue. Retained for backward compatibility. (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overloaded. Try to get value for key. ContainsKey returns true if the given key is in the dictionary and provides its value in FoundItem. Otherwise, it returns false and FoundItem is set to the default value type of TValue. No exception is raised if the key is not in the dictionary. This is an O(1) operation.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check if value in dictionary. ContainsValue returns true if the given value is in the dictionary and false otherwise. This is an O(n) operation, where n is the number of entries in the dictionary. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Used to discard old properties from TGHashTable. LoadFactor, HashType, and Capacity are properties from TGHashTable. We define pseudo-properties with these names so that they are recognized but do nothing with them. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reads in and discards LoadFactor property (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reads in and discards HashType and Capacity properties (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Writes out nothing for LoadFactor, HashType, and Capacity properties (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Adds key/value pair to dictionary at the given index (Overrides RSGenerics.Collections.TRSDictionary<TKey,TValue>.DoAdd(Integer,Integer,TKey,TValue).) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns the container's enumerator. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Removes key/value pair from dictionary (Overrides RSGenerics.Collections.TRSDictionary<TKey,TValue>.DoRemove(TKey,Integer,TCollectionNotification).) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overwrites value in dictionary at the given index (Overrides RSGenerics.Collections.TRSDictionary<TKey,TValue>.DoSetValue(Integer,TValue).) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reenables change events and notify events after BeginUpdate has been called. There must be an equal number of EndUpdate method calls for every BeginUpdate method calls to reenable events. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns the TPair<TKey,TValue> pair with the specified Key and removes the returned pair from a dictionary. If the dictionary does not contain the specified Key, the returned pair contains a default TValue. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Retrieves the value at this key. (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns an key-value pair enumerator for the dictionary. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns a unique name, or ID, based on the aName parameter. If the aName parameter is not in the dictionary, the parameter will be returned unchanged. Otherwise, the function will append 'copy' on the name (and possibly a number representing the number of copies). Note that the Append parameter should not be blank (Inherited from RSGenerics.Collections.TRSStringHashTable<TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns an iterator for all the indices, or string keys, in the hash table. (Inherited from RSGenerics.Collections.TRSStringHashTable<TValue>.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Triggers an OnKeyNotify event with the given parameters. Call KeyNotify to trigger an OnKeyNotify event with the given parameters. The meaning of the parameters is given in the following table: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Key |
The key that is added, removed or extracted. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Action |
The action that the key undergoes, which is of type TCollectionNotification. |
(Overrides RSGenerics.Collections.TRSDictionary<TKey,TValue>.KeyNotify(TKey,TCollectionNotification).)
Stores the Value defined type at the specified hash key. It returns the old value at that hash key if there was one. (Inherited from RSGenerics.Collections.TRSHashTable<TKey,TValue>.)
Remove key-value pair.
Remove removes the given key and its associated value from the dictionary. No exception is thrown if the key is not in the dictionary. This is an O(1) operation.
An OnKeyNotify event and an OnValueNotify event occur indicating an entry was removed from the dictionary.
Returns the content of the dictionary as an array.
(Overrides RSGenerics.Collections.TRSEnumerable<T>.ToArray.)
Converts the enumerable container's items into an equivalent TArray of items. (Inherited from RSGenerics.Collections.TRSEnumerable<T>.)
Reduce capacity to current number of entries.
TrimExcess changes the capacity to the number of dictionary entries, held in Count.
This method rehashes the internal hash table to save space. This is only useful after a lot of items have been deleted from the dictionary.
Try to get value for key.
TryGetValue returns true if the given key is in the dictionary and provides its value in Value. Otherwise, it returns false and Value is set to the default value type of TValue. No exception is raised if the key is not in the dictionary. This is an O(1) operation.
ValueNotify(TValue,TCollectionNotification)
Triggers an OnValueNotify event with the given parameters.
Call ValueNotify to trigger an OnValueNotify event with the given parameters.
The meaning of the parameters is given in the following table:
Value
The Value that is added, removed or extracted.
Action
The action that the Value undergoes, which is of type TCollectionNotification.
|