home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / eiffel / smalleif.97 / se.t / SmallEiffel / lib_std / boolean.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.5 KB  |  77 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. expanded class BOOLEAN
  5. --
  6. -- Note : corresponding C type is "int"
  7. --
  8. inherit
  9.    BOOLEAN_REF
  10.       redefine
  11.      infix "and", infix "and then", infix "or",
  12.      infix "or else", infix "implies", infix "xor",
  13.      prefix "not", to_string, to_integer
  14.       end;
  15.  
  16. feature {ANY}
  17.  
  18.    infix "and" (other: BOOLEAN): BOOLEAN is
  19.      -- `and' of Current with `other'.
  20.       external "CSE"
  21.       end;
  22.  
  23.    infix "and then" (other: BOOLEAN): BOOLEAN is
  24.      -- Semi-strict `and' of Current with `other'.
  25.       external "CSE"
  26.       end;
  27.  
  28.    infix "implies"(other: BOOLEAN): BOOLEAN is
  29.      -- Does Current imply `other'.
  30.       external "CSE"
  31.       end;
  32.  
  33.    infix "or" (other: BOOLEAN): BOOLEAN is
  34.      -- `or' of Current with `other'
  35.       external "CSE"
  36.       end;
  37.  
  38.    infix "or else" (other: BOOLEAN): BOOLEAN is
  39.      -- Semi-strict `or' of Current with `other'
  40.       external "CSE"
  41.       end;
  42.  
  43.    infix "xor" (other: BOOLEAN): BOOLEAN is
  44.      -- `xor' of Current with `other'
  45.       do
  46.      if Current then
  47.         Result := not other;
  48.      else
  49.         Result := other;
  50.      end;
  51.       end;
  52.  
  53.    prefix "not": BOOLEAN is
  54.      -- `not' of Current.
  55.       external "CSE"
  56.       end;
  57.  
  58.    to_string: STRING is
  59.       do
  60.          if Current then
  61.             Result := "true";
  62.          else
  63.             Result := "false";
  64.          end;
  65.       end;
  66.  
  67.    to_integer: INTEGER is
  68.       do
  69.      if Current then
  70.         Result := 1;
  71.      else
  72.         Result := 0;
  73.      end;
  74.       end;
  75.  
  76. end -- BOOLEAN
  77.