diff options
author | 2021-01-14 13:11:21 -0500 | |
---|---|---|
committer | 2021-01-14 13:11:21 -0500 | |
commit | be2fd000db012b3738211ebee8db36001235c918 (patch) | |
tree | b642948cc40fa1576bbf4eeedcd00bf086e0e8b8 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic | |
parent | forgot to commit some changes to Application (diff) | |
download | VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.tar.gz VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.tar.zst VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.zip |
complete change of real representation BigDecimal->Double
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic')
1 files changed, 13 insertions, 14 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend index cb5b587f..94959025 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend | |||
@@ -13,7 +13,6 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Par | |||
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation | 14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation |
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory | 15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory |
16 | import java.math.BigDecimal | ||
17 | import java.util.HashMap | 16 | import java.util.HashMap |
18 | import java.util.HashSet | 17 | import java.util.HashSet |
19 | import java.util.List | 18 | import java.util.List |
@@ -148,7 +147,7 @@ class InstanceModel2PartialInterpretation { | |||
148 | 147 | ||
149 | private def createTypeScopesFromKnownAttributeValues(List<EObject> objects, Set<EAttribute> attributesUsed) { | 148 | private def createTypeScopesFromKnownAttributeValues(List<EObject> objects, Set<EAttribute> attributesUsed) { |
150 | val Set<Integer> integers = new HashSet | 149 | val Set<Integer> integers = new HashSet |
151 | val Set<BigDecimal> reals = new HashSet | 150 | val Set<Double> reals = new HashSet |
152 | val Set<String> strings = new HashSet | 151 | val Set<String> strings = new HashSet |
153 | for(object: objects) { | 152 | for(object: objects) { |
154 | for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) { | 153 | for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) { |
@@ -170,28 +169,28 @@ class InstanceModel2PartialInterpretation { | |||
170 | it.knownStrings += strings | 169 | it.knownStrings += strings |
171 | ] | 170 | ] |
172 | } | 171 | } |
173 | private def dispatch shortValue(Boolean value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 172 | private def dispatch shortValue(Boolean value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
174 | // Do nothing | 173 | // Do nothing |
175 | } | 174 | } |
176 | private def dispatch shortValue(Integer value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 175 | private def dispatch shortValue(Integer value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
177 | integers += value | 176 | integers += value |
178 | } | 177 | } |
179 | private def dispatch shortValue(Short value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 178 | private def dispatch shortValue(Short value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
180 | integers += Integer.valueOf(value) | 179 | integers += Integer.valueOf(value) |
181 | } | 180 | } |
182 | private def dispatch shortValue(Float value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 181 | private def dispatch shortValue(Float value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
183 | reals += BigDecimal.valueOf(value) | 182 | reals += Double.valueOf(value) |
184 | } | 183 | } |
185 | private def dispatch shortValue(Double value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 184 | private def dispatch shortValue(Double value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
186 | reals += BigDecimal.valueOf(value) | 185 | reals += value |
187 | } | 186 | } |
188 | private def dispatch shortValue(String value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 187 | private def dispatch shortValue(String value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
189 | strings += value | 188 | strings += value |
190 | } | 189 | } |
191 | private def dispatch shortValue(Void value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 190 | private def dispatch shortValue(Void value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
192 | // Do nothing | 191 | // Do nothing |
193 | } | 192 | } |
194 | private def dispatch shortValue(Object value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 193 | private def dispatch shortValue(Object value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
195 | // Do nothing | 194 | // Do nothing |
196 | } | 195 | } |
197 | 196 | ||
@@ -220,11 +219,11 @@ class InstanceModel2PartialInterpretation { | |||
220 | } | 219 | } |
221 | 220 | ||
222 | dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 221 | dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |
223 | BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) | 222 | value.lookup(partialInterpretationTrace.primitiveValues.realMap) |
224 | } | 223 | } |
225 | 224 | ||
226 | dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 225 | dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |
227 | BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) | 226 | Double.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) |
228 | } | 227 | } |
229 | 228 | ||
230 | dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 229 | dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |