diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.java new file mode 100644 index 00000000..0fd2375e --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.components/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/components/conversion/OF_INTValueConverter.java | |||
@@ -0,0 +1,58 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.components.conversion; | ||
2 | |||
3 | import com.google.common.base.Objects; | ||
4 | import org.eclipse.xtext.conversion.ValueConverterException; | ||
5 | import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter; | ||
6 | import org.eclipse.xtext.nodemodel.INode; | ||
7 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
8 | |||
9 | @SuppressWarnings("all") | ||
10 | public class OF_INTValueConverter extends AbstractLexerBasedConverter<Integer> { | ||
11 | private static final String PREFIX = "of"; | ||
12 | |||
13 | @Override | ||
14 | public Integer toValue(final String string, final INode node) throws ValueConverterException { | ||
15 | Integer _xblockexpression = null; | ||
16 | { | ||
17 | if ((string == null)) { | ||
18 | return null; | ||
19 | } | ||
20 | if (((string.length() < OF_INTValueConverter.PREFIX.length()) || (!Objects.equal(string.substring(0, OF_INTValueConverter.PREFIX.length()), OF_INTValueConverter.PREFIX)))) { | ||
21 | throw new ValueConverterException((("\'" + string) + "\' must start with the characters \'of\'."), node, null); | ||
22 | } | ||
23 | Integer _xtrycatchfinallyexpression = null; | ||
24 | try { | ||
25 | Integer _xblockexpression_1 = null; | ||
26 | { | ||
27 | final int intValue = Integer.parseInt(string.substring(OF_INTValueConverter.PREFIX.length()), 10); | ||
28 | _xblockexpression_1 = Integer.valueOf(intValue); | ||
29 | } | ||
30 | _xtrycatchfinallyexpression = _xblockexpression_1; | ||
31 | } catch (final Throwable _t) { | ||
32 | if (_t instanceof NumberFormatException) { | ||
33 | final NumberFormatException e = (NumberFormatException)_t; | ||
34 | throw new ValueConverterException((("Couldn\'t convert \'" + string) + "\' to an int value."), node, e); | ||
35 | } else { | ||
36 | throw Exceptions.sneakyThrow(_t); | ||
37 | } | ||
38 | } | ||
39 | _xblockexpression = _xtrycatchfinallyexpression; | ||
40 | } | ||
41 | return _xblockexpression; | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | protected String toEscapedString(final Integer value) { | ||
46 | return (OF_INTValueConverter.PREFIX + value); | ||
47 | } | ||
48 | |||
49 | @Override | ||
50 | protected void assertValidValue(final Integer value) { | ||
51 | super.assertValidValue(value); | ||
52 | if (((value).intValue() < 0)) { | ||
53 | String _ruleName = this.getRuleName(); | ||
54 | String _plus = (_ruleName + " may not be negative."); | ||
55 | throw new ValueConverterException(_plus, null, null); | ||
56 | } | ||
57 | } | ||
58 | } | ||