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/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend | |
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/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend deleted file mode 100644 index 158ab2e1..00000000 --- a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/src/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentInstanceTrace.xtend +++ /dev/null | |||
@@ -1,65 +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.ComponentDefinition | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ComponentFaultTree | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.EventDeclaration | ||
8 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.InputEvent | ||
9 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Modality | ||
10 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Output | ||
11 | import java.util.Map | ||
12 | |||
13 | import static extension hu.bme.mit.inf.dslreasoner.faulttree.model.util.CftExtensions.* | ||
14 | |||
15 | class ComponentInstanceTrace { | ||
16 | val componentInstance = CftFactory.eINSTANCE.createComponent | ||
17 | val Map<InputEvent, InputTrace> inputEventsMap | ||
18 | val Map<EventDeclaration, Output> outputEventsMap | ||
19 | |||
20 | protected new(ComponentFaultTree faultTree, ComponentDefinition componentDefinition, | ||
21 | ComponentNameGenerator nameGenerator, Modality exists, boolean multipleAllowed) { | ||
22 | componentInstance.componentDefinition = componentDefinition | ||
23 | componentInstance.name = nameGenerator.nextName(componentDefinition) | ||
24 | componentInstance.exists = exists | ||
25 | componentInstance.multipleAllowed = multipleAllowed | ||
26 | inputEventsMap = Maps.newHashMapWithExpectedSize(componentDefinition.inputEvents.size) | ||
27 | for (inputEvent : componentDefinition.inputEvents) { | ||
28 | val inputTrace = new InputTrace(componentInstance, inputEvent) | ||
29 | inputEventsMap.put(inputEvent, inputTrace) | ||
30 | } | ||
31 | outputEventsMap = Maps.newHashMapWithExpectedSize(componentDefinition.outputEvents.size) | ||
32 | for (outputEvent : componentDefinition.outputEvents) { | ||
33 | val output = CftFactory.eINSTANCE.createOutput | ||
34 | output.eventDeclaration = outputEvent | ||
35 | componentInstance.outputs += output | ||
36 | outputEventsMap.put(outputEvent, output) | ||
37 | } | ||
38 | faultTree.components += componentInstance | ||
39 | } | ||
40 | |||
41 | def void assign(EventDeclaration inputEvent, ComponentInstanceTrace sourceComponent, EventDeclaration outputEvent) { | ||
42 | assign(inputEvent, sourceComponent, outputEvent, Modality.MUST) | ||
43 | } | ||
44 | |||
45 | def void assign(EventDeclaration inputEvent, ComponentInstanceTrace sourceComponent, EventDeclaration outputEvent, | ||
46 | Modality exists) { | ||
47 | val inputTrace = inputEventsMap.get(inputEvent) | ||
48 | if (inputTrace === null) { | ||
49 | throw new IllegalArgumentException("Unknown input: " + inputEvent) | ||
50 | } | ||
51 | val output = sourceComponent.outputEventsMap.get(outputEvent) | ||
52 | if (output === null) { | ||
53 | throw new IllegalArgumentException("Unknown output: " + outputEvent) | ||
54 | } | ||
55 | inputTrace.assign(output, exists) | ||
56 | } | ||
57 | |||
58 | protected def getOutputs() { | ||
59 | componentInstance.outputs | ||
60 | } | ||
61 | |||
62 | protected def appearsExactlyOnce() { | ||
63 | componentInstance.appearsExactlyOnce | ||
64 | } | ||
65 | } | ||