Hash is triggered when an integer value needs to be determined to organize the collection
Member of Dictionary Collection (PRIM_DCOL)
Name | Type | Data Type | Description |
---|---|---|---|
Subject | *Input | PRIM_OBJT | Reference to the object currently being hashed |
Hash | *Both | Integer | Value of the hash |
The Hash event is fired whenever the collection needs an integer value to be determined to organize the collection Hash values are used by the collection in order to obtain a hash that will always identify a component. Using the hash, only those components in the collection with the same hash are checked for equality. The default hash is the pointer to the component. There may be situations where you want to be able to look up in dictionary based on a value like a name or identifier. To obtain a hash for these kinds of values use the CalculateHashCalculateHash method during the Hash event supplying the value(s) that you want hashed Note that a hash event is only used by unordered collections (Set and Dictionary) that need to be able to do lookups quickly when there could be a large number of items in the collection. Other collections do lookups using the Compare event as a means to sort the items. Ordered collections do lookups by searching through the collection looking for a match. These collections use the IsEqual event and include the List and Array collection classes.
Using the CalculateHash method. The Hash event is fired whenever the collection needs to evaluate a hash.
Evtroutine Handling(#Collection.Hash) Subject(#Subject) Hash(#Hash) #Hash := #Collection.CalculateHash(#Subject) Endroutine
Febuary 18 V14SP2