-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtpl_coll_list.inc
35 lines (31 loc) · 2.13 KB
/
tpl_coll_list.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(*
* List interface.
* List is an ordered collection.
* Elements can be accessed, inserted and removed by their position in the list (zero-based index).
* Performance of the operations may vary and depends on implementation.
*)
{$IFDEF TPL_HINTS}{$MESSAGE 'Instantiating collection part of interface'}{$ENDIF}
{$I tpl_coll_collection.inc}
{/ Returns the element at the specified position in the list.
Throws an error on invalid index if dsRangeCheck was included in the list options before instantiation. }
function Get(const Index: __CollectionIndexType): {$I _T.inc};
{/ Replaces the element at the specified position in the list with the specified element.
Returns the element previously at the specified position.
Throws an error on invalid index if dsRangeCheck was included in the list options when instantiation. }
function Put(const Index: __CollectionIndexType; const Value: {$I _T.inc}): {$I _T.inc};
{/ Inserts the element at the specified position in the list shifting the element currently at that
position (if any) and any subsequent elements to the right.
Throws an error on invalid index if dsRangeCheck was included in the list options when instantiation. }
procedure Insert(const Index: __CollectionIndexType; const Value: {$I _T.inc});
{/ Removes the element at the specified position in the list shifting any subsequent elements to the left.
Returns the element that was removed from the list.
Throws an error on invalid index if dsRangeCheck was included in the list options when instantiation. }
function RemoveBy(const Index: __CollectionIndexType): {$I _T.inc};
{/ Returns the index of the first occurrence of the specified element in the list,
or -1 if the list does not contain the element. }
function IndexOf(const e: {$I _T.inc}): __CollectionIndexType;
{/ Returns the index of the last occurrence of the specified element in the list,
or -1 if the list does not contain the element. }
function LastIndexOf(const e: {$I _T.inc}): __CollectionIndexType;
// Values retrieved by index
property Values[const Index: __CollectionIndexType]: {$I _T.inc} read Get; default;