/src/tools/semantics/code/liberty_clients.e
Specman e | 97 lines | 69 code | 14 blank | 14 comment | 0 complexity | 4a42fc8b3b3ed20e5bf7c55f47ff7e35 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_CLIENTS 16 17inherit 18 LIBERTY_AST_CLIENT_VISITOR 19 TRAVERSABLE[LIBERTY_ACTUAL_TYPE] 20 21create {LIBERTY_BUILDER_TOOLS} 22 make 23 24feature {ANY} 25 lower: INTEGER is 26 do 27 Result := clients.lower 28 end 29 30 upper: INTEGER is 31 do 32 Result := clients.upper 33 end 34 35 count: INTEGER is 36 do 37 Result := clients.count 38 end 39 40 is_empty: BOOLEAN is 41 do 42 Result := clients.is_empty 43 end 44 45 item (i: INTEGER): LIBERTY_ACTUAL_TYPE is 46 do 47 Result := clients.item(i) 48 end 49 50 first: like item is 51 do 52 Result := clients.first 53 end 54 55 last: like item is 56 do 57 Result := clients.last 58 end 59 60 new_iterator: ITERATOR[LIBERTY_ACTUAL_TYPE] is 61 do 62 Result := clients.new_iterator 63 end 64 65feature {LIBERTY_AST_CLIENT} 66 visit_liberty_ast_client (v: LIBERTY_AST_CLIENT) is 67 do 68 clients.add_last(type_lookup.resolver.get_export_type(v.type_definition) 69 end 70 71feature {} 72 make (a_origin: like origin; a_clients: TRAVERSABLE[LIBERTY_AST_CLASS_NAME]; a_universe: like universe) is 73 require 74 a_clients /= Void 75 a_universe /= Void 76 local 77 i: INTEGER 78 do 79 universe := a_universe 80 create {FAST_ARRAY[LIBERTY_ACTUAL_TYPE]} clients.with_capacity(clients.count) 81 from 82 i := a_clients.lower 83 until 84 i > a_clients.upper 85 loop 86 a_clients.item(i).accept(Current) 87 i := i + 1 88 end 89 ensure 90 clients.count = a_clients.count 91 end 92 93 origin: LIBERTY_ACTUAL_TYPE 94 clients: COLLECTION[LIBERTY_ACTUAL_TYPE] 95 universe: LIBERTY_UNIVERSE 96 97end