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 | |
---|
1 | unit UObjectPoint;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | UObjectTypeBase, UObjectBoolean, Types, SysUtils;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
17 | implementation
|
---|
18 |
|
---|
19 | { TPoint }
|
---|
20 |
|
---|
21 | procedure TPoint.Assign(Source: TInterfacedObject);
|
---|
22 | begin
|
---|
23 | if Source is TPoint then
|
---|
24 | Value := TPoint(Source).Value
|
---|
25 | else raise EInvalidCast.Create('Typecast error');
|
---|
26 | end;
|
---|
27 |
|
---|
28 | function TPoint.EqualTo(Operand: IComparable): TBoolean;
|
---|
29 | begin
|
---|
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');
|
---|
34 | end;
|
---|
35 |
|
---|
36 | function TPoint.HigherThen(Operand: TInterfacedObject): TBoolean;
|
---|
37 | begin
|
---|
38 |
|
---|
39 | end;
|
---|
40 |
|
---|
41 | function TPoint.LowerThan(Operand: TInterfacedObject): TBoolean;
|
---|
42 | begin
|
---|
43 |
|
---|
44 | end;
|
---|
45 |
|
---|
46 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.