Changeset 4 for ObjectBaseTypes/UObjectBoolean.pas
- Timestamp:
- Jul 27, 2009, 3:19:14 PM (15 years ago)
- Location:
- ObjectBaseTypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ObjectBaseTypes
- Property svn:ignore
-
old new 3 3 TestApplication.res 4 4 *.dcu 5 *.~dsk
-
- Property svn:ignore
-
ObjectBaseTypes/UObjectBoolean.pas
r3 r4 11 11 IComparable = interface 12 12 function EqualTo(Operand: TInterfacedObject): TBoolean; 13 function HigherThen(Operand: TInterfacedObject): TBoolean;14 function LowerThan(Operand: TInterfacedObject): TBoolean;15 13 end; 16 14 17 TBoolean = class(TInterfacedObject, I Assignable, IComparable, IOrdinal)15 TBoolean = class(TInterfacedObject, IComparable, IAssignable) 18 16 Value: Boolean; 19 function Ordinal: IOrdinal;20 function Predecessor: IOrdinal;21 function Successor: IOrdinal;22 function Low: IOrdinal;23 function High: IOrdinal;24 17 procedure Invert; 25 18 function EqualTo(Operand: TInterfacedObject): TBoolean; … … 61 54 end; 62 55 63 function TBoolean.High: IOrdinal;64 begin65 Result := TBoolean.Create;66 TBoolean(Result).Value := True;67 end;68 69 56 function TBoolean.HigherThen(Operand: TInterfacedObject): TBoolean; 70 57 begin … … 80 67 end; 81 68 82 function TBoolean.Low: IOrdinal;83 begin84 Result := TBoolean.Create;85 TBoolean(Result).Value := False;86 end;87 88 69 function TBoolean.LowerThan(Operand: TInterfacedObject): TBoolean; 89 70 begin … … 92 73 Result.Value := Value < TBoolean(Operand).Value; 93 74 end else raise EInvalidCast.Create('Typecast error'); 94 end;95 96 function TBoolean.Ordinal: IOrdinal;97 begin98 Result := TInteger.Create;99 TInteger(Result).Value := Integer(Value);100 75 end; 101 76 … … 108 83 end; 109 84 110 function TBoolean.Predecessor: IOrdinal;111 begin112 raise ENotImplemented.Create('Not implemented');113 end;114 115 function TBoolean.Successor: IOrdinal;116 begin117 118 end;119 85 120 86 end.
Note:
See TracChangeset
for help on using the changeset viewer.