Ignore:
Timestamp:
Oct 28, 2010, 5:41:05 PM (14 years ago)
Author:
george
Message:
  • Added: Generic Queue and Stack classes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Demo/UMainForm.pas

    r72 r73  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, ListInteger, ListString, DictionaryString;
     9  ComCtrls, ListInteger, ListString, DictionaryString, QueueInteger;
    1010
    1111type
     
    1414
    1515  TMainForm = class(TForm)
     16    ButtonQueueInteger: TButton;
    1617    ButtonDictionaryString: TButton;
    1718    ButtonIntegerList: TButton;
     
    2021    procedure ButtonDictionaryStringClick(Sender: TObject);
    2122    procedure ButtonIntegerListClick(Sender: TObject);
     23    procedure ButtonQueueIntegerClick(Sender: TObject);
    2224    procedure ButtonStringListClick(Sender: TObject);
    2325    procedure FormCreate(Sender: TObject);
     
    6466    WriteLn('Last: ' + IntToStr(Last));
    6567    MoveItems(3, 2, 3);
     68    WriteLn('Implode: ' + Implode(',', IntToStr));
     69  finally
     70    Free;
     71  end;
     72end;
     73
     74procedure TMainForm.ButtonQueueIntegerClick(Sender: TObject);
     75var
     76  Queue: TQueueInteger;
     77  I: Integer;
     78begin
     79  MemoOutput.Clear;
     80  WriteLn('TQueueInteger test');
     81  Queue := TQueueInteger.Create;
     82  with Queue do try
     83    Enqueue(1);
     84    Enqueue(2);
     85    Enqueue(3);
     86    WriteLn('Implode: ' + Implode(',', IntToStr));
     87    WriteLn('Enqueue: 4');
     88    Enqueue(4);
     89    WriteLn('Implode: ' + Implode(',', IntToStr));
     90    WriteLn('Dequeue: ' + IntToStr(Dequeue));
    6691    WriteLn('Implode: ' + Implode(',', IntToStr));
    6792  finally
Note: See TracChangeset for help on using the changeset viewer.