PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/interpreter/liberty_interpreter_tuple.e

http://github.com/tybor/Liberty
Specman e | 182 lines | 139 code | 29 blank | 14 comment | 0 complexity | 820c66d0e4e375bd199b87ac5d87ee5f MD5 | raw file
  1-- This file is part of Liberty Eiffel.
  2--
  3-- Liberty Eiffel is free software: you can redistribute it and/or modify
  4-- it under the terms of the GNU General Public License as published by
  5-- the Free Software Foundation, version 3 of the License.
  6--
  7-- Liberty Eiffel is distributed in the hope that it will be useful,
  8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10-- GNU General Public License for more details.
 11--
 12-- You should have received a copy of the GNU General Public License
 13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
 14--
 15class LIBERTY_INTERPRETER_TUPLE
 16
 17inherit
 18   LIBERTY_INTERPRETER_OBJECT
 19   TRAVERSABLE[LIBERTY_INTERPRETER_OBJECT]
 20
 21creation {LIBERTY_INTERPRETER_OBJECT_CREATOR}
 22   make
 23
 24feature {ANY}
 25   lower: INTEGER is
 26      do
 27         Result := tuple.lower
 28      end
 29
 30   upper: INTEGER is
 31      do
 32         Result := tuple.upper
 33      end
 34
 35   count: INTEGER is
 36      do
 37         Result := tuple.count
 38      end
 39
 40   is_empty: BOOLEAN is
 41      do
 42         Result := tuple.is_empty
 43      end
 44
 45   first: LIBERTY_INTERPRETER_OBJECT is
 46      do
 47         Result := tuple.first
 48      end
 49
 50   last: LIBERTY_INTERPRETER_OBJECT is
 51      do
 52         Result := tuple.last
 53      end
 54
 55   item (i: INTEGER): LIBERTY_INTERPRETER_OBJECT is
 56      do
 57         Result := tuple.item(i)
 58      end
 59
 60   new_iterator: ITERATOR[LIBERTY_INTERPRETER_OBJECT] is
 61      do
 62         Result := tuple.new_iterator
 63      end
 64
 65feature {ANY}
 66   type: LIBERTY_ACTUAL_TYPE
 67
 68   converted_to (target_type: LIBERTY_ACTUAL_TYPE): LIBERTY_INTERPRETER_OBJECT is
 69      do
 70         not_yet_implemented
 71      end
 72
 73   hash_code: INTEGER is
 74      do
 75         Result := to_pointer.hash_code
 76      end
 77
 78feature {LIBERTY_INTERPRETER_EXTERNAL_TYPE_ANY_BUILTINS} -- Standard builtings
 79   builtin_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
 80      do
 81         not_yet_implemented
 82      end
 83
 84   builtin_standard_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
 85      do
 86         not_yet_implemented
 87      end
 88
 89   builtin_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
 90      do
 91         not_yet_implemented
 92      end
 93
 94   builtin_twin (a_position: LIBERTY_POSITION): like Current is
 95      do
 96         not_yet_implemented
 97      end
 98
 99   builtin_standard_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
100      do
101         not_yet_implemented
102      end
103
104   builtin_standard_twin (a_position: LIBERTY_POSITION): like Current is
105      do
106         not_yet_implemented
107      end
108
109feature {LIBERTY_INTERPRETER_OBJECT}
110   do_deep_twin (deep_twin_memory: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): LIBERTY_INTERPRETER_OBJECT is
111      do
112         not_yet_implemented
113      end
114
115   do_deep_equal (object: LIBERTY_INTERPRETER_OBJECT; deep_equal_memory: SET[LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): BOOLEAN is
116      do
117         not_yet_implemented
118      end
119
120feature {LIBERTY_INTERPRETER_OBJECT_PRINTER, LIBERTY_INTERPRETER_FEATURE_CALL}
121   show_stack (o: OUTPUT_STREAM; indent: INTEGER) is
122      local
123         i: INTEGER
124      do
125         o.put_character('{')
126         o.put_string(type.full_name)
127         o.put_line(once " [")
128         from
129            i := tuple.lower
130         until
131            i > tuple.upper
132         loop
133            interpreter.object_printer.put_indent(o, indent + 1)
134            interpreter.object_printer.print_object(o, tuple.item(i), indent + 1)
135            i := i + 1
136         end
137         interpreter.object_printer.put_indent(o, indent)
138         o.put_line(once "] }")
139      end
140
141feature {}
142   expanded_twin: like Current is
143      do
144         check False end
145      end
146
147feature {LIBERTY_INTERPRETER_EXPRESSIONS}
148   ensure_capacity (capacity: INTEGER) is
149      do
150         tuple.with_capacity(capacity)
151      ensure
152         tuple.capacity >= capacity
153      end
154
155   add_last (a_object: LIBERTY_INTERPRETER_OBJECT) is
156      do
157         tuple.add_last(a_object)
158      end
159
160feature {}
161   make (a_interpreter: like interpreter; a_type: like type; a_position: like position) is
162      require
163         a_interpreter /= Void
164         a_type /= Void
165         a_position /= Void
166      do
167         interpreter := a_interpreter
168         type := a_type
169         position := a_position
170         create tuple.with_capacity(0)
171      ensure
172         interpreter = a_interpreter
173         type = a_type
174         position = a_position
175      end
176
177   tuple: FAST_ARRAY[LIBERTY_INTERPRETER_OBJECT]
178
179invariant
180   tuple /= Void
181
182end -- class LIBERTY_INTERPRETER_TUPLE