diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentNameGenerator.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentNameGenerator.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentNameGenerator.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentNameGenerator.java new file mode 100644 index 00000000..e7dca003 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/ecore2cft/ComponentNameGenerator.java | |||
@@ -0,0 +1,29 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.transformation.ecore2cft; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ComponentDefinition; | ||
4 | import java.util.Map; | ||
5 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
6 | |||
7 | @SuppressWarnings("all") | ||
8 | public class ComponentNameGenerator { | ||
9 | private static final String DEFAULT_NAME = "__unnamed"; | ||
10 | |||
11 | private final Map<ComponentDefinition, Integer> instanceCounts = CollectionLiterals.<ComponentDefinition, Integer>newHashMap(); | ||
12 | |||
13 | public String nextName(final ComponentDefinition componentDefinition) { | ||
14 | String _xblockexpression = null; | ||
15 | { | ||
16 | final Integer instanceCount = this.instanceCounts.getOrDefault(componentDefinition, Integer.valueOf(0)); | ||
17 | this.instanceCounts.put(componentDefinition, Integer.valueOf(((instanceCount).intValue() + 1))); | ||
18 | String _elvis = null; | ||
19 | String _name = componentDefinition.getName(); | ||
20 | if (_name != null) { | ||
21 | _elvis = _name; | ||
22 | } else { | ||
23 | _elvis = ComponentNameGenerator.DEFAULT_NAME; | ||
24 | } | ||
25 | _xblockexpression = (_elvis + instanceCount); | ||
26 | } | ||
27 | return _xblockexpression; | ||
28 | } | ||
29 | } | ||