home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_std / counter.e < prev    next >
Text File  |  1999-06-05  |  1KB  |  45 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 COUNTER
  13.  
  14. feature
  15.  
  16.    value: INTEGER;
  17.  
  18.    increment is
  19.       do
  20.          value := value + 1;
  21.       ensure
  22.          value = 1 + old value
  23.       end;
  24.  
  25.    decrement is
  26.       do
  27.          value := value - 1;
  28.       ensure
  29.          value + 1 = old value
  30.       end;
  31.  
  32.    reset is
  33.       do
  34.          value := 0;
  35.       ensure
  36.          value = 0
  37.       end;
  38.  
  39.    append_in(str: STRING) is
  40.       do
  41.          value.append_in(str);
  42.       end;
  43.  
  44. end -- COUNTER
  45.