diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/FaultTreeBuilder.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/FaultTreeBuilder.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/FaultTreeBuilder.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/FaultTreeBuilder.java new file mode 100644 index 00000000..9b2dfd76 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/cft2ft/FaultTreeBuilder.java | |||
@@ -0,0 +1,57 @@ | |||
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.ft.FaultTree; | ||
5 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.FtFactory; | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.Gate; | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.ft.RandomEvent; | ||
8 | import java.util.Collection; | ||
9 | import org.eclipse.emf.common.util.EList; | ||
10 | import org.eclipse.emf.ecore.EObject; | ||
11 | import org.eclipse.xtend.lib.annotations.Accessors; | ||
12 | import org.eclipse.xtext.xbase.lib.Pure; | ||
13 | |||
14 | @SuppressWarnings("all") | ||
15 | public class FaultTreeBuilder { | ||
16 | @Accessors | ||
17 | private final FaultTree faultTree = FtFactory.eINSTANCE.createFaultTree(); | ||
18 | |||
19 | public void addTopLevel(final RandomEvent event) { | ||
20 | RandomEvent _topEvent = this.faultTree.getTopEvent(); | ||
21 | boolean _tripleNotEquals = (_topEvent != null); | ||
22 | if (_tripleNotEquals) { | ||
23 | throw new IllegalStateException("Top event was already set"); | ||
24 | } | ||
25 | this.add(event); | ||
26 | this.faultTree.setTopEvent(event); | ||
27 | } | ||
28 | |||
29 | protected void add(final RandomEvent event) { | ||
30 | EObject _eContainer = this.faultTree.eContainer(); | ||
31 | boolean _equals = Objects.equal(_eContainer, this.faultTree); | ||
32 | if (_equals) { | ||
33 | return; | ||
34 | } | ||
35 | EObject _eContainer_1 = this.faultTree.eContainer(); | ||
36 | boolean _tripleNotEquals = (_eContainer_1 != null); | ||
37 | if (_tripleNotEquals) { | ||
38 | throw new IllegalStateException("Event is already in a different fault tree"); | ||
39 | } | ||
40 | EList<RandomEvent> _events = this.faultTree.getEvents(); | ||
41 | _events.add(event); | ||
42 | if ((event instanceof Gate)) { | ||
43 | this.addAll(((Gate)event).getInputEvents()); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | protected void addAll(final Collection<RandomEvent> events) { | ||
48 | for (final RandomEvent event : events) { | ||
49 | this.add(event); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | @Pure | ||
54 | public FaultTree getFaultTree() { | ||
55 | return this.faultTree; | ||
56 | } | ||
57 | } | ||