/tutorial/backtracking/logigram/item_item.e

http://github.com/tybor/Liberty · Specman e · 54 lines · 28 code · 8 blank · 18 comment · 1 complexity · bfd9b55ebc59e9b25e92d0e632fbf915 MD5 · raw file

  1. -- See the Copyright notice at the end of this file.
  2. --
  3. class ITEM_ITEM
  4. inherit
  5. ITEM
  6. creation {ANY}
  7. make
  8. feature {ANY}
  9. index: INTEGER
  10. to_integer: INTEGER is
  11. do
  12. Result := value
  13. end
  14. make (the_group: like group; the_name: like name; the_index: like index) is
  15. require
  16. the_group.is_numeric implies the_name.is_integer
  17. do
  18. group := the_group
  19. name := the_name
  20. index := the_index
  21. if group.is_numeric then
  22. value := name.to_integer
  23. elseif group.is_ordered then
  24. value := the_index
  25. end
  26. end
  27. is_off: BOOLEAN is False
  28. feature {}
  29. value: INTEGER
  30. end -- class ITEM_ITEM
  31. --
  32. -- ------------------------------------------------------------------------------------------------------------------------------
  33. -- Copyright notice below. Please read.
  34. --
  35. -- This file is free software, which comes along with SmartEiffel. This software is distributed in the hope that it will be
  36. -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  37. -- You can modify it as you want, provided this footer is kept unaltered, and a notification of the changes is added.
  38. -- You are allowed to redistribute it and sell it, alone or as a part of another product.
  39. --
  40. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  41. -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  42. --
  43. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  44. --
  45. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  46. -- ------------------------------------------------------------------------------------------------------------------------------