Ignore:
Timestamp:
Jan 3, 2011, 7:22:47 AM (14 years ago)
Author:
george
Message:
  • Added: TGMatrix implode.
File:
1 edited

Legend:

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

    r108 r109  
    2424    ButtonIntegerList: TButton;
    2525    ButtonStringList: TButton;
     26    LabelTestName: TLabel;
    2627    ListViewOutput: TListView;
    2728    procedure ButtonBenchmarkDictionaryClick(Sender: TObject);
     
    6162begin
    6263  ListViewOutput.Clear;
    63   WriteOutput('TListInteger test');
     64  LabelTestName.Caption := 'TListInteger test';
    6465  List := TListInteger.Create;
    6566  with List do try
     
    9091begin
    9192  ListViewOutput.Clear;
    92   WriteOutput('TListInteger test');
     93  LabelTestName.Caption := 'TMatrixInteger test';
    9394  Matrix := TMatrixInteger.Create;
    9495  with Matrix do try
    95     WriteOutput('AddMatrix([10, 20, 30, 40])');
    96     //AddMatrix([10, 20, 30, 40]);
    97     WriteOutput('Implode: ' + Implode(',', IntToStr));
     96    Count := CreateIndex(2, 2);
     97    WriteOutput('Count := CreateIndex(2, 2)', '[' + Implode('; ', ', ', IntToStr) + ']');
     98    Fill(CreateIndex(0, 0), Count, 1);
     99    WriteOutput('Fill(1)', '[' + Implode('; ', ', ', IntToStr) + ']');
     100    Count := CreateIndex(3, 3);
     101    WriteOutput('Count := CreateIndex(3, 3)', '[' + Implode('; ', ', ', IntToStr) + ']');
     102    WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X));
    98103    Clear;
    99     for I := 0 to 10 do Add(I);
    100     WriteOutput('Implode: ' + Implode(',', IntToStr));
    101     WriteOutput('Count: Y: ' + IntToStr(Count.Y) + ', ' + IntToStr(Count.X));
    102     WriteOutput('Implode: ' + Implode(',', IntToStr));
    103     WriteOutput('Reverse');
    104     Reverse;
    105     WriteOutput('Implode: ' + Implode(',', IntToStr));
    106     WriteOutput('First: ' + IntToStr(First));
    107     WriteOutput('Last: ' + IntToStr(Last));
    108     //MoveItems(3, 2, 3);
    109     WriteOutput('Implode: ' + Implode(',', IntToStr));
    110     WriteOutput('Insert(5, 11)');
    111     //Insert(5, 11);
    112     WriteOutput('Implode: ' + Implode(',', IntToStr));
     104    WriteOutput('Clear', '[' + Implode('; ', ', ', IntToStr) + ']');
     105    WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X));
    113106  finally
    114107    Free;
     
    127120begin
    128121  ListViewOutput.Clear;
    129   WriteOutput('TListObject test');
     122  LabelTestName.Caption := 'TListObject test';
    130123  List := TListObject.Create;
    131124  with List do try
     
    152145begin
    153146  ListViewOutput.Clear;
    154   WriteOutput('TQueueInteger test');
     147  LabelTestName.Caption := 'TQueueInteger test';
    155148  Queue := TQueueInteger.Create;
    156149  with Queue do try
     
    178171begin
    179172  ListViewOutput.Clear;
    180   WriteOutput('TDictionaryString test');
     173  LabelTestName.Caption := 'TDictionaryString test';
    181174  Dictionary := TDictionaryStringString.Create;
    182175  with Dictionary do try
     
    204197var
    205198  List: TListChar;
    206 begin
    207   ListViewOutput.Clear;
    208   WriteOutput('TListChar test');
     199  List2: TListChar;
     200begin
     201  ListViewOutput.Clear;
     202  LabelTestName.Caption := 'TListChar test';
    209203  List := TListChar.Create;
     204  List2 := TListChar.Create;
    210205  with List do try
    211206    AddArray([' ', ' ', 'A', 'b', 'c', 'd', ' ']);
     
    222217    LowerCase;
    223218    WriteOutput('LowerCase', '''' + Implode('', CharToStr) + '''');
    224   finally
     219    WriteOutput('IndexOf(''c'')', IntToStr(IndexOf('c')));
     220    List2.AddArray(['c', 'b']);
     221    WriteOutput('IndexOfList(''cb'')', IntToStr(IndexOfList(List2)));
     222  finally
     223    List2.Free;
    225224    Free;
    226225  end;
     
    234233  I: Integer;
    235234begin
     235  LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic TList benchmark';
    236236  ListViewOutput.Clear;
    237237  try
     
    377377  R: string;
    378378begin
     379  LabelTestName.Caption := 'Generic specialized TDictionaryStringString vs. classic non-generic TStringList benchmark';
    379380  ListViewOutput.Clear;
    380381  try
Note: See TracChangeset for help on using the changeset viewer.