home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_std / boolean_ref.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  100 lines

  1. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  2. -- software  is  distributed  in the hope that it will be useful, but WITHOUT 
  3. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  4. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  5. -- this header is kept unaltered, and a notification of the changes is added.
  6. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of 
  7. -- another product.
  8. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  9. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  10. --                       http://SmallEiffel.loria.fr
  11. --
  12. class BOOLEAN_REF
  13.    
  14. inherit 
  15.    ANY 
  16.       redefine out_in_tagged_out_memory, fill_tagged_out_memory
  17.       end;
  18.    
  19. creation make
  20.  
  21. feature 
  22.  
  23.    item: BOOLEAN;      
  24.          -- Value of Current
  25.  
  26.    make(value: BOOLEAN) is
  27.          -- Initialize object
  28.       do  
  29.          item := value
  30.       end;
  31.  
  32. feature
  33.    
  34.    set_item(value: like item) is
  35.       do
  36.          item := value;
  37.       end;
  38.  
  39.    infix "and" (other : like Current) : like Current is
  40.          -- `and' of Current with `other'.
  41.       require
  42.          other /= Void
  43.       do
  44.          !!Result.make (item and other.item)
  45.       end;
  46.  
  47.    infix "and then" (other : like Current) : like Current is
  48.          -- Semi-strict `and' of Current with `other'.
  49.       require
  50.          other /= Void
  51.       do
  52.          !!Result.make (item and then other.item)
  53.       end;
  54.  
  55.    infix "implies" (other : like Current) : like Current is
  56.          -- Does Current imply `other'.
  57.       require
  58.          other /= Void
  59.       do
  60.          !!Result.make (item implies other.item)
  61.       end;
  62.  
  63.    infix "or" (other : like Current) : like Current is
  64.          -- `or' of Current with `other'
  65.       require
  66.          other_not_void : other /= Void
  67.       do
  68.          !!Result.make (item or other.item)
  69.       end;
  70.  
  71.    infix "or else" (other : like Current) : like Current is
  72.          -- Semi-strict `or' of Current with `other'
  73.       require
  74.          other_not_void : other /= Void
  75.       do
  76.          !!Result.make (item or else other.item)
  77.       end;
  78.  
  79.    infix "xor" (other: like Current): like Current is
  80.          -- `xor' of Current with `other'
  81.       require
  82.          other /= Void
  83.       do
  84.          !!Result.make (item xor other.item)
  85.       end;
  86.  
  87.    prefix "not": like Current is
  88.          -- `not' of Current.
  89.       do
  90.          !!Result.make(not item)
  91.       end;
  92.  
  93.    out_in_tagged_out_memory, fill_tagged_out_memory is
  94.       do
  95.          item.fill_tagged_out_memory;
  96.       end;
  97.  
  98. end -- BOOLEAN_REF
  99.  
  100.