diff options
author | 2019-08-01 14:49:53 +0200 | |
---|---|---|
committer | 2019-08-01 14:49:53 +0200 | |
commit | 972baab642bd889d2c3476c0c9e17a6929e0c318 (patch) | |
tree | 8f724cb348c60e4fc45d446d8532988ed8e40748 /Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java | |
parent | Counting scope propagator (simpler than BasicTypeHierarchy) (diff) | |
download | VIATRA-Generator-972baab642bd889d2c3476c0c9e17a6929e0c318.tar.gz VIATRA-Generator-972baab642bd889d2c3476c0c9e17a6929e0c318.tar.zst VIATRA-Generator-972baab642bd889d2c3476c0c9e17a6929e0c318.zip |
[Stochastic] Remove fault tree support for now
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java | 188 |
1 files changed, 0 insertions, 188 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java deleted file mode 100644 index 8748825d..00000000 --- a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ft2galileo/Ft2GalileoTransformation.java +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.transformation.ft2galileo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.AndGate; | ||
4 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.BasicEvent; | ||
5 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.ConstantDistribution; | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Distribution; | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.ExponentialDistribution; | ||
8 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.FaultTree; | ||
9 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Gate; | ||
10 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.KOfMGate; | ||
11 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.OrGate; | ||
12 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.RandomEvent; | ||
13 | import java.util.Arrays; | ||
14 | import org.eclipse.emf.common.util.EList; | ||
15 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
16 | import org.eclipse.xtend2.lib.StringConcatenationClient; | ||
17 | |||
18 | @SuppressWarnings("all") | ||
19 | public class Ft2GalileoTransformation { | ||
20 | public CharSequence toGalileo(final FaultTree faultTree) { | ||
21 | StringConcatenation _builder = new StringConcatenation(); | ||
22 | _builder.append("toplevel \""); | ||
23 | String _name = faultTree.getTopEvent().getName(); | ||
24 | _builder.append(_name); | ||
25 | _builder.append("\";"); | ||
26 | _builder.newLineIfNotEmpty(); | ||
27 | { | ||
28 | EList<RandomEvent> _events = faultTree.getEvents(); | ||
29 | for(final RandomEvent event : _events) { | ||
30 | _builder.append("\""); | ||
31 | String _name_1 = event.getName(); | ||
32 | _builder.append(_name_1); | ||
33 | _builder.append("\" "); | ||
34 | Object _defineEvent = this.defineEvent(event); | ||
35 | _builder.append(_defineEvent); | ||
36 | _builder.append(";"); | ||
37 | _builder.newLineIfNotEmpty(); | ||
38 | } | ||
39 | } | ||
40 | return _builder; | ||
41 | } | ||
42 | |||
43 | protected Object _defineEvent(final BasicEvent basicEvent) { | ||
44 | StringConcatenation _builder = new StringConcatenation(); | ||
45 | StringConcatenationClient _defineDistribution = this.defineDistribution(basicEvent.getDistribution()); | ||
46 | _builder.append(_defineDistribution); | ||
47 | _builder.append(" dorm=0.0"); | ||
48 | return _builder; | ||
49 | } | ||
50 | |||
51 | protected StringConcatenationClient _defineDistribution(final ConstantDistribution distribution) { | ||
52 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
53 | @Override | ||
54 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
55 | _builder.append("p="); | ||
56 | double _p = distribution.getP(); | ||
57 | _builder.append(_p); | ||
58 | } | ||
59 | }; | ||
60 | return _client; | ||
61 | } | ||
62 | |||
63 | protected StringConcatenationClient _defineDistribution(final ExponentialDistribution distribution) { | ||
64 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
65 | @Override | ||
66 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
67 | _builder.append("lambda="); | ||
68 | double _lambda = distribution.getLambda(); | ||
69 | _builder.append(_lambda); | ||
70 | } | ||
71 | }; | ||
72 | return _client; | ||
73 | } | ||
74 | |||
75 | protected StringConcatenationClient _defineDistribution(final Distribution distribution) { | ||
76 | throw new IllegalArgumentException(("Unknown distribution: " + distribution)); | ||
77 | } | ||
78 | |||
79 | protected StringConcatenationClient _defineEvent(final Gate gate) { | ||
80 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
81 | @Override | ||
82 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
83 | StringConcatenationClient _defineGate = Ft2GalileoTransformation.this.defineGate(gate); | ||
84 | _builder.append(_defineGate); | ||
85 | _builder.append(" "); | ||
86 | { | ||
87 | EList<RandomEvent> _inputEvents = gate.getInputEvents(); | ||
88 | boolean _hasElements = false; | ||
89 | for(final RandomEvent input : _inputEvents) { | ||
90 | if (!_hasElements) { | ||
91 | _hasElements = true; | ||
92 | } else { | ||
93 | _builder.appendImmediate(" ", ""); | ||
94 | } | ||
95 | _builder.append("\""); | ||
96 | String _name = input.getName(); | ||
97 | _builder.append(_name); | ||
98 | _builder.append("\""); | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | }; | ||
103 | return _client; | ||
104 | } | ||
105 | |||
106 | protected StringConcatenationClient _defineGate(final AndGate gate) { | ||
107 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
108 | @Override | ||
109 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
110 | _builder.append("and"); | ||
111 | } | ||
112 | }; | ||
113 | return _client; | ||
114 | } | ||
115 | |||
116 | protected StringConcatenationClient _defineGate(final OrGate gate) { | ||
117 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
118 | @Override | ||
119 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
120 | _builder.append("or"); | ||
121 | } | ||
122 | }; | ||
123 | return _client; | ||
124 | } | ||
125 | |||
126 | protected StringConcatenationClient _defineGate(final KOfMGate gate) { | ||
127 | StringConcatenationClient _client = new StringConcatenationClient() { | ||
128 | @Override | ||
129 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
130 | int _k = gate.getK(); | ||
131 | _builder.append(_k); | ||
132 | _builder.append("of"); | ||
133 | int _size = gate.getInputEvents().size(); | ||
134 | _builder.append(_size); | ||
135 | } | ||
136 | }; | ||
137 | return _client; | ||
138 | } | ||
139 | |||
140 | protected StringConcatenationClient _defineGate(final Gate gate) { | ||
141 | throw new IllegalArgumentException(("Unknown gate: " + gate)); | ||
142 | } | ||
143 | |||
144 | protected StringConcatenationClient _defineEvent(final RandomEvent randomEvent) { | ||
145 | throw new IllegalArgumentException(("Unknown random even: " + randomEvent)); | ||
146 | } | ||
147 | |||
148 | protected Object defineEvent(final RandomEvent basicEvent) { | ||
149 | if (basicEvent instanceof BasicEvent) { | ||
150 | return _defineEvent((BasicEvent)basicEvent); | ||
151 | } else if (basicEvent instanceof Gate) { | ||
152 | return _defineEvent((Gate)basicEvent); | ||
153 | } else if (basicEvent != null) { | ||
154 | return _defineEvent(basicEvent); | ||
155 | } else { | ||
156 | throw new IllegalArgumentException("Unhandled parameter types: " + | ||
157 | Arrays.<Object>asList(basicEvent).toString()); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | protected StringConcatenationClient defineDistribution(final Distribution distribution) { | ||
162 | if (distribution instanceof ConstantDistribution) { | ||
163 | return _defineDistribution((ConstantDistribution)distribution); | ||
164 | } else if (distribution instanceof ExponentialDistribution) { | ||
165 | return _defineDistribution((ExponentialDistribution)distribution); | ||
166 | } else if (distribution != null) { | ||
167 | return _defineDistribution(distribution); | ||
168 | } else { | ||
169 | throw new IllegalArgumentException("Unhandled parameter types: " + | ||
170 | Arrays.<Object>asList(distribution).toString()); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | protected StringConcatenationClient defineGate(final Gate gate) { | ||
175 | if (gate instanceof AndGate) { | ||
176 | return _defineGate((AndGate)gate); | ||
177 | } else if (gate instanceof KOfMGate) { | ||
178 | return _defineGate((KOfMGate)gate); | ||
179 | } else if (gate instanceof OrGate) { | ||
180 | return _defineGate((OrGate)gate); | ||
181 | } else if (gate != null) { | ||
182 | return _defineGate(gate); | ||
183 | } else { | ||
184 | throw new IllegalArgumentException("Unhandled parameter types: " + | ||
185 | Arrays.<Object>asList(gate).toString()); | ||
186 | } | ||
187 | } | ||
188 | } | ||