C# Класс 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
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
Dispose ( bool bDisposing ) : void

Описание методов

Add() публичный Метод

Adds key to the fast hash
public Add ( string sKey ) : void
sKey string Key
Результат void

Add() публичный Метод

Adds key and its value to the fast hash
public Add ( string sKey, object iValue ) : void
sKey string Key
iValue object Value
Результат void

Contains() публичный Метод

Checks if given key is present in the hash
public Contains ( string sKey ) : bool
sKey string Key
Результат bool

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

FastHash() публичный Метод

public FastHash ( ) : System
Результат System

GetLikelyPresentValue() публичный Метод

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)
Результат object

GetLikelyPresentValue() публичный Метод

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
Результат object

GetValue() публичный Метод

Returns value associated with the key or null if key not present
public GetValue ( string sKey ) : object
sKey string Key
Результат object

GetXY() публичный статический Метод

public static GetXY ( string sKey, int &iX, int &iY ) : void
sKey string
iX int
iY int
Результат void

PossiblyContains() публичный Метод

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
Результат bool

this() публичный Метод

Access to values via indexer
public this ( string sKey ) : object
sKey string
Результат object