diff options
author | 2019-02-16 00:43:11 +0100 | |
---|---|---|
committer | 2019-02-19 19:18:25 +0100 | |
commit | d90bedacaafe87e06fddaa05a6ff9b7b796e97e7 (patch) | |
tree | 3631e27854b40de3bce7606f60113054c77bd391 /Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java | |
parent | Ecore2Cft transformation (diff) | |
download | VIATRA-Generator-d90bedacaafe87e06fddaa05a6ff9b7b796e97e7.tar.gz VIATRA-Generator-d90bedacaafe87e06fddaa05a6ff9b7b796e97e7.tar.zst VIATRA-Generator-d90bedacaafe87e06fddaa05a6ff9b7b796e97e7.zip |
Two-valued fault tree analyzer WIP
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java | 456 |
1 files changed, 456 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java new file mode 100644 index 00000000..70481341 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/EventMaterializer.java | |||
@@ -0,0 +1,456 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.transformation.cft2ft; | ||
2 | |||
3 | import com.google.common.base.Objects; | ||
4 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.AndGateDefinition; | ||
5 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.BasicEventDefinition; | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Component; | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Connection; | ||
8 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.EventDeclaration; | ||
9 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.GateDefinition; | ||
10 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Input; | ||
11 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.InputEvent; | ||
12 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.KOfMGateDefinition; | ||
13 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.OrGateDefinition; | ||
14 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Output; | ||
15 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.AndGate; | ||
16 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.BasicEvent; | ||
17 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.ConstantEvent; | ||
18 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Distribution; | ||
19 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Event; | ||
20 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.FtFactory; | ||
21 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Gate; | ||
22 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.KOfMGate; | ||
23 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.OrGate; | ||
24 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.RandomEvent; | ||
25 | import hu.bme.mit.inf.dslreasoner.faulttree.transformation.cft2ft.EventCollection; | ||
26 | import java.util.LinkedHashSet; | ||
27 | import java.util.Map; | ||
28 | import java.util.function.Function; | ||
29 | import org.eclipse.emf.common.util.EList; | ||
30 | import org.eclipse.emf.ecore.util.EcoreUtil; | ||
31 | import org.eclipse.xtend.lib.annotations.Data; | ||
32 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
33 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
34 | import org.eclipse.xtext.xbase.lib.Extension; | ||
35 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
36 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
37 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | ||
38 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | ||
39 | import org.eclipse.xtext.xbase.lib.Pure; | ||
40 | |||
41 | @SuppressWarnings("all") | ||
42 | public class EventMaterializer { | ||
43 | @Data | ||
44 | protected static class EventKey<T extends EventDeclaration> { | ||
45 | private final Component component; | ||
46 | |||
47 | private final T event; | ||
48 | |||
49 | @Override | ||
50 | public String toString() { | ||
51 | StringConcatenation _builder = new StringConcatenation(); | ||
52 | String _name = this.component.getName(); | ||
53 | _builder.append(_name); | ||
54 | _builder.append("_"); | ||
55 | String _name_1 = this.event.getName(); | ||
56 | _builder.append(_name_1); | ||
57 | return _builder.toString(); | ||
58 | } | ||
59 | |||
60 | public EventKey(final Component component, final T event) { | ||
61 | super(); | ||
62 | this.component = component; | ||
63 | this.event = event; | ||
64 | } | ||
65 | |||
66 | @Override | ||
67 | @Pure | ||
68 | public int hashCode() { | ||
69 | final int prime = 31; | ||
70 | int result = 1; | ||
71 | result = prime * result + ((this.component== null) ? 0 : this.component.hashCode()); | ||
72 | return prime * result + ((this.event== null) ? 0 : this.event.hashCode()); | ||
73 | } | ||
74 | |||
75 | @Override | ||
76 | @Pure | ||
77 | public boolean equals(final Object obj) { | ||
78 | if (this == obj) | ||
79 | return true; | ||
80 | if (obj == null) | ||
81 | return false; | ||
82 | if (getClass() != obj.getClass()) | ||
83 | return false; | ||
84 | EventMaterializer.EventKey<?> other = (EventMaterializer.EventKey<?>) obj; | ||
85 | if (this.component == null) { | ||
86 | if (other.component != null) | ||
87 | return false; | ||
88 | } else if (!this.component.equals(other.component)) | ||
89 | return false; | ||
90 | if (this.event == null) { | ||
91 | if (other.event != null) | ||
92 | return false; | ||
93 | } else if (!this.event.equals(other.event)) | ||
94 | return false; | ||
95 | return true; | ||
96 | } | ||
97 | |||
98 | @Pure | ||
99 | public Component getComponent() { | ||
100 | return this.component; | ||
101 | } | ||
102 | |||
103 | @Pure | ||
104 | public T getEvent() { | ||
105 | return this.event; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | @Extension | ||
110 | private final FtFactory _ftFactory = FtFactory.eINSTANCE; | ||
111 | |||
112 | private final Map<EventMaterializer.EventKey<EventDeclaration>, Event> materializationCache = CollectionLiterals.<EventMaterializer.EventKey<EventDeclaration>, Event>newHashMap(); | ||
113 | |||
114 | private final Map<EventMaterializer.EventKey<InputEvent>, EventCollection> multipleInputCache = CollectionLiterals.<EventMaterializer.EventKey<InputEvent>, EventCollection>newHashMap(); | ||
115 | |||
116 | private final ConstantEvent falseEvent; | ||
117 | |||
118 | private final ConstantEvent trueEvent; | ||
119 | |||
120 | private final LinkedHashSet<EventMaterializer.EventKey<? extends EventDeclaration>> path = new LinkedHashSet<EventMaterializer.EventKey<? extends EventDeclaration>>(); | ||
121 | |||
122 | public EventMaterializer() { | ||
123 | ConstantEvent _createConstantEvent = this._ftFactory.createConstantEvent(); | ||
124 | final Procedure1<ConstantEvent> _function = (ConstantEvent it) -> { | ||
125 | it.setFailed(false); | ||
126 | }; | ||
127 | ConstantEvent _doubleArrow = ObjectExtensions.<ConstantEvent>operator_doubleArrow(_createConstantEvent, _function); | ||
128 | this.falseEvent = _doubleArrow; | ||
129 | ConstantEvent _createConstantEvent_1 = this._ftFactory.createConstantEvent(); | ||
130 | final Procedure1<ConstantEvent> _function_1 = (ConstantEvent it) -> { | ||
131 | it.setFailed(true); | ||
132 | }; | ||
133 | ConstantEvent _doubleArrow_1 = ObjectExtensions.<ConstantEvent>operator_doubleArrow(_createConstantEvent_1, _function_1); | ||
134 | this.trueEvent = _doubleArrow_1; | ||
135 | } | ||
136 | |||
137 | public Event getOrMaterialize(final Output output) { | ||
138 | return this.getOrMaterialize(output.getComponent(), output.getEventDeclaration()); | ||
139 | } | ||
140 | |||
141 | public Event getOrMaterialize(final Component component, final EventDeclaration eventDeclaration) { | ||
142 | Event _xblockexpression = null; | ||
143 | { | ||
144 | final EventMaterializer.EventKey<EventDeclaration> eventKey = new EventMaterializer.EventKey<EventDeclaration>(component, eventDeclaration); | ||
145 | this.pushEventKey(eventKey); | ||
146 | Event _xtrycatchfinallyexpression = null; | ||
147 | try { | ||
148 | final Function<EventMaterializer.EventKey<EventDeclaration>, Event> _function = (EventMaterializer.EventKey<EventDeclaration> it) -> { | ||
149 | return this.materialize(it.component, it.event); | ||
150 | }; | ||
151 | _xtrycatchfinallyexpression = this.materializationCache.computeIfAbsent(eventKey, _function); | ||
152 | } finally { | ||
153 | this.popEventKey(eventKey); | ||
154 | } | ||
155 | _xblockexpression = _xtrycatchfinallyexpression; | ||
156 | } | ||
157 | return _xblockexpression; | ||
158 | } | ||
159 | |||
160 | protected Event materialize(final Component component, final EventDeclaration eventDeclaration) { | ||
161 | RandomEvent _xblockexpression = null; | ||
162 | { | ||
163 | String _name = component.getName(); | ||
164 | String _plus = (_name + "_"); | ||
165 | String _name_1 = eventDeclaration.getName(); | ||
166 | final String eventName = (_plus + _name_1); | ||
167 | RandomEvent _switchResult = null; | ||
168 | boolean _matched = false; | ||
169 | if (eventDeclaration instanceof InputEvent) { | ||
170 | _matched=true; | ||
171 | return this.materializeConnectedEvent(component, ((InputEvent)eventDeclaration)); | ||
172 | } | ||
173 | if (!_matched) { | ||
174 | if (eventDeclaration instanceof BasicEventDefinition) { | ||
175 | _matched=true; | ||
176 | BasicEvent _xblockexpression_1 = null; | ||
177 | { | ||
178 | final BasicEvent basicEvent = this._ftFactory.createBasicEvent(); | ||
179 | basicEvent.setDistribution(EcoreUtil.<Distribution>copy(((BasicEventDefinition)eventDeclaration).getDistribution())); | ||
180 | _xblockexpression_1 = basicEvent; | ||
181 | } | ||
182 | _switchResult = _xblockexpression_1; | ||
183 | } | ||
184 | } | ||
185 | if (!_matched) { | ||
186 | if (eventDeclaration instanceof GateDefinition) { | ||
187 | _matched=true; | ||
188 | Gate _xblockexpression_1 = null; | ||
189 | { | ||
190 | final EventCollection inputs = this.collectInputs(component, ((GateDefinition)eventDeclaration)); | ||
191 | Gate _switchResult_1 = null; | ||
192 | boolean _matched_1 = false; | ||
193 | if (eventDeclaration instanceof AndGateDefinition) { | ||
194 | _matched_1=true; | ||
195 | AndGate _xifexpression = null; | ||
196 | boolean _containsFalseEvent = inputs.containsFalseEvent(); | ||
197 | if (_containsFalseEvent) { | ||
198 | return this.falseEvent; | ||
199 | } else { | ||
200 | AndGate _xifexpression_1 = null; | ||
201 | boolean _isEmpty = inputs.isEmpty(); | ||
202 | if (_isEmpty) { | ||
203 | return this.trueEvent; | ||
204 | } else { | ||
205 | AndGate _xifexpression_2 = null; | ||
206 | boolean _containsExactlyOneRandomEvent = inputs.containsExactlyOneRandomEvent(); | ||
207 | if (_containsExactlyOneRandomEvent) { | ||
208 | return inputs.toSingleRandomEvent(); | ||
209 | } else { | ||
210 | _xifexpression_2 = this._ftFactory.createAndGate(); | ||
211 | } | ||
212 | _xifexpression_1 = _xifexpression_2; | ||
213 | } | ||
214 | _xifexpression = _xifexpression_1; | ||
215 | } | ||
216 | _switchResult_1 = _xifexpression; | ||
217 | } | ||
218 | if (!_matched_1) { | ||
219 | if (eventDeclaration instanceof OrGateDefinition) { | ||
220 | _matched_1=true; | ||
221 | OrGate _xifexpression = null; | ||
222 | boolean _containsTrueEvent = inputs.containsTrueEvent(); | ||
223 | if (_containsTrueEvent) { | ||
224 | return this.trueEvent; | ||
225 | } else { | ||
226 | OrGate _xifexpression_1 = null; | ||
227 | boolean _isEmpty = inputs.isEmpty(); | ||
228 | if (_isEmpty) { | ||
229 | return this.falseEvent; | ||
230 | } else { | ||
231 | OrGate _xifexpression_2 = null; | ||
232 | boolean _containsExactlyOneRandomEvent = inputs.containsExactlyOneRandomEvent(); | ||
233 | if (_containsExactlyOneRandomEvent) { | ||
234 | return inputs.toSingleRandomEvent(); | ||
235 | } else { | ||
236 | _xifexpression_2 = this._ftFactory.createOrGate(); | ||
237 | } | ||
238 | _xifexpression_1 = _xifexpression_2; | ||
239 | } | ||
240 | _xifexpression = _xifexpression_1; | ||
241 | } | ||
242 | _switchResult_1 = _xifexpression; | ||
243 | } | ||
244 | } | ||
245 | if (!_matched_1) { | ||
246 | if (eventDeclaration instanceof KOfMGateDefinition) { | ||
247 | _matched_1=true; | ||
248 | Gate _xblockexpression_2 = null; | ||
249 | { | ||
250 | int _count = inputs.getCount(); | ||
251 | int _k = ((KOfMGateDefinition)eventDeclaration).getK(); | ||
252 | int _multiply = (_count * _k); | ||
253 | int _m = ((KOfMGateDefinition)eventDeclaration).getM(); | ||
254 | final int requiredTrueInputs = (_multiply / _m); | ||
255 | int _trueEventCount = inputs.getTrueEventCount(); | ||
256 | final int k = (requiredTrueInputs - _trueEventCount); | ||
257 | final int m = inputs.getVariableEventCount(); | ||
258 | Gate _xifexpression = null; | ||
259 | if ((k == 0)) { | ||
260 | return this.trueEvent; | ||
261 | } else { | ||
262 | Gate _xifexpression_1 = null; | ||
263 | if ((k > m)) { | ||
264 | return this.falseEvent; | ||
265 | } else { | ||
266 | Gate _xifexpression_2 = null; | ||
267 | boolean _containsExactlyOneRandomEvent = inputs.containsExactlyOneRandomEvent(); | ||
268 | if (_containsExactlyOneRandomEvent) { | ||
269 | return inputs.toSingleRandomEvent(); | ||
270 | } else { | ||
271 | Gate _xifexpression_3 = null; | ||
272 | if ((k == 1)) { | ||
273 | _xifexpression_3 = this._ftFactory.createOrGate(); | ||
274 | } else { | ||
275 | Gate _xifexpression_4 = null; | ||
276 | if ((k == m)) { | ||
277 | _xifexpression_4 = this._ftFactory.createAndGate(); | ||
278 | } else { | ||
279 | KOfMGate _xblockexpression_3 = null; | ||
280 | { | ||
281 | final KOfMGate kOfMGate = this._ftFactory.createKOfMGate(); | ||
282 | kOfMGate.setK(k); | ||
283 | _xblockexpression_3 = kOfMGate; | ||
284 | } | ||
285 | _xifexpression_4 = _xblockexpression_3; | ||
286 | } | ||
287 | _xifexpression_3 = _xifexpression_4; | ||
288 | } | ||
289 | _xifexpression_2 = _xifexpression_3; | ||
290 | } | ||
291 | _xifexpression_1 = _xifexpression_2; | ||
292 | } | ||
293 | _xifexpression = _xifexpression_1; | ||
294 | } | ||
295 | _xblockexpression_2 = _xifexpression; | ||
296 | } | ||
297 | _switchResult_1 = _xblockexpression_2; | ||
298 | } | ||
299 | } | ||
300 | if (!_matched_1) { | ||
301 | throw new IllegalArgumentException(("Unknown gate definition: " + eventDeclaration)); | ||
302 | } | ||
303 | final Gate gate = _switchResult_1; | ||
304 | gate.getInputEvents().addAll(inputs.getRandomEvents()); | ||
305 | _xblockexpression_1 = gate; | ||
306 | } | ||
307 | _switchResult = _xblockexpression_1; | ||
308 | } | ||
309 | } | ||
310 | if (!_matched) { | ||
311 | throw new IllegalArgumentException(("Unknown event declaration: " + eventDeclaration)); | ||
312 | } | ||
313 | final RandomEvent event = _switchResult; | ||
314 | event.setName(eventName); | ||
315 | _xblockexpression = event; | ||
316 | } | ||
317 | return _xblockexpression; | ||
318 | } | ||
319 | |||
320 | protected Event materializeConnectedEvent(final Component component, final InputEvent inputEvent) { | ||
321 | Event _xblockexpression = null; | ||
322 | { | ||
323 | boolean _isMultiple = inputEvent.isMultiple(); | ||
324 | if (_isMultiple) { | ||
325 | StringConcatenation _builder = new StringConcatenation(); | ||
326 | _builder.append("Cannot materialize multiple nput "); | ||
327 | String _name = component.getName(); | ||
328 | _builder.append(_name); | ||
329 | _builder.append("_"); | ||
330 | String _name_1 = inputEvent.getName(); | ||
331 | _builder.append(_name_1); | ||
332 | throw new IllegalArgumentException(_builder.toString()); | ||
333 | } | ||
334 | final Input input = this.findInput(component, inputEvent); | ||
335 | final EList<Connection> incomingConnections = input.getIncomingConnections(); | ||
336 | int _size = incomingConnections.size(); | ||
337 | boolean _notEquals = (_size != 1); | ||
338 | if (_notEquals) { | ||
339 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
340 | _builder_1.append("Input "); | ||
341 | String _name_2 = component.getName(); | ||
342 | _builder_1.append(_name_2); | ||
343 | _builder_1.append("_"); | ||
344 | String _name_3 = inputEvent.getName(); | ||
345 | _builder_1.append(_name_3); | ||
346 | _builder_1.append(" has "); | ||
347 | int _size_1 = incomingConnections.size(); | ||
348 | _builder_1.append(_size_1); | ||
349 | _builder_1.append(" connections instead of 1"); | ||
350 | throw new IllegalArgumentException(_builder_1.toString()); | ||
351 | } | ||
352 | final Output output = IterableExtensions.<Connection>head(incomingConnections).getOutput(); | ||
353 | _xblockexpression = this.getOrMaterialize(output.getComponent(), output.getEventDeclaration()); | ||
354 | } | ||
355 | return _xblockexpression; | ||
356 | } | ||
357 | |||
358 | protected EventCollection collectInputs(final Component component, final GateDefinition gateDefinition) { | ||
359 | EventCollection _xblockexpression = null; | ||
360 | { | ||
361 | final EventCollection.Builder builder = EventCollection.builder(); | ||
362 | EList<EventDeclaration> _inputEvents = gateDefinition.getInputEvents(); | ||
363 | for (final EventDeclaration inputEventDeclaration : _inputEvents) { | ||
364 | boolean _matched = false; | ||
365 | if (inputEventDeclaration instanceof InputEvent) { | ||
366 | boolean _isMultiple = ((InputEvent)inputEventDeclaration).isMultiple(); | ||
367 | if (_isMultiple) { | ||
368 | _matched=true; | ||
369 | final EventCollection materializedEvents = this.getOrMaterializeConnectedEvents(component, ((InputEvent)inputEventDeclaration)); | ||
370 | builder.addAll(materializedEvents); | ||
371 | } | ||
372 | } | ||
373 | if (!_matched) { | ||
374 | builder.add(this.getOrMaterialize(component, inputEventDeclaration)); | ||
375 | } | ||
376 | } | ||
377 | _xblockexpression = builder.build(); | ||
378 | } | ||
379 | return _xblockexpression; | ||
380 | } | ||
381 | |||
382 | protected EventCollection getOrMaterializeConnectedEvents(final Component component, final InputEvent inputEvent) { | ||
383 | EventCollection _xblockexpression = null; | ||
384 | { | ||
385 | final EventMaterializer.EventKey<InputEvent> inputKey = new EventMaterializer.EventKey<InputEvent>(component, inputEvent); | ||
386 | this.pushEventKey(inputKey); | ||
387 | EventCollection _xtrycatchfinallyexpression = null; | ||
388 | try { | ||
389 | final Function<EventMaterializer.EventKey<InputEvent>, EventCollection> _function = (EventMaterializer.EventKey<InputEvent> it) -> { | ||
390 | return this.materializeConnectedEvents(it.component, it.event); | ||
391 | }; | ||
392 | _xtrycatchfinallyexpression = this.multipleInputCache.computeIfAbsent(inputKey, _function); | ||
393 | } finally { | ||
394 | this.popEventKey(inputKey); | ||
395 | } | ||
396 | _xblockexpression = _xtrycatchfinallyexpression; | ||
397 | } | ||
398 | return _xblockexpression; | ||
399 | } | ||
400 | |||
401 | protected EventCollection materializeConnectedEvents(final Component component, final InputEvent inputEvent) { | ||
402 | EventCollection _xblockexpression = null; | ||
403 | { | ||
404 | final Input input = this.findInput(component, inputEvent); | ||
405 | final EventCollection.Builder builder = EventCollection.builder(); | ||
406 | EList<Connection> _incomingConnections = input.getIncomingConnections(); | ||
407 | for (final Connection connection : _incomingConnections) { | ||
408 | { | ||
409 | final Event materializedEvent = this.getOrMaterialize(connection.getOutput()); | ||
410 | builder.add(materializedEvent); | ||
411 | } | ||
412 | } | ||
413 | _xblockexpression = builder.build(); | ||
414 | } | ||
415 | return _xblockexpression; | ||
416 | } | ||
417 | |||
418 | protected Input findInput(final Component component, final InputEvent inputEvent) { | ||
419 | final Function1<Input, Boolean> _function = (Input it) -> { | ||
420 | InputEvent _inputEvent = it.getInputEvent(); | ||
421 | return Boolean.valueOf(Objects.equal(_inputEvent, inputEvent)); | ||
422 | }; | ||
423 | final Input input = IterableExtensions.<Input>findFirst(component.getInputs(), _function); | ||
424 | if ((input == null)) { | ||
425 | StringConcatenation _builder = new StringConcatenation(); | ||
426 | _builder.append("No input "); | ||
427 | _builder.append(inputEvent); | ||
428 | _builder.append(" in component "); | ||
429 | _builder.append(component); | ||
430 | throw new IllegalArgumentException(_builder.toString()); | ||
431 | } | ||
432 | return input; | ||
433 | } | ||
434 | |||
435 | private void pushEventKey(final EventMaterializer.EventKey<? extends EventDeclaration> eventKey) { | ||
436 | boolean _add = this.path.add(eventKey); | ||
437 | boolean _not = (!_add); | ||
438 | if (_not) { | ||
439 | StringConcatenation _builder = new StringConcatenation(); | ||
440 | _builder.append("Circular dependency ["); | ||
441 | { | ||
442 | for(final EventMaterializer.EventKey<? extends EventDeclaration> ancestor : this.path) { | ||
443 | _builder.append(ancestor); | ||
444 | _builder.append(", "); | ||
445 | } | ||
446 | } | ||
447 | _builder.append(eventKey); | ||
448 | _builder.append("] detected"); | ||
449 | throw new IllegalStateException(_builder.toString()); | ||
450 | } | ||
451 | } | ||
452 | |||
453 | private boolean popEventKey(final EventMaterializer.EventKey<? extends EventDeclaration> eventKey) { | ||
454 | return this.path.remove(eventKey); | ||
455 | } | ||
456 | } | ||