Helper Scripts Collection 1.3.1
API documentation for the helper scripts compatible with Unity3D
Public Member Functions | Public Attributes | List of all members
NikosAssets.Helpers.StringHasher Class Reference

A helper class to map key (number hashes) to existing or yet to be added strings More...

Public Member Functions

 StringHasher (int reserved32)
 
 StringHasher (ulong reservedU64)
 
 StringHasher (int reserved32, ulong reservedU64)
 
virtual int GetAndSet32 (int desiredHashKey, string value, bool checkValue=true)
 Returns the hash value for the given string value , either an existing one or a new one using the stringHashDictInt32 More...
 
virtual ulong GetAndSetU64 (ulong desiredHashKey, string value, bool checkValue=true)
 Returns the hash value for the given string value , either an existing one or a new one using the stringHashDictUInt64 More...
 

Public Attributes

Dictionary< int, string > stringHashDictInt32 = new Dictionary<int, string>()
 
Dictionary< ulong, string > stringHashDictUInt64 = new Dictionary<ulong, string>()
 
int reserved32 = -1
 
ulong reservedU64 = 0
 

Detailed Description

A helper class to map key (number hashes) to existing or yet to be added strings

Member Function Documentation

◆ GetAndSet32()

virtual int NikosAssets.Helpers.StringHasher.GetAndSet32 ( int  desiredHashKey,
string  value,
bool  checkValue = true 
)
virtual

Returns the hash value for the given string value , either an existing one or a new one using the stringHashDictInt32

Parameters
desiredHashKeyThe desired hash for the given string value
valueThe string value to map to the generated or desired hash
checkValueCheck if the value already has a key that doesnt match the desiredKey? ///
Returns
Returns the reserved number, if the string value is null or empty. Returns the desiredHash value if the string entry matched the hash or no entry was found. Returns a new random hash value if the string value did not match the desired key on the found entry (hash collision) or the desired hash matched the reserved number

◆ GetAndSetU64()

virtual ulong NikosAssets.Helpers.StringHasher.GetAndSetU64 ( ulong  desiredHashKey,
string  value,
bool  checkValue = true 
)
virtual

Returns the hash value for the given string value , either an existing one or a new one using the stringHashDictUInt64

Parameters
desiredHashKeyThe desired hash for the given string value
valueThe string value to map to the generated or desired hash
checkValueCheck if the value already has a key that doesnt match the desiredKey?
Returns
Returns the reserved number, if the string value is null or empty. Returns the desiredHash value if the string entry matched the hash or no entry was found. Returns a new random hash value if the string value did not match the desired key on the found entry (hash collision) or the desired hash matched the reserved number