Class TOpenAddressing

Unit

Declaration

type TOpenAddressing<TKey,TValue,THashFactory,TProbeSequence> = class abstract(TCustomDictionary<TKey,TValue,THashFactory>)

Description

No description available, ancestor TCustomDictionary description follows

bug #24283 and #24097 (forward declaration) - should be: TCustomDictionary<CUSTOM_DICTIONARY_CONSTRAINTS> = class(TEnumerable<TPair<TKey, TValue> >);

Hierarchy

Overview

Internal Classes and Records

Private TItem = record
Public TKeyCollection = class(TDictionaryEnumerable<TKeyEnumerator,TPKeyEnumerator,TKey,TKey,TValue,THashFactory>)
Public TKeyEnumerator = class(TOpenAddressingEnumerator<TKey,TKey,TValue,THashFactory,TProbeSequence>)
Public TPairEnumerator = class(TOpenAddressingEnumerator<TDictionaryPair,TKey,TValue,THashFactory,TProbeSequence>)
Public TPKeyEnumerator = class(TOpenAddressingEnumerator<PKey,TKey,TValue,THashFactory,TProbeSequence>)
Private TPointersEnumerator = class(TOpenAddressingPointersEnumerator<TItem,PDictionaryPair>)
Public TPValueEnumerator = class(TOpenAddressingEnumerator<PValue,TKey,TValue,THashFactory,TProbeSequence>)
Public TValueCollection = class(TDictionaryEnumerable<TValueEnumerator,TPValueEnumerator,TValue,TKey,TValue,THashFactory>)
Public TValueEnumerator = class(TOpenAddressingEnumerator<TValue,TKey,TValue,THashFactory,TProbeSequence>)

Internal Types

Private PItem = ˆTItem;
Public PPointersCollection = ˆTPointersCollection;
Private TItemsArray = array of TItem;
Private TPointersCollection = TOpenAddressingPointersCollection<TPointersEnumerator, TItem, PDictionaryPair>;

Fields

Private var FItems: TItemsArray;
Private FItemsThreshold: SizeInt;

Methods

Private procedure Resize(ANewSize: SizeInt);
Private procedure PrepareAddingItem;
Protected function RealItemsLength: SizeInt; virtual;
Protected function Rehash(ASizePow2: SizeInt; AForce: Boolean = False): boolean; virtual;
Protected function FindBucketIndex(constref AKey: TKey): SizeInt; overload; inline;
Protected function FindBucketIndex(constref AItems: TArray<TItem>; constref AKey: TKey; out AHash: UInt32): SizeInt; virtual; abstract; overload;
Public function GetEnumerator: TPairEnumerator; reintroduce;
Private function GetKeys: TKeyCollection;
Private function GetValues: TValueCollection;
Private function GetPointers: PPointersCollection; inline;
Private function GetItem(const AKey: TKey): TValue; inline;
Private procedure SetItem(const AKey: TKey; const AValue: TValue); inline;
Private procedure AddItem(var AItem: TItem; constref AKey: TKey; constref AValue: TValue; const AHash: UInt32); inline;
Protected function DoRemove(AIndex: SizeInt; ACollectionNotification: TCollectionNotification): TValue; virtual;
Protected function DoAdd(constref AKey: TKey; constref AValue: TValue): SizeInt; virtual;
Protected procedure UpdateItemsThreshold(ASize: SizeInt); override;
Protected procedure SetCapacity(ACapacity: SizeInt); override;
Protected function DoGetEnumerator: TEnumerator<TDictionaryPair>; override;
Protected procedure SetMaxLoadFactor(AValue: single); override;
Protected function GetLoadFactor: single; override;
Protected function GetCapacity: SizeInt; override;
Public constructor Create(ACapacity: SizeInt; const AComparer: IEqualityComparer<TKey>); override; overload;
Public procedure Add(constref APair: TPair<TKey, TValue>); override; overload;
Public procedure Add(constref AKey: TKey; constref AValue: TValue); overload; inline;
Public procedure Remove(constref AKey: TKey);
Public function ExtractPair(constref AKey: TKey): TPair<TKey, TValue>;
Public procedure Clear; override;
Public procedure TrimExcess;
Public function TryGetValue(constref AKey: TKey; out AValue: TValue): Boolean;
Public procedure AddOrSetValue(constref AKey: TKey; constref AValue: TValue);
Public function ContainsKey(constref AKey: TKey): Boolean; inline;
Public function ContainsValue(constref AValue: TValue): Boolean; overload;
Public function ContainsValue(constref AValue: TValue; const AEqualityComparer: IEqualityComparer<TValue>): Boolean; virtual; overload;
Public procedure GetMemoryLayout(const AOnGetMemoryLayoutKeyPosition: TOnGetMemoryLayoutKeyPosition);

Properties

Public property Items[Index:TKey]: TValue read GetItem write SetItem;
Public property Keys: TKeyCollection read GetKeys;
Public property Values: TValueCollection read GetValues;
Public property Ptr: PPointersCollection read GetPointers;

Description

Internal Types

Private PItem = ˆTItem;
 
Public PPointersCollection = ˆTPointersCollection;
 
Private TItemsArray = array of TItem;
 
Private TPointersCollection = TOpenAddressingPointersCollection<TPointersEnumerator, TItem, PDictionaryPair>;
 

Fields

Private var FItems: TItemsArray;

FItems must be declared as first field

Private FItemsThreshold: SizeInt;
 

Methods

Private procedure Resize(ANewSize: SizeInt);
 
Private procedure PrepareAddingItem;
 
Protected function RealItemsLength: SizeInt; virtual;
 
Protected function Rehash(ASizePow2: SizeInt; AForce: Boolean = False): boolean; virtual;
 
Protected function FindBucketIndex(constref AKey: TKey): SizeInt; overload; inline;
 
Protected function FindBucketIndex(constref AItems: TArray<TItem>; constref AKey: TKey; out AHash: UInt32): SizeInt; virtual; abstract; overload;
 
Public function GetEnumerator: TPairEnumerator; reintroduce;

bug #24283 - workaround related to lack of DoGetEnumerator

Private function GetKeys: TKeyCollection;
 
Private function GetValues: TValueCollection;
 
Private function GetPointers: PPointersCollection; inline;
 
Private function GetItem(const AKey: TKey): TValue; inline;
 
Private procedure SetItem(const AKey: TKey; const AValue: TValue); inline;
 
Private procedure AddItem(var AItem: TItem; constref AKey: TKey; constref AValue: TValue; const AHash: UInt32); inline;
 
Protected function DoRemove(AIndex: SizeInt; ACollectionNotification: TCollectionNotification): TValue; virtual;

useful for using dictionary as array

Protected function DoAdd(constref AKey: TKey; constref AValue: TValue): SizeInt; virtual;
 
Protected procedure UpdateItemsThreshold(ASize: SizeInt); override;
 
Protected procedure SetCapacity(ACapacity: SizeInt); override;
 
Protected function DoGetEnumerator: TEnumerator<TDictionaryPair>; override;

bug #24283 - can't descadent from TEnumerable

Protected procedure SetMaxLoadFactor(AValue: single); override;
 
Protected function GetLoadFactor: single; override;
 
Protected function GetCapacity: SizeInt; override;
 
Public constructor Create(ACapacity: SizeInt; const AComparer: IEqualityComparer<TKey>); override; overload;

many constructors because bug #25607

Public procedure Add(constref APair: TPair<TKey, TValue>); override; overload;
 
Public procedure Add(constref AKey: TKey; constref AValue: TValue); overload; inline;
 
Public procedure Remove(constref AKey: TKey);
 
Public function ExtractPair(constref AKey: TKey): TPair<TKey, TValue>;
 
Public procedure Clear; override;
 
Public procedure TrimExcess;
 
Public function TryGetValue(constref AKey: TKey; out AValue: TValue): Boolean;
 
Public procedure AddOrSetValue(constref AKey: TKey; constref AValue: TValue);
 
Public function ContainsKey(constref AKey: TKey): Boolean; inline;
 
Public function ContainsValue(constref AValue: TValue): Boolean; overload;
 
Public function ContainsValue(constref AValue: TValue; const AEqualityComparer: IEqualityComparer<TValue>): Boolean; virtual; overload;
 
Public procedure GetMemoryLayout(const AOnGetMemoryLayoutKeyPosition: TOnGetMemoryLayoutKeyPosition);
 

Properties

Public property Items[Index:TKey]: TValue read GetItem write SetItem;
 
Public property Keys: TKeyCollection read GetKeys;
 
Public property Values: TValueCollection read GetValues;
 
Public property Ptr: PPointersCollection read GetPointers;
 

Generated by PasDoc 0.15.0.