/src/lib/design_patterns/macro_command.e

http://github.com/tybor/Liberty · Specman e · 71 lines · 38 code · 7 blank · 26 comment · 0 complexity · a527d81c68d64febb16a120737d7b569 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class MACRO_COMMAND[C_ -> COMMAND]
  5. --
  6. -- A very useful kind of Command: that's a bunch of commands to be executed at once.
  7. --
  8. inherit
  9. COMMAND
  10. undefine fill_tagged_out_memory, out_in_tagged_out_memory, default_create
  11. redefine copy, is_equal
  12. end
  13. COLLECTION[C_]
  14. undefine default_create, out_in_tagged_out_memory
  15. end
  16. insert
  17. FAST_ARRAY[C_]
  18. redefine copy, is_equal
  19. end
  20. create {ANY}
  21. make, with_capacity
  22. feature {ANY}
  23. execute
  24. local
  25. i: INTEGER
  26. do
  27. from
  28. i := lower
  29. until
  30. i > upper
  31. loop
  32. item(i).execute
  33. i := i + 1
  34. end
  35. end
  36. copy (other: like Current)
  37. do
  38. Precursor {FAST_ARRAY} (other)
  39. end
  40. is_equal (other: like Current): BOOLEAN
  41. do
  42. Result := Precursor {FAST_ARRAY} (other)
  43. end
  44. end -- class MACRO_COMMAND
  45. --
  46. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  47. --
  48. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  49. -- of this software and associated documentation files (the "Software"), to deal
  50. -- in the Software without restriction, including without limitation the rights
  51. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  52. -- copies of the Software, and to permit persons to whom the Software is
  53. -- furnished to do so, subject to the following conditions:
  54. --
  55. -- The above copyright notice and this permission notice shall be included in
  56. -- all copies or substantial portions of the Software.
  57. --
  58. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  59. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  60. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  61. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  62. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  63. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  64. -- THE SOFTWARE.