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
Afficher le fichier Open project: arktronic/sevenauth Class Usage Examples

Méthodes publiques

Méthode 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

Méthode Description
Dispose ( bool bDisposing ) : void

Method Details

Add() public méthode

Adds key to the fast hash
public Add ( string sKey ) : void
sKey string Key
Résultat void

Add() public méthode

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

Contains() public méthode

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

Dispose() public méthode

public Dispose ( ) : void
Résultat void

FastHash() public méthode

public FastHash ( ) : System
Résultat System

GetLikelyPresentValue() public méthode

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)
Résultat object

GetLikelyPresentValue() public méthode

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
Résultat object

GetValue() public méthode

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

GetXY() public static méthode

public static GetXY ( string sKey, int &iX, int &iY ) : void
sKey string
iX int
iY int
Résultat void

PossiblyContains() public méthode

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
Résultat bool

this() public méthode

Access to values via indexer
public this ( string sKey ) : object
sKey string
Résultat object