home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class BOOLEAN_REF
-
- inherit
- ANY
- redefine fill_tagged_out_memory
- end;
-
- creation {ANY}
- make
-
- feature {ANY}
-
- item: BOOLEAN;
- -- Value of Current
-
- make(value: BOOLEAN) is
- -- Initialize object
- do
- item := value
- end;
-
- infix "and" (other : BOOLEAN_REF) : BOOLEAN_REF is
- -- `and' of Current with `other'.
- require
- other /= Void
- do
- !!Result.make (item and other.item)
- end;
-
- infix "and then" (other : BOOLEAN_REF) : BOOLEAN_REF is
- -- Semi-strict `and' of Current with `other'.
- require
- other /= Void
- do
- !!Result.make (item and then other.item)
- end;
-
- infix "implies" (other : BOOLEAN_REF) : BOOLEAN_REF is
- -- Does Current imply `other'.
- require
- other /= Void
- do
- !!Result.make (item implies other.item)
- end;
-
- infix "or" (other : BOOLEAN_REF) : BOOLEAN_REF is
- -- `or' of Current with `other'
- require
- other_not_void : other /= Void
- do
- !!Result.make (item or other.item)
- end;
-
- infix "or else" (other : BOOLEAN_REF) : BOOLEAN_REF is
- -- Semi-strict `or' of Current with `other'
- require
- other_not_void : other /= Void
- do
- !!Result.make (item or else other.item)
- end;
-
- infix "xor" (other: BOOLEAN_REF): BOOLEAN_REF is
- -- `xor' of Current with `other'
- require
- other /= Void
- do
- !!Result.make (item xor other.item)
- end;
-
- prefix "not": BOOLEAN_REF is
- -- `not' of Current.
- do
- !!Result.make(not item)
- end;
-
- fill_tagged_out_memory is
- do
- tagged_out_memory.append("item: ");
- if item then
- tagged_out_memory.append("true");
- else
- tagged_out_memory.append("false");
- end;
- end;
-
- to_string: STRING is
- do
- if Current.item then
- Result := "true";
- else
- Result := "false";
- end;
- end;
-
- to_integer: INTEGER is
- do
- if Current.item then
- Result := 1;
- else
- Result := 0;
- end;
- end;
-
- end -- BOOLEAN_REF
-