source: branches/AS8051toC/Packages/TemplateGenerics/Generic/GenericRange.inc

Last change on this file was 26, checked in by chronos, 12 years ago
  • Upraveno: Překlad rozdělen do fáze zpracování maker a druhé fáze zpracování instrukcí.
File size: 825 bytes
Line 
1{$IFDEF INTERFACE}
2
3 // TGRange<TRangeItem> = class
4 TGRange = class
5 private
6 procedure SetDistance(const AValue: TRangeItem);
7 function GetDistance: TRangeItem;
8 public
9 A: TRangeItem;
10 B: TRangeItem;
11 procedure SetRange(NewA, NewB: TRangeItem);
12 property Distance: TRangeItem read GetDistance write SetDistance;
13 end;
14
15{$UNDEF INTERFACE}
16{$ENDIF}
17
18{$IFDEF IMPLEMENTATION}
19
20{ TGRange }
21
22procedure TGRange.SetDistance(const AValue: TRangeItem);
23begin
24 B := A + AValue;
25end;
26
27function TGRange.GetDistance: TRangeItem;
28begin
29 Result := B - A;
30end;
31
32procedure TGRange.SetRange(NewA, NewB: TRangeItem);
33begin
34 if NewA > NewB then begin
35 A := NewB;
36 B := NewA;
37 end else begin
38 A := NewA;
39 B := NewB;
40 end;
41end;
42
43{$UNDEF IMPLEMENTATION}
44{$ENDIF}
Note: See TracBrowser for help on using the repository browser.