Changeset 379 for Generics/NativeGenerics
- Timestamp:
- Jun 21, 2012, 10:39:13 AM (12 years ago)
- Location:
- Generics/NativeGenerics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo/Demo.lpi
r327 r379 53 53 <IsPartOfProject Value="True"/> 54 54 <ComponentName Value="MainForm"/> 55 <HasResources Value="True"/> 55 56 <ResourceBaseClass Value="Form"/> 56 57 <UnitName Value="UMainForm"/> 57 <IsVisibleTab Value="True"/>58 58 <EditorIndex Value="0"/> 59 59 <WindowIndex Value="0"/> 60 <TopLine Value=" 760"/>61 <CursorPos X=" 5" Y="766"/>60 <TopLine Value="18"/> 61 <CursorPos X="36" Y="10"/> 62 62 <UsageCount Value="233"/> 63 63 <Bookmarks Count="1"> … … 348 348 <EditorIndex Value="1"/> 349 349 <WindowIndex Value="0"/> 350 <TopLine Value=" 31"/>351 <CursorPos X=" 58" Y="35"/>350 <TopLine Value="12"/> 351 <CursorPos X="74" Y="43"/> 352 352 <UsageCount Value="60"/> 353 353 <Loaded Value="True"/> … … 356 356 <Filename Value="../Units/GenericMatrix.pas"/> 357 357 <UnitName Value="GenericMatrix"/> 358 <IsVisibleTab Value="True"/> 358 359 <EditorIndex Value="5"/> 359 360 <WindowIndex Value="0"/> 360 <TopLine Value=" 37"/>361 <CursorPos X=" 34" Y="48"/>361 <TopLine Value="103"/> 362 <CursorPos X="5" Y="116"/> 362 363 <UsageCount Value="38"/> 363 364 <Loaded Value="True"/> … … 400 401 <Filename Value="../Units/SpecializedList.pas"/> 401 402 <UnitName Value="SpecializedList"/> 402 <EditorIndex Value="6"/>403 403 <WindowIndex Value="0"/> 404 404 <TopLine Value="45"/> 405 405 <CursorPos X="1" Y="68"/> 406 406 <UsageCount Value="39"/> 407 <Loaded Value="True"/>408 407 </Unit41> 409 408 <Unit42> … … 460 459 <Filename Value="../Units/GenericString.pas"/> 461 460 <UnitName Value="GenericString"/> 462 <EditorIndex Value=" 7"/>461 <EditorIndex Value="6"/> 463 462 <WindowIndex Value="0"/> 464 463 <TopLine Value="35"/> … … 470 469 <Filename Value="../Units/GenericBitmap.pas"/> 471 470 <UnitName Value="GenericBitmap"/> 472 <EditorIndex Value=" 8"/>473 <WindowIndex Value="0"/> 474 <TopLine Value=" 22"/>475 <CursorPos X="1 8" Y="46"/>471 <EditorIndex Value="7"/> 472 <WindowIndex Value="0"/> 473 <TopLine Value="1"/> 474 <CursorPos X="15" Y="14"/> 476 475 <UsageCount Value="31"/> 477 476 <Loaded Value="True"/> … … 552 551 </Unit59> 553 552 </Units> 554 <JumpHistory Count="30" HistoryIndex="2 8">553 <JumpHistory Count="30" HistoryIndex="29"> 555 554 <Position1> 556 <Filename Value="../Units/Generic Tree.pas"/>557 <Caret Line=" 27" Column="57" TopLine="20"/>555 <Filename Value="../Units/GenericMatrix.pas"/> 556 <Caret Line="71" Column="45" TopLine="57"/> 558 557 </Position1> 559 558 <Position2> 560 <Filename Value="../Units/Generic Tree.pas"/>561 <Caret Line=" 51" Column="40" TopLine="44"/>559 <Filename Value="../Units/GenericMatrix.pas"/> 560 <Caret Line="77" Column="43" TopLine="64"/> 562 561 </Position2> 563 562 <Position3> 564 <Filename Value="../Units/Generic Tree.pas"/>565 <Caret Line=" 29" Column="33" TopLine="14"/>563 <Filename Value="../Units/GenericMatrix.pas"/> 564 <Caret Line="87" Column="47" TopLine="74"/> 566 565 </Position3> 567 566 <Position4> 568 <Filename Value="../Units/Generic Tree.pas"/>569 <Caret Line=" 63" Column="49" TopLine="42"/>567 <Filename Value="../Units/GenericMatrix.pas"/> 568 <Caret Line="89" Column="62" TopLine="76"/> 570 569 </Position4> 571 570 <Position5> 572 <Filename Value="../Units/Generic Tree.pas"/>573 <Caret Line=" 34" Column="1" TopLine="18"/>571 <Filename Value="../Units/GenericMatrix.pas"/> 572 <Caret Line="93" Column="59" TopLine="80"/> 574 573 </Position5> 575 574 <Position6> 576 <Filename Value="../Units/Generic Tree.pas"/>577 <Caret Line=" 21" Column="72" TopLine="12"/>575 <Filename Value="../Units/GenericMatrix.pas"/> 576 <Caret Line="94" Column="61" TopLine="81"/> 578 577 </Position6> 579 578 <Position7> 580 <Filename Value="../Units/Generic Tree.pas"/>581 <Caret Line=" 65" Column="54" TopLine="51"/>579 <Filename Value="../Units/GenericMatrix.pas"/> 580 <Caret Line="124" Column="73" TopLine="111"/> 582 581 </Position7> 583 582 <Position8> 584 <Filename Value="../Units/Generic Tree.pas"/>585 <Caret Line="1 01" Column="27" TopLine="94"/>583 <Filename Value="../Units/GenericMatrix.pas"/> 584 <Caret Line="140" Column="71" TopLine="127"/> 586 585 </Position8> 587 586 <Position9> 588 <Filename Value="../Units/Generic Tree.pas"/>589 <Caret Line="2 9" Column="6" TopLine="13"/>587 <Filename Value="../Units/GenericMatrix.pas"/> 588 <Caret Line="223" Column="57" TopLine="210"/> 590 589 </Position9> 591 590 <Position10> 592 <Filename Value="../Units/Generic Tree.pas"/>593 <Caret Line=" 49" Column="14" TopLine="38"/>591 <Filename Value="../Units/GenericMatrix.pas"/> 592 <Caret Line="311" Column="74" TopLine="298"/> 594 593 </Position10> 595 594 <Position11> 596 <Filename Value="../Units/Generic Tree.pas"/>597 <Caret Line=" 22" Column="19" TopLine="25"/>595 <Filename Value="../Units/GenericMatrix.pas"/> 596 <Caret Line="323" Column="59" TopLine="310"/> 598 597 </Position11> 599 598 <Position12> 600 <Filename Value="../Units/Generic Tree.pas"/>601 <Caret Line=" 28" Column="4" TopLine="19"/>599 <Filename Value="../Units/GenericMatrix.pas"/> 600 <Caret Line="431" Column="55" TopLine="418"/> 602 601 </Position12> 603 602 <Position13> 604 <Filename Value="../Units/Generic Tree.pas"/>605 <Caret Line=" 29" Column="7" TopLine="16"/>603 <Filename Value="../Units/GenericBitmap.pas"/> 604 <Caret Line="14" Column="15" TopLine="1"/> 606 605 </Position13> 607 606 <Position14> 608 <Filename Value=" UMainForm.pas"/>609 <Caret Line=" 774" Column="30" TopLine="754"/>607 <Filename Value="../Units/GenericMatrix.pas"/> 608 <Caret Line="114" Column="55" TopLine="91"/> 610 609 </Position14> 611 610 <Position15> 612 <Filename Value="../Units/Generic Tree.pas"/>613 <Caret Line=" 47" Column="5" TopLine="34"/>611 <Filename Value="../Units/GenericMatrix.pas"/> 612 <Caret Line="50" Column="39" TopLine="37"/> 614 613 </Position15> 615 614 <Position16> 616 <Filename Value="../Units/Generic Tree.pas"/>617 <Caret Line=" 71" Column="48" TopLine="53"/>615 <Filename Value="../Units/GenericMatrix.pas"/> 616 <Caret Line="114" Column="24" TopLine="94"/> 618 617 </Position16> 619 618 <Position17> 620 <Filename Value="../Units/Generic Tree.pas"/>621 <Caret Line=" 126" Column="3" TopLine="124"/>619 <Filename Value="../Units/GenericMatrix.pas"/> 620 <Caret Line="50" Column="40" TopLine="25"/> 622 621 </Position17> 623 622 <Position18> 624 <Filename Value="../Units/Generic Tree.pas"/>625 <Caret Line="1 27" Column="1" TopLine="113"/>623 <Filename Value="../Units/GenericMatrix.pas"/> 624 <Caret Line="114" Column="24" TopLine="101"/> 626 625 </Position18> 627 626 <Position19> 628 <Filename Value="../Units/Generic Tree.pas"/>629 <Caret Line=" 126" Column="23" TopLine="113"/>627 <Filename Value="../Units/GenericMatrix.pas"/> 628 <Caret Line="50" Column="39" TopLine="37"/> 630 629 </Position19> 631 630 <Position20> 632 <Filename Value=" UMainForm.pas"/>633 <Caret Line=" 774" Column="30" TopLine="754"/>631 <Filename Value="../Units/GenericMatrix.pas"/> 632 <Caret Line="664" Column="1" TopLine="639"/> 634 633 </Position20> 635 634 <Position21> 636 <Filename Value="../Units/Generic Tree.pas"/>637 <Caret Line=" 7" Column="40" TopLine="1"/>635 <Filename Value="../Units/GenericMatrix.pas"/> 636 <Caret Line="132" Column="3" TopLine="114"/> 638 637 </Position21> 639 638 <Position22> 640 <Filename Value="../Units/Generic Tree.pas"/>641 <Caret Line=" 22" Column="21" TopLine="1"/>639 <Filename Value="../Units/GenericMatrix.pas"/> 640 <Caret Line="114" Column="14" TopLine="106"/> 642 641 </Position22> 643 642 <Position23> 644 <Filename Value="../Units/Generic Tree.pas"/>645 <Caret Line=" 35" Column="54" TopLine="14"/>643 <Filename Value="../Units/GenericMatrix.pas"/> 644 <Caret Line="133" Column="15" TopLine="115"/> 646 645 </Position23> 647 646 <Position24> 648 <Filename Value="../Units/Generic Tree.pas"/>649 <Caret Line=" 64" Column="21" TopLine="43"/>647 <Filename Value="../Units/GenericMatrix.pas"/> 648 <Caret Line="54" Column="65" TopLine="37"/> 650 649 </Position24> 651 650 <Position25> 652 <Filename Value="../Units/Generic Tree.pas"/>653 <Caret Line=" 49" Column="1" TopLine="40"/>651 <Filename Value="../Units/GenericMatrix.pas"/> 652 <Caret Line="50" Column="39" TopLine="37"/> 654 653 </Position25> 655 654 <Position26> 656 <Filename Value="../Units/Generic Tree.pas"/>657 <Caret Line=" 63" Column="7" TopLine="55"/>655 <Filename Value="../Units/GenericMatrix.pas"/> 656 <Caret Line="138" Column="50" TopLine="118"/> 658 657 </Position26> 659 658 <Position27> 660 <Filename Value="../Units/Generic Tree.pas"/>661 <Caret Line=" 92" Column="7" TopLine="76"/>659 <Filename Value="../Units/GenericMatrix.pas"/> 660 <Caret Line="144" Column="49" TopLine="120"/> 662 661 </Position27> 663 662 <Position28> 664 <Filename Value="../Units/Generic Tree.pas"/>665 <Caret Line=" 89" Column="1" TopLine="76"/>663 <Filename Value="../Units/GenericMatrix.pas"/> 664 <Caret Line="134" Column="1" TopLine="122"/> 666 665 </Position28> 667 666 <Position29> 668 <Filename Value="../Units/Generic Tree.pas"/>669 <Caret Line="1 25" Column="26" TopLine="107"/>667 <Filename Value="../Units/GenericMatrix.pas"/> 668 <Caret Line="137" Column="41" TopLine="126"/> 670 669 </Position29> 671 670 <Position30> 672 <Filename Value="../Units/Generic Tree.pas"/>673 <Caret Line=" 70" Column="14" TopLine="57"/>671 <Filename Value="../Units/GenericMatrix.pas"/> 672 <Caret Line="136" Column="29" TopLine="123"/> 674 673 </Position30> 675 674 </JumpHistory> -
Generics/NativeGenerics/Units/GenericList.pas
r327 r379 195 195 end; 196 196 197 procedure TGList<TItem>.GetList(List: TGList ; Index, ACount: TIndex);197 procedure TGList<TItem>.GetList(List: TGList<TItem>; Index, ACount: TIndex); 198 198 begin 199 199 List.Clear; … … 539 539 end; 540 540 541 procedure TGList<TItem>.AddListPart(List: TGList ; ItemIndex, ItemCount: TIndex);541 procedure TGList<TItem>.AddListPart(List: TGList<TItem>; ItemIndex, ItemCount: TIndex); 542 542 var 543 543 I: TIndex; -
Generics/NativeGenerics/Units/GenericMatrix.pas
r324 r379 19 19 TRow = array of TItem; 20 20 TMerge = function(Item1, Item2: TItem): TItem of object; 21 PItem = ^TItem; 21 22 22 23 TIndex = record … … 68 69 function Add(Item: TItem): TIndex; 69 70 procedure AddMatrix(Values: array of TRow); 70 procedure AddList(List: TGMatrix );71 procedure Assign(Source: TGMatrix );71 procedure AddList(List: TGMatrix<TItem>); 72 procedure Assign(Source: TGMatrix<TItem>); 72 73 procedure Clear; virtual; 73 74 procedure Contract; … … 75 76 procedure Delete(Index: TIndex); virtual; 76 77 procedure DeleteItems(Index, Count: TIndex); 77 function EqualTo(List: TGMatrix ): Boolean;78 function EqualTo(List: TGMatrix<TItem>): Boolean; 78 79 procedure Expand; 79 80 function Extract(Item: TItem): TItem; … … 85 86 procedure Explode(Text, Separator: string; Converter: TFromStringConverter; SlicesCount: Integer = -1); 86 87 function IndexOf(Item: TItem; Start: TIndex = 0): TIndex; 87 function IndexOfList(List: TGMatrix ; Start: TIndex = 0): TIndex;88 function IndexOfList(List: TGMatrix<TItem>; Start: TIndex = 0): TIndex; 88 89 procedure Insert(Index: TIndex; Item: TItem); 89 procedure InsertList(Index: TIndex; List: TGMatrix );90 procedure InsertList(Index: TIndex; List: TGMatrix<TItem>); 90 91 procedure InsertArray(Index: TIndex; Values: array of TItem); 91 92 procedure Move(CurIndex, NewIndex: TIndex); 92 93 procedure MoveItems(CurIndex, NewIndex, Count: TIndex); 93 procedure Merge(Index: TIndex; Source: TGMatrix ; Proc: TMerge);94 procedure Replace(Index: TIndex; Source: TGMatrix );94 procedure Merge(Index: TIndex; Source: TGMatrix<TItem>; Proc: TMerge); 95 procedure Replace(Index: TIndex; Source: TGMatrix<TItem>); 95 96 function Remove(Item: TItem): TIndex; 96 97 procedure Reverse; … … 107 108 TIndex = TGAbstractMatrix<TItem>.TIndex; 108 109 private 110 FRowSize: Integer; 111 FCellSize: Integer; 109 112 FData: Pointer; 110 113 FCount: TIndex; 114 public 115 constructor Create; 116 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; override; 117 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); override; 118 property Data: Pointer read FData; 119 property Count: TIndex read FCount write SetCount; 111 120 end; 112 121 … … 120 129 121 130 131 { TGRawMatrix } 132 133 constructor TGRawMatrix<TItem>.Create; 134 begin 135 FCellSize := SizeOf(TItem); 136 end; 137 138 function TGRawMatrix<TItem>.GetItemXY(X: TIndexX; Y: TIndexY): TItem; 139 begin 140 Result := PItem(X * FCellSize + Y * FRowSize)^; 141 end; 142 143 procedure TGRawMatrix<TItem>.PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); 144 begin 145 PItem(X * FCellSize + Y * FRowSize)^ := AValue; 146 end; 147 122 148 { TGMatrix } 123 149 124 procedure TGMatrix<TItem>.Replace(Index: TIndex; Source: TGMatrix );150 procedure TGMatrix<TItem>.Replace(Index: TIndex; Source: TGMatrix<TItem>); 125 151 var 126 152 X: TIndexX; … … 138 164 end; 139 165 140 procedure TGMatrix<TItem>.Merge(Index: TIndex; Source: TGMatrix ; Proc: TMerge);166 procedure TGMatrix<TItem>.Merge(Index: TIndex; Source: TGMatrix<TItem>; Proc: TMerge); 141 167 var 142 168 X: TIndexX; … … 221 247 end; 222 248 223 procedure TGMatrix<TItem>.Assign(Source: TGMatrix );249 procedure TGMatrix<TItem>.Assign(Source: TGMatrix<TItem>); 224 250 var 225 251 Index: TIndex; … … 309 335 end; 310 336 311 procedure TGMatrix<TItem>.InsertList(Index: TIndex; List: TGMatrix );337 procedure TGMatrix<TItem>.InsertList(Index: TIndex; List: TGMatrix<TItem>); 312 338 var 313 339 I: TIndex; … … 321 347 end; 322 348 323 function TGMatrix<TItem>.IndexOfList(List: TGMatrix ; Start: TIndex): TIndex;349 function TGMatrix<TItem>.IndexOfList(List: TGMatrix<TItem>; Start: TIndex): TIndex; 324 350 var 325 351 I: TIndex; … … 429 455 end; 430 456 431 function TGMatrix<TItem>.EqualTo(List: TGMatrix ): Boolean;457 function TGMatrix<TItem>.EqualTo(List: TGMatrix<TItem>): Boolean; 432 458 var 433 459 I: TIndex; … … 575 601 end; 576 602 577 procedure TGMatrix<TItem>.AddList(List: TGMatrix );603 procedure TGMatrix<TItem>.AddList(List: TGMatrix<TItem>); 578 604 var 579 605 I: TIndex;
Note:
See TracChangeset
for help on using the changeset viewer.