C# Class Majestic12.FastHash

FastHash: class provides fast look ups at the expense of memory (at least 128k per object). Its designed primarily for those hashes where majority of lookups are unsuccessful (ie object is not present) Status of this work is EXPERIMENTAL, do not make any untested assumptions. History: 15/12/06 Added range check in GetXY sometime in 2005: initial imlpementation
Inheritance: IDisposable
Datei anzeigen Open project: arktronic/sevenauth Class Usage Examples

Public Methods

Method Description
Add ( string sKey ) : void

Adds key to the fast hash

Add ( string sKey, object iValue ) : void

Adds key and its value to the fast hash

Contains ( string sKey ) : bool

Checks if given key is present in the hash

Dispose ( ) : void
FastHash ( ) : System
GetLikelyPresentValue ( byte iX, byte iY ) : object

Returns value for likely present keys using first chars (byte)

GetLikelyPresentValue ( string sKey ) : object

Returns value of a key that is VERY likely to be present - this avoids doing some checks that are most likely to be pointless thus making overall faster function

GetValue ( string sKey ) : object

Returns value associated with the key or null if key not present

GetXY ( string sKey, int &iX, int &iY ) : void
PossiblyContains ( char cChar1, char cChar2, int iLength ) : bool

Quickly checks if given chars POSSIBLY refer to a stored key.

this ( string sKey ) : object

Access to values via indexer

Private Methods

Method Description
Dispose ( bool bDisposing ) : void

Method Details

Add() public method

Adds key to the fast hash
public Add ( string sKey ) : void
sKey string Key
return void

Add() public method

Adds key and its value to the fast hash
public Add ( string sKey, object iValue ) : void
sKey string Key
iValue object Value
return void

Contains() public method

Checks if given key is present in the hash
public Contains ( string sKey ) : bool
sKey string Key
return bool

Dispose() public method

public Dispose ( ) : void
return void

FastHash() public method

public FastHash ( ) : System
return System

GetLikelyPresentValue() public method

Returns value for likely present keys using first chars (byte)
public GetLikelyPresentValue ( byte iX, byte iY ) : object
iX byte Byte 1 denoting char 1
iY byte Byte 2 denoting char 2 (0 if not present)
return object

GetLikelyPresentValue() public method

Returns value of a key that is VERY likely to be present - this avoids doing some checks that are most likely to be pointless thus making overall faster function
public GetLikelyPresentValue ( string sKey ) : object
sKey string Key
return object

GetValue() public method

Returns value associated with the key or null if key not present
public GetValue ( string sKey ) : object
sKey string Key
return object

GetXY() public static method

public static GetXY ( string sKey, int &iX, int &iY ) : void
sKey string
iX int
iY int
return void

PossiblyContains() public method

Quickly checks if given chars POSSIBLY refer to a stored key.
public PossiblyContains ( char cChar1, char cChar2, int iLength ) : bool
cChar1 char Char 1
cChar2 char Char 2
iLength int Length of string
return bool

this() public method

Access to values via indexer
public this ( string sKey ) : object
sKey string
return object