/test/language/unclassified/uw/aux_uw01animal_node.e

http://github.com/tybor/Liberty · Specman e · 85 lines · 52 code · 9 blank · 24 comment · 0 complexity · d30d3de705dd0cb3f4bd309baad07964 MD5 · raw file

  1. note
  2. description:
  3. "nodes representing animals"
  4. status:
  5. "See notice at end of class"
  6. author:
  7. "Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>"
  8. version:
  9. "$Revision$"
  10. last_modification:
  11. "$Date$"
  12. class AUX_UW01ANIMAL_NODE
  13. inherit
  14. AUX_UW01YES_NO_NODE
  15. rename make_full as make_full_yes_no,
  16. make_simple as make_simple_yes_no,
  17. description as name
  18. redefine yes_action, no_action
  19. end
  20. create {ANY}
  21. make_simple, make_full
  22. feature {ANY}
  23. make_simple (nam: STRING)
  24. -- set up node with name `nam'
  25. require
  26. good_name: nam /= Void and then nam.count > 0
  27. do
  28. make_simple_yes_no(nam)
  29. end
  30. make_full (y, n, p: AUX_UW01YES_NO_NODE; nam: STRING)
  31. -- set up node with name `nam', yes link `y',
  32. -- no link `n', and parent `p'
  33. require
  34. good_name: nam /= Void and then nam.count > 0
  35. do
  36. make_full_yes_no(y, n, p, nam)
  37. end
  38. execute
  39. -- perform action
  40. do
  41. extra_io.print_multi({ARRAY[STRING] 1, << language.s4, name, language.s5 >> })
  42. end
  43. yes_action
  44. -- the animal has been guessed correctly
  45. do
  46. io.put_string(language.s2)
  47. end
  48. no_action
  49. -- the animal is unknown
  50. do
  51. io.put_string(language.s3)
  52. end
  53. read_answer
  54. -- ask question about animal
  55. do
  56. extra_io.read_yes_no(language.s6)
  57. last_answer := extra_io.last_boolean
  58. end
  59. end -- class AUX_UW01ANIMAL_NODE
  60. -- Copyright (C) 1998-2017: by Ulrich Windl
  61. -- Copyright (C) 1998-2017: by Klinikum der Universität Regensburg,
  62. -- D-93042 Regensburg
  63. --
  64. -- This program is free software; you can redistribute it and/or modify
  65. -- it under the terms of the GNU General Public License as published by
  66. -- the Free Software Foundation; either version 2 of the License, or
  67. -- (at your option) any later version.
  68. --
  69. -- This program is distributed in the hope that it will be useful,
  70. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  71. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  72. -- GNU General Public License for more details.
  73. --
  74. -- You should have received a copy of the GNU General Public License
  75. -- along with this program; if not, write to the Free Software
  76. -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA