diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.java | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.java deleted file mode 100644 index 4034bdf3..00000000 --- a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.java +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.transformation.ecore2cft; | ||
2 | |||
3 | import com.google.common.collect.Maps; | ||
4 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.CftFactory; | ||
5 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Component; | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ComponentDefinition; | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ComponentFaultTree; | ||
8 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.EventDeclaration; | ||
9 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.InputEvent; | ||
10 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Modality; | ||
11 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Output; | ||
12 | import hu.bme.mit.inf.dslreasoner.faulttree.model.util.CftExtensions; | ||
13 | import hu.bme.mit.inf.dslreasoner.faulttree.transformation.ecore2cft.ComponentNameGenerator; | ||
14 | import hu.bme.mit.inf.dslreasoner.faulttree.transformation.ecore2cft.InputTrace; | ||
15 | import java.util.Map; | ||
16 | import org.eclipse.emf.common.util.EList; | ||
17 | |||
18 | @SuppressWarnings("all") | ||
19 | public class ComponentInstanceTrace { | ||
20 | private final Component componentInstance = CftFactory.eINSTANCE.createComponent(); | ||
21 | |||
22 | private final Map<InputEvent, InputTrace> inputEventsMap; | ||
23 | |||
24 | private final Map<EventDeclaration, Output> outputEventsMap; | ||
25 | |||
26 | protected ComponentInstanceTrace(final ComponentFaultTree faultTree, final ComponentDefinition componentDefinition, final ComponentNameGenerator nameGenerator, final Modality exists, final boolean multipleAllowed) { | ||
27 | this.componentInstance.setComponentDefinition(componentDefinition); | ||
28 | this.componentInstance.setName(nameGenerator.nextName(componentDefinition)); | ||
29 | this.componentInstance.setExists(exists); | ||
30 | this.componentInstance.setMultipleAllowed(multipleAllowed); | ||
31 | this.inputEventsMap = Maps.<InputEvent, InputTrace>newHashMapWithExpectedSize(componentDefinition.getInputEvents().size()); | ||
32 | EList<InputEvent> _inputEvents = componentDefinition.getInputEvents(); | ||
33 | for (final InputEvent inputEvent : _inputEvents) { | ||
34 | { | ||
35 | final InputTrace inputTrace = new InputTrace(this.componentInstance, inputEvent); | ||
36 | this.inputEventsMap.put(inputEvent, inputTrace); | ||
37 | } | ||
38 | } | ||
39 | this.outputEventsMap = Maps.<EventDeclaration, Output>newHashMapWithExpectedSize(componentDefinition.getOutputEvents().size()); | ||
40 | EList<EventDeclaration> _outputEvents = componentDefinition.getOutputEvents(); | ||
41 | for (final EventDeclaration outputEvent : _outputEvents) { | ||
42 | { | ||
43 | final Output output = CftFactory.eINSTANCE.createOutput(); | ||
44 | output.setEventDeclaration(outputEvent); | ||
45 | EList<Output> _outputs = this.componentInstance.getOutputs(); | ||
46 | _outputs.add(output); | ||
47 | this.outputEventsMap.put(outputEvent, output); | ||
48 | } | ||
49 | } | ||
50 | EList<Component> _components = faultTree.getComponents(); | ||
51 | _components.add(this.componentInstance); | ||
52 | } | ||
53 | |||
54 | public void assign(final EventDeclaration inputEvent, final ComponentInstanceTrace sourceComponent, final EventDeclaration outputEvent) { | ||
55 | this.assign(inputEvent, sourceComponent, outputEvent, Modality.MUST); | ||
56 | } | ||
57 | |||
58 | public void assign(final EventDeclaration inputEvent, final ComponentInstanceTrace sourceComponent, final EventDeclaration outputEvent, final Modality exists) { | ||
59 | final InputTrace inputTrace = this.inputEventsMap.get(inputEvent); | ||
60 | if ((inputTrace == null)) { | ||
61 | throw new IllegalArgumentException(("Unknown input: " + inputEvent)); | ||
62 | } | ||
63 | final Output output = sourceComponent.outputEventsMap.get(outputEvent); | ||
64 | if ((output == null)) { | ||
65 | throw new IllegalArgumentException(("Unknown output: " + outputEvent)); | ||
66 | } | ||
67 | inputTrace.assign(output, exists); | ||
68 | } | ||
69 | |||
70 | protected EList<Output> getOutputs() { | ||
71 | return this.componentInstance.getOutputs(); | ||
72 | } | ||
73 | |||
74 | protected boolean appearsExactlyOnce() { | ||
75 | return CftExtensions.appearsExactlyOnce(this.componentInstance); | ||
76 | } | ||
77 | } | ||