PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/tools/configuration/etc/liberty_etc_needs.e

http://github.com/tybor/Liberty
Specman e | 73 lines | 50 code | 9 blank | 14 comment | 2 complexity | eae372ec782e6248310f1fa5f68f67ee 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_ETC_NEEDS
16
17create {LIBERTY_ETC_VISITOR_IMPL}
18   make
19
20feature {ANY}
21   cluster: LIBERTY_ETC_CLUSTER
22
23feature {LIBERTY_ETC_CLUSTER}
24   check_validity (all_clusters: MAP[LIBERTY_ETC_CLUSTER, FIXED_STRING]) is
25      require
26         all_clusters /= Void
27      do
28         if cluster = Void then
29            cluster := all_clusters.fast_reference_at(cluster_name)
30            if cluster = Void then
31               std_error.put_line("Unknown cluster: " + cluster_name)
32               die_with_code(1)
33            end
34         else
35            check
36               cluster = all_clusters.fast_at(cluster_name)
37            end
38         end
39         constraints.do_all(agent {LIBERTY_ETC_CONSTRAINT}.check_validity(cluster))
40      end
41
42   in_cycle: BOOLEAN
43
44   set_in_cycle is
45      do
46         in_cycle := True
47      ensure
48         in_cycle
49      end
50
51feature {}
52   make (a_cluster_name: like cluster_name; a_cluster: like cluster; a_constraints: like constraints) is
53      require
54         a_cluster_name /= Void
55         a_constraints /= Void
56      do
57         cluster_name := a_cluster_name
58         cluster := a_cluster
59         constraints := a_constraints
60      ensure
61         cluster_name = a_cluster_name
62         cluster = a_cluster
63         constraints = a_constraints
64      end
65
66   cluster_name: FIXED_STRING
67   constraints: TRAVERSABLE[LIBERTY_ETC_CONSTRAINT]
68
69invariant
70   cluster_name /= Void
71   constraints /= Void
72
73end -- class LIBERTY_ETC_NEEDS