| Class THash (unit hash) |
TObject
| Constructors |
constructor Create;| Functions |
function Add( const Key: string; Val: Pointer): boolean;
procedure Clear;
function Delete( const Key: string): boolean;
destructor Destroy;
function First: THashItem;
function Get( const Key: string): Pointer;
function Next: THashItem;
procedure Put( const Key: string; Val: Pointer);
function ChainOf( B: integer): TStringList;
procedure CheckGrowth;
function FindFirst( Start: integer): THashItem;
function GetAvgChainSize: real;
function GetiCount( B: integer): integer;
function GetLongestChain: integer;
function h( const Key: string): longint;
function HasChain( B: integer): boolean;
procedure Rebuild( sz: integer);
procedure SetAutoGrow( flag: boolean);
procedure SetHashFunc( Fn: THashFunc);
procedure SetSize( sz: integer);| Properties |
property AutoGrow : boolean
property AvgChainSize : real
property Chains : integer
property Count : integer
property HashFunc : THashFunc
property iCount : integer
property Items : Pointer
property LongestChain : integer
property Size : integer
property Used : integer| Events |
| Variables |
FAutoGrow : boolean;
FBIdx : integer;
FChains : integer;
FCIdx : integer;
FCount : integer;
FHash : TStringList;
FHashFunc : THashFunc;
FSize : integer;
FUsed : integer;| Constructors |
constructor Create;| Functions |
function Add( const Key: string; Val: Pointer): boolean;add is like put, but does not check for existing item
procedure Clear;
function Delete( const Key: string): boolean;value is nil, must want to delete it
destructor Destroy;
function First: THashItem;
function Get( const Key: string): Pointer;
function Next: THashItem;
procedure Put( const Key: string; Val: Pointer);bucket slot now points to chain
function ChainOf( B: integer): TStringList;helper functions; should really be macros, but...
procedure CheckGrowth;
function FindFirst( Start: integer): THashItem;yes, delete the chain, too
function GetAvgChainSize: real;
function GetiCount( B: integer): integer;
function GetLongestChain: integer;
function h( const Key: string): longint;
function HasChain( B: integer): boolean;
procedure Rebuild( sz: integer);
procedure SetAutoGrow( flag: boolean);
procedure SetHashFunc( Fn: THashFunc);
procedure SetSize( sz: integer);| Properties |
property AutoGrow : boolean
property AvgChainSize : real
property Chains : integer
property Count : integer
property HashFunc : THashFunc
property iCount : integer
property Items : Pointer
property LongestChain : integer
property Size : integer
property Used : integer| Events |
| Variables |
FAutoGrow : boolean;
FBIdx : integer;bucket and chain index of current item (used for .First and .Next method to
FChains : integer;
FCIdx : integer;
FCount : integer;
FHash : TStringList;
FHashFunc : THashFunc;
FSize : integer;max # of buckets, occupied buckets, # of chains created, # of hash items added
FUsed : integer;