Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
16
Добавлен:
01.05.2014
Размер:
1.54 Кб
Скачать
unit list;
interface
type
vertex=record
x,y,number:integer;
end;

type
plvertex=^lvertex;
lvertex=record
used:integer;
x,y,number:integer;
next,previos: plvertex;
end;

type
TListVertex=class
public
beginList,current : plvertex;
procedure AddVector(x,y,num:integer);
procedure DeleteVector(V:plVertex);
constructor Create;
procedure Free;
end;

implementation

procedure TListVertex.AddVector(x,y,num:integer);
var T,C:plvertex;
begin
new (T);
T^.x:=x; T^.y:=y; T^.number:=num;
if (beginList=nil) then
begin
beginList:=T; current:=T;
T^.previos:=beginList; T^.next:=beginList;
T^.x:=x; T^.y:=y; T^.number:=num; T^.used:=0;
end
else
begin
C:=beginList;
while (C^.next<>beginList) do C:=C^.next;
C^.next:=T; T^.previos:=C;T^.next:=beginList;
beginList.previos:=T;T^.used:=0;
end;
end;

procedure TListVertex.DeleteVector(V:plVertex);
var p,n:plVertex;
begin
p:=V.previos; n:=V.next;
p^.next:=n; n^.previos:=p;
dispose(V);
end;

constructor TListVertex.Create;
begin
beginList:=nil;
current:=nil;
end;

procedure TListVertex.Free;
var t,b:plvertex;
begin
if (beginList<>nil) then
begin
current:=beginList;
t:=current; current:=current^.next;
dispose(t);
while (current<>beginList) do
begin
t:=current; current:=current^.next;
dispose(t);
end;
current:=nil; beginList:=nil;
end;
end;

end.

Соседние файлы в папке Source
  • #
    01.05.20141.03 Кб16CHILDWIN.~dfm
  • #
    01.05.201421.48 Кб16CHILDWIN.~PAS
  • #
    01.05.201490 б17Graham.txt
  • #
    01.05.20146.41 Кб16KURS_R93.LEX
  • #
    01.05.20142 Кб16List.dcu
  • #
    01.05.20141.54 Кб16LIST.PAS
  • #
    01.05.201412.18 Кб16MAIN.DCU
  • #
    01.05.201451 б16MAIN.ddp
  • #
    01.05.201439.84 Кб16MAIN.dfm
  • #
    01.05.20147.05 Кб16MAIN.PAS
  • #
    01.05.201451 б16MAIN.~ddp