source: ObjectBaseTypes/Level 2/UObjectPoint.pas

Last change on this file was 14, checked in by george, 15 years ago
  • Upraveno: Rozšíření sady tříd objektových typů.
File size: 1.1 KB
Line 
1unit UObjectPoint;
2
3interface
4
5uses
6 UObjectTypeBase, UObjectBoolean, Types, SysUtils;
7
8type
9 TPoint = class(TInterfacedObject, IComparable, IAssignable)
10 Value: Types.TPoint;
11 procedure Assign(Source: TInterfacedObject);
12 function EqualTo(Operand: IComparable): TBoolean;
13 function HigherThen(Operand: TInterfacedObject): TBoolean;
14 function LowerThan(Operand: TInterfacedObject): TBoolean;
15 end;
16
17implementation
18
19{ TPoint }
20
21procedure TPoint.Assign(Source: TInterfacedObject);
22begin
23 if Source is TPoint then
24 Value := TPoint(Source).Value
25 else raise EInvalidCast.Create('Typecast error');
26end;
27
28function TPoint.EqualTo(Operand: IComparable): TBoolean;
29begin
30 Result := TBoolean.Create;
31 if TInterfacedObject(Operand) is TPoint then begin
32 Result.Value := (Value.X = TPoint(Operand).Value.X) and (Value.Y = TPoint(Operand).Value.Y);
33 end else raise EInvalidCast.Create('Typecast error');
34end;
35
36function TPoint.HigherThen(Operand: TInterfacedObject): TBoolean;
37begin
38
39end;
40
41function TPoint.LowerThan(Operand: TInterfacedObject): TBoolean;
42begin
43
44end;
45
46end.
Note: See TracBrowser for help on using the repository browser.