diff options
author | 2019-03-20 16:09:09 +0100 | |
---|---|---|
committer | 2019-03-20 16:09:09 +0100 | |
commit | 3f5aaab5025b8eb243f414b1c789085327df04f4 (patch) | |
tree | 156d9d95888fce6b003d73f509b9155e6b24555f /Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model | |
parent | Fix ParseUtil to avoid breaking the .vql editor in Eclipse (diff) | |
download | VIATRA-Generator-3f5aaab5025b8eb243f414b1c789085327df04f4.tar.gz VIATRA-Generator-3f5aaab5025b8eb243f414b1c789085327df04f4.tar.zst VIATRA-Generator-3f5aaab5025b8eb243f414b1c789085327df04f4.zip |
Fault tree transformation for partial models WIP
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model')
3 files changed, 70 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.CftExtensions.xtendbin b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.CftExtensions.xtendbin new file mode 100644 index 00000000..a6c01277 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.CftExtensions.xtendbin | |||
Binary files differ | |||
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.gitignore b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.gitignore new file mode 100644 index 00000000..945e2c6c --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/.gitignore | |||
@@ -0,0 +1 @@ | |||
/.CftExtensions.java._trace | |||
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/CftExtensions.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/CftExtensions.java new file mode 100644 index 00000000..dbc6b279 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.model/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/model/util/CftExtensions.java | |||
@@ -0,0 +1,69 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.model.util; | ||
2 | |||
3 | import com.google.common.base.Objects; | ||
4 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Component; | ||
5 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Connection; | ||
6 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ModalElement; | ||
7 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Modality; | ||
8 | |||
9 | @SuppressWarnings("all") | ||
10 | public final class CftExtensions { | ||
11 | private CftExtensions() { | ||
12 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly."); | ||
13 | } | ||
14 | |||
15 | public static boolean isMoreConcreteThan(final Modality newModality, final Modality original) { | ||
16 | boolean _switchResult = false; | ||
17 | if (original != null) { | ||
18 | switch (original) { | ||
19 | case MAY: | ||
20 | _switchResult = (!Objects.equal(newModality, Modality.MAY)); | ||
21 | break; | ||
22 | case CURRENT: | ||
23 | _switchResult = Objects.equal(newModality, Modality.MUST); | ||
24 | break; | ||
25 | case MUST: | ||
26 | _switchResult = false; | ||
27 | break; | ||
28 | default: | ||
29 | break; | ||
30 | } | ||
31 | } | ||
32 | return _switchResult; | ||
33 | } | ||
34 | |||
35 | public static boolean currentlyExists(final ModalElement element) { | ||
36 | Modality _exists = element.getExists(); | ||
37 | return (!Objects.equal(_exists, Modality.MAY)); | ||
38 | } | ||
39 | |||
40 | public static boolean mustExist(final ModalElement element) { | ||
41 | Modality _exists = element.getExists(); | ||
42 | return Objects.equal(_exists, Modality.MUST); | ||
43 | } | ||
44 | |||
45 | public static boolean appearsExactlyOnce(final Component componentInstance) { | ||
46 | return (CftExtensions.mustExist(componentInstance) && (!componentInstance.isMultipleAllowed())); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * Checks whether the connection and its target component are both currently present. | ||
51 | * | ||
52 | * A currently present connection without a present target component is a partial model error, | ||
53 | * so we throw an exception instead of returning <code>false</code>. | ||
54 | * | ||
55 | * @param connection The connection to check. | ||
56 | * @throws IllegalStateException When the target component is not currently present. | ||
57 | */ | ||
58 | public static boolean isCurrentlyConnected(final Connection connection) { | ||
59 | boolean _xblockexpression = false; | ||
60 | { | ||
61 | boolean _currentlyExists = CftExtensions.currentlyExists(connection.getOutput().getComponent()); | ||
62 | if (_currentlyExists) { | ||
63 | throw new IllegalStateException("Inconsistent partial model: current connection to a component that may not currently exist"); | ||
64 | } | ||
65 | _xblockexpression = CftExtensions.currentlyExists(connection); | ||
66 | } | ||
67 | return _xblockexpression; | ||
68 | } | ||
69 | } | ||