diff options
Diffstat (limited to 'Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/solver/ReliabilityResult.java')
-rw-r--r-- | Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/solver/ReliabilityResult.java | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/solver/ReliabilityResult.java b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/solver/ReliabilityResult.java new file mode 100644 index 00000000..c8c8b000 --- /dev/null +++ b/Stochastic/hu.bme.mit.inf.dslreasoner.faulttree.transformation/xtend-gen/hu/bme/mit/inf/dslreasoner/faulttree/transformation/solver/ReliabilityResult.java | |||
@@ -0,0 +1,156 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.faulttree.transformation.solver; | ||
2 | |||
3 | import org.eclipse.xtend.lib.annotations.Data; | ||
4 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; | ||
5 | import org.eclipse.xtext.xbase.lib.Pure; | ||
6 | import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; | ||
7 | |||
8 | @SuppressWarnings("all") | ||
9 | public abstract class ReliabilityResult { | ||
10 | @Data | ||
11 | public static final class Solution extends ReliabilityResult { | ||
12 | private final double lowerBound; | ||
13 | |||
14 | private final double upperBound; | ||
15 | |||
16 | public Solution(final double value) { | ||
17 | this(value, value); | ||
18 | } | ||
19 | |||
20 | public Solution(final double lowerBound, final double upperBound) { | ||
21 | if ((lowerBound > upperBound)) { | ||
22 | throw new IllegalArgumentException("lowerBound must not be larger than upperBound"); | ||
23 | } | ||
24 | this.lowerBound = lowerBound; | ||
25 | this.upperBound = upperBound; | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | public ReliabilityResult.Solution getOrThrow() { | ||
30 | return this; | ||
31 | } | ||
32 | |||
33 | @Override | ||
34 | @Pure | ||
35 | public int hashCode() { | ||
36 | final int prime = 31; | ||
37 | int result = 1; | ||
38 | result = prime * result + (int) (Double.doubleToLongBits(this.lowerBound) ^ (Double.doubleToLongBits(this.lowerBound) >>> 32)); | ||
39 | return prime * result + (int) (Double.doubleToLongBits(this.upperBound) ^ (Double.doubleToLongBits(this.upperBound) >>> 32)); | ||
40 | } | ||
41 | |||
42 | @Override | ||
43 | @Pure | ||
44 | public boolean equals(final Object obj) { | ||
45 | if (this == obj) | ||
46 | return true; | ||
47 | if (obj == null) | ||
48 | return false; | ||
49 | if (getClass() != obj.getClass()) | ||
50 | return false; | ||
51 | ReliabilityResult.Solution other = (ReliabilityResult.Solution) obj; | ||
52 | if (Double.doubleToLongBits(other.lowerBound) != Double.doubleToLongBits(this.lowerBound)) | ||
53 | return false; | ||
54 | if (Double.doubleToLongBits(other.upperBound) != Double.doubleToLongBits(this.upperBound)) | ||
55 | return false; | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | @Override | ||
60 | @Pure | ||
61 | public String toString() { | ||
62 | return new ToStringBuilder(this) | ||
63 | .addAllFields() | ||
64 | .toString(); | ||
65 | } | ||
66 | |||
67 | @Pure | ||
68 | public double getLowerBound() { | ||
69 | return this.lowerBound; | ||
70 | } | ||
71 | |||
72 | @Pure | ||
73 | public double getUpperBound() { | ||
74 | return this.upperBound; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | @Data | ||
79 | public static final class Unknown extends ReliabilityResult { | ||
80 | private final String message; | ||
81 | |||
82 | private final Throwable cause; | ||
83 | |||
84 | @FinalFieldsConstructor | ||
85 | public Unknown(final String message, final Throwable cause) { | ||
86 | super(); | ||
87 | this.message = message; | ||
88 | this.cause = cause; | ||
89 | } | ||
90 | |||
91 | public Unknown(final String message) { | ||
92 | this(message, null); | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public ReliabilityResult.Solution getOrThrow() { | ||
97 | throw new RuntimeException(this.message, this.cause); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | @Pure | ||
102 | public int hashCode() { | ||
103 | final int prime = 31; | ||
104 | int result = 1; | ||
105 | result = prime * result + ((this.message== null) ? 0 : this.message.hashCode()); | ||
106 | return prime * result + ((this.cause== null) ? 0 : this.cause.hashCode()); | ||
107 | } | ||
108 | |||
109 | @Override | ||
110 | @Pure | ||
111 | public boolean equals(final Object obj) { | ||
112 | if (this == obj) | ||
113 | return true; | ||
114 | if (obj == null) | ||
115 | return false; | ||
116 | if (getClass() != obj.getClass()) | ||
117 | return false; | ||
118 | ReliabilityResult.Unknown other = (ReliabilityResult.Unknown) obj; | ||
119 | if (this.message == null) { | ||
120 | if (other.message != null) | ||
121 | return false; | ||
122 | } else if (!this.message.equals(other.message)) | ||
123 | return false; | ||
124 | if (this.cause == null) { | ||
125 | if (other.cause != null) | ||
126 | return false; | ||
127 | } else if (!this.cause.equals(other.cause)) | ||
128 | return false; | ||
129 | return true; | ||
130 | } | ||
131 | |||
132 | @Override | ||
133 | @Pure | ||
134 | public String toString() { | ||
135 | return new ToStringBuilder(this) | ||
136 | .addAllFields() | ||
137 | .toString(); | ||
138 | } | ||
139 | |||
140 | @Pure | ||
141 | public String getMessage() { | ||
142 | return this.message; | ||
143 | } | ||
144 | |||
145 | @Pure | ||
146 | public Throwable getCause() { | ||
147 | return this.cause; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | public static final ReliabilityResult.Unknown TIMEOUT = new ReliabilityResult.Unknown("Solver timed out"); | ||
152 | |||
153 | public static final ReliabilityResult.Unknown MEMOUT = new ReliabilityResult.Unknown("Solver out of memory"); | ||
154 | |||
155 | public abstract ReliabilityResult.Solution getOrThrow(); | ||
156 | } | ||