ВУЗ:
Составители:
Рубрика:
33
procedure TryFind(Key: KeyType);
procedure Add(Key: KeyType; Value: ValueType);
function GetItem(Key: KeyType): ValueType;
procedure SetItem(Key: KeyType; Value: Value-
Type);
public
constructor Create;
destructor Destroy;
property Items[Key: KeyType]: ValueType
read GetItem write SetItem; default;
end;
implementation
constructor AssocArray.Create;
begin
Pairs:=List.Create;
it:=ListIterator.Create(Pairs);
end;
destructor AssocArray.Destroy;
begin
it.Destroy;
Pairs.Destroy;
end;
procedure AssocArray.TryFind(Key: KeyType);
begin
it.MoveFirst;
while not it.Eol do
begin
if it.Data.Key=Key then
exit;
it.Next;
end;
end;
procedure AssocArray.Add(Key: KeyType; Value: Value-
Type);
var r: PairsSIList.DataType;
begin
r.Key:=Key;
r.Value:=Value;
Pairs.AddLast(r);
it.MoveLast;
end;
Страницы
- « первая
- ‹ предыдущая
- …
- 29
- 30
- 31
- 32
- 33
- …
- следующая ›
- последняя »