[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'contnrs' (#fcl)

TCustomBucketList

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Custom bucket list class

Declaration

Source position: contnrs.pp line 508

type TCustomBucketList = class(TObject)

protected

  procedure GetBucketItem();

  function AddItem(); virtual;

  function BucketFor(); virtual; abstract;

  function DeleteItem(); virtual;

  procedure Error();

  function FindItem(); virtual;

  property Buckets: TBucketArray; [r]

  property BucketCount: Integer; [rw]

public

  destructor Destroy; override;

  

Frees the bucketlist from memory

  procedure Clear;

  

Clear the list

  function Add();

  

Add an item to the list

  procedure Assign();

  

Assign one bucket list to another

  function Exists();

  

Check if an item exists in the list.

  function Find();

  

Find an item in the list

  function ForEach();

  

Loop over all items.

  function Remove();

  

Remove an item from the list.

  property Data: Pointer; default; [rw]

  

Associative array for data pointers

end;

Inheritance

TCustomBucketList

  

Custom bucket list class

|

TObject

Description

TCustomBucketList is an associative list using buckets for storage. It scales better than a regular TList list class, escpecially when an item must be searched in the list.

Since the list associates a data pointer with each item pointer, it follows that each item pointer must be unique, and can be added to the list only once.

The TCustomBucketList class does not determine the number of buckets or the bucket hash mechanism, this must be done by descendent classes such as TBucketList. TCustomBucketList only takes care of storage and retrieval of items in the various buckets.

Because TCustomBucketList is an abstract class - it does not determine the number of buckets - one should never instantiate an instance of TCustomBucketList, but always use a descendent class such as TCustomBucketList.

See also

TBucketList

  

Default bucket list implementation.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.