Class TIntegerList

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TIntegerList = class(TObject)

Description

TIntegerList acts much like TList except that it stores integers rather than pointers.

Hierarchy

Overview

Fields

Private FList: TList;
Private FSorted: boolean;

Methods

Private function GetCapacity: integer;
Private function GetCount: integer;
Private function GetItem(Index: integer): integer;
Private procedure SetCapacity(ACapacity: Integer);
Private procedure SetItem(Index: integer; const AnInteger: integer);
Private procedure SetSorted(AValue: boolean);
Private procedure FindClosestPositionInSortedList(AnInteger: Integer; var Top, Bottom: Integer);
Public procedure Assign(Source: TIntegerList);
Public function Add(const AnInteger: integer): integer;
Public procedure AddUnique(const AnInteger: integer);
Public procedure Clear;
Public constructor Create;
Public procedure Delete(Index: Integer);
Public destructor Destroy; override;
Public class procedure Error(const Msg: string; Data: Integer); virtual;
Public procedure Exchange(Index1, Index2: Integer);
Public function First: Integer;
Public function IndexOf(AnInteger: integer): integer;
Public procedure Insert(Index: Integer; AnInteger: integer);
Public function Last: integer;
Public function MaxValue: integer;
Public function MinValue: integer;
Public procedure Move(CurIndex, NewIndex: Integer);
Public function Nearest(const TestValue: integer): integer;
Public procedure Sort;

Properties

Public property Capacity: integer read GetCapacity write SetCapacity;
Public property Count: integer read GetCount;
Public property Items[Index:integer]: integer read GetItem write SetItem;
Public property Sorted: boolean read FSorted write SetSorted;

Description

Fields

Private FList: TList;

FList stores instances of TIntegerClass (defined in the implementation section. Those instances each store one of the values stored in TIntegerList.

Private FSorted: boolean;

FSorted indicates whether or not the TIntegerList is sorted.

Methods

Private function GetCapacity: integer;

See Capacity.

Private function GetCount: integer;

See Count.

Private function GetItem(Index: integer): integer;

See Items.

Private procedure SetCapacity(ACapacity: Integer);

See Capacity.

Private procedure SetItem(Index: integer; const AnInteger: integer);

See Items.

Private procedure SetSorted(AValue: boolean);

See Sorted.

Private procedure FindClosestPositionInSortedList(AnInteger: Integer; var Top, Bottom: Integer);
 
Public procedure Assign(Source: TIntegerList);
 
Public function Add(const AnInteger: integer): integer;

Add adds AnInteger to the TIntegerList. If Sorted is true, Add inserts AnInteger so as to keep the TIntegerList sorted.

Public procedure AddUnique(const AnInteger: integer);

AddUnique will add AnInteger to the TIntegerList if there isn't already one in the TIntegerList.

Public procedure Clear;

Clear deletes all the integers from the TIntegerList.

Public constructor Create;

Create creates an instance of TIntegerList.

Public procedure Delete(Index: Integer);

Delete deletes the integer at position Index from the list of integers.

Public destructor Destroy; override;

Destroy destroys the current instance of TIntegerList. Do not call Destroy directly. Call Free instead.

Public class procedure Error(const Msg: string; Data: Integer); virtual;

Error raises and EListError exception. See TList.Error.

Public procedure Exchange(Index1, Index2: Integer);

Exchange switches the integers at positions Index1 and Index2.

Public function First: Integer;

First returns the first integer in the TIntegerList.

Public function IndexOf(AnInteger: integer): integer;

IndexOf returns the position of AnInteger in the TIntegerList.

Public procedure Insert(Index: Integer; AnInteger: integer);

Insert inserts AnInteger into the TIntegerList at position Index.

Public function Last: integer;

Last gets the last integer in the TIntegerList.

Public function MaxValue: integer;

MaxValue returns the highest integer in the TIntegerList.

Public function MinValue: integer;

MinValue returns the lowest integer in the TIntegerList.

Public procedure Move(CurIndex, NewIndex: Integer);

Move moves the integer at CurIndex to NewIndex.

Public function Nearest(const TestValue: integer): integer;

Nearest returns the position of the integer in TIntegerList whose value is closest to TestValue.

Public procedure Sort;

Sort sorts the integers in TIntegerList in ascending order and sets Sorted to true.

Properties

Public property Capacity: integer read GetCapacity write SetCapacity;

Capacity indicates how many integers the TIntegerList can hold without reallocating memory for the list of integers.

Public property Count: integer read GetCount;

Count indicates how many integers are stored in the TIntegerList.

Public property Items[Index:integer]: integer read GetItem write SetItem;

Items is used to get and retrieve integers by their position in the TIntegerList.

Public property Sorted: boolean read FSorted write SetSorted;

Sorted indicates whether or not the integers in TIntegerList have been sorted in ascending order using Sort.


Generated by PasDoc 0.12.1 on 2013-05-13 15:41:43