Changeset 324 for Generics/NativeGenerics/Units/GenericMatrix.pas
- Timestamp:
- Feb 8, 2012, 1:04:21 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Units/GenericMatrix.pas
r321 r324 9 9 10 10 type 11 TG Matrix<TItem> = class11 TGAbstractMatrix<TItem> = class 12 12 public 13 13 type … … 24 24 Y: TIndexY; 25 25 end; 26 protected 27 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; virtual; abstract; 28 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual; abstract; 29 function GetItem(Index: TIndex): TItem; virtual; abstract; 30 function GetCapacity: TIndex; virtual; abstract; 31 function GetLast: TItem; virtual; abstract; 32 function GetFirst: TItem; virtual; abstract; 33 function GetCount: TIndex; virtual; abstract; 34 procedure SetLast(AValue: TItem); virtual; abstract; 35 procedure SetFirst(AValue: TItem); virtual; abstract; 36 procedure PutItem(Index: TIndex; const AValue: TItem); virtual; abstract; 37 procedure SetCount(const AValue: TIndex); virtual; abstract; 38 public 39 property Count: TIndex read GetCount write SetCount; 40 property ItemsXY[X: TIndexX; Y: TIndexY]: TItem 41 read GetItemXY write PutItemXY; default; 42 property Items[Index: TIndex]: TItem 43 read GetItem write PutItem; 44 property Last: TItem read GetLast write SetLast; 45 end; 46 47 TGMatrix<TItem> = class(TGAbstractMatrix<TItem>) 48 public 49 type 50 TIndex = TGAbstractMatrix<TItem>.TIndex; 51 protected 52 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; override; 53 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); override; 54 function GetItem(Index: TIndex): TItem; override; 55 function GetLast: TItem; override; 56 function GetFirst: TItem; override; 57 function GetCount: TIndex; override; 58 procedure SetLast(AValue: TItem); override; 59 procedure SetFirst(AValue: TItem); override; 60 procedure PutItem(Index: TIndex; const AValue: TItem); override; 61 procedure SetCount(const AValue: TIndex); override; 26 62 private 27 63 FItems: array of array of TItem; 28 64 FCount: TIndex; 29 function GetItemXY(X: TIndexX; Y: TIndexY): TItem; 30 function GetItem(Index: TIndex): TItem; 31 function GetCapacity: TIndex; 32 function GetLast: TItem; 33 function GetFirst: TItem; 65 function GetCapacity: TIndex; override; 34 66 procedure SetCapacity(const AValue: TIndex); 35 procedure SetLast(AValue: TItem);36 procedure SetFirst(AValue: TItem);37 procedure PutItemXY(X: TIndexX; Y: TIndexY; const AValue: TItem); virtual;38 procedure PutItem(Index: TIndex; const AValue: TItem); virtual;39 procedure SetCount(const AValue: TIndex);40 67 public 41 68 function Add(Item: TItem): TIndex; … … 72 99 procedure Sort(Compare: TSortCompare); 73 100 procedure SetArray(Values: array of TItem); 74 property Count: TIndex read FCount write SetCount;75 101 property Capacity: TIndex read GetCapacity write SetCapacity; 76 property ItemsXY[X: TIndexX; Y: TIndexY]: TItem 77 read GetItemXY write PutItemXY; default; 78 property Items[Index: TIndex]: TItem 79 read GetItem write PutItem; 80 property Last: TItem read GetLast write SetLast; 102 end; 103 104 TGRawMatrix<TItem> = class(TGAbstractMatrix<TItem>) 105 public 106 type 107 TIndex = TGAbstractMatrix<TItem>.TIndex; 108 private 109 FData: Pointer; 110 FCount: TIndex; 81 111 end; 82 112 … … 620 650 end; 621 651 652 function TGMatrix<TItem>.GetCount: TIndex; 653 begin 654 Result := FCount; 655 end; 656 657 622 658 end.
Note:
See TracChangeset
for help on using the changeset viewer.