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.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.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.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.xtend')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.xtend | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.xtend b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.xtend deleted file mode 100644 index ba3d39e6..00000000 --- a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/src/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.xtend +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.components.conversion | ||
2 | |||
3 | import org.eclipse.xtext.conversion.ValueConverterException | ||
4 | import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter | ||
5 | import org.eclipse.xtext.nodemodel.INode | ||
6 | |||
7 | class OF_INTValueConverter extends AbstractLexerBasedConverter<Integer> { | ||
8 | static val PREFIX = "of" | ||
9 | |||
10 | override toValue(String string, INode node) throws ValueConverterException { | ||
11 | if (string === null) { | ||
12 | return null | ||
13 | } | ||
14 | if (string.length < PREFIX.length || string.substring(0, PREFIX.length) != PREFIX) { | ||
15 | throw new ValueConverterException("'" + string + "' must start with the characters 'of'.", node, null); | ||
16 | } | ||
17 | try { | ||
18 | val intValue = Integer.parseInt(string.substring(PREFIX.length), 10) | ||
19 | Integer.valueOf(intValue) | ||
20 | } catch (NumberFormatException e) { | ||
21 | throw new ValueConverterException("Couldn't convert '" + string + "' to an int value.", node, e); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | override protected toEscapedString(Integer value) { | ||
26 | PREFIX + value | ||
27 | } | ||
28 | |||
29 | override protected assertValidValue(Integer value) { | ||
30 | super.assertValidValue(value) | ||
31 | if (value < 0) { | ||
32 | throw new ValueConverterException(getRuleName() + " may not be negative.", null, null); | ||
33 | } | ||
34 | } | ||
35 | } | ||