From be2fd000db012b3738211ebee8db36001235c918 Mon Sep 17 00:00:00 2001 From: Aren Babikian Date: Thu, 14 Jan 2021 13:11:21 -0500 Subject: complete change of real representation BigDecimal->Double --- .../partialinterpretation/RealElement.java | 8 +++---- .../impl/PartialinterpretationPackageImpl.java | 2 +- .../impl/RealElementImpl.java | 17 ++++++-------- .../model/PartialInterpretation.ecore | 2 +- .../InstanceModel2PartialInterpretation.xtend | 27 +++++++++++----------- .../PartialInterpretationInitialiser.xtend | 4 ++-- 6 files changed, 27 insertions(+), 33 deletions(-) (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage') diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java index 65b40808..c30314d5 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java @@ -2,8 +2,6 @@ */ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation; -import java.math.BigDecimal; - /** * * A representation of the model object 'Real Element'. @@ -30,12 +28,12 @@ public interface RealElement extends PrimitiveElement { *

* * @return the value of the 'Value' attribute. - * @see #setValue(BigDecimal) + * @see #setValue(double) * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getRealElement_Value() * @model required="true" * @generated */ - BigDecimal getValue(); + double getValue(); /** * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement#getValue Value}' attribute. @@ -45,6 +43,6 @@ public interface RealElement extends PrimitiveElement { * @see #getValue() * @generated */ - void setValue(BigDecimal value); + void setValue(double value); } // RealElement diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java index 1ea3a11d..cb97c5ad 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java @@ -1069,7 +1069,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa initEAttribute(getIntegerElement_Value(), ecorePackage.getEInt(), "value", null, 1, 1, IntegerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(realElementEClass, RealElement.class, "RealElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getRealElement_Value(), ecorePackage.getEBigDecimal(), "value", null, 1, 1, RealElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getRealElement_Value(), ecorePackage.getEDouble(), "value", null, 1, 1, RealElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(stringElementEClass, StringElement.class, "StringElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getStringElement_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java index 67cff5a2..d1ff754f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java @@ -4,9 +4,6 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.pa import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage; import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement; - -import java.math.BigDecimal; - import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; @@ -35,7 +32,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * @generated * @ordered */ - protected static final BigDecimal VALUE_EDEFAULT = null; + protected static final double VALUE_EDEFAULT = 0.0; /** * The cached value of the '{@link #getValue() Value}' attribute. @@ -45,7 +42,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * @generated * @ordered */ - protected BigDecimal value = VALUE_EDEFAULT; + protected double value = VALUE_EDEFAULT; /** * @@ -72,7 +69,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * @generated */ @Override - public BigDecimal getValue() { + public double getValue() { return value; } @@ -82,8 +79,8 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement * @generated */ @Override - public void setValue(BigDecimal newValue) { - BigDecimal oldValue = value; + public void setValue(double newValue) { + double oldValue = value; value = newValue; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.REAL_ELEMENT__VALUE, oldValue, value)); @@ -112,7 +109,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement public void eSet(int featureID, Object newValue) { switch (featureID) { case PartialinterpretationPackage.REAL_ELEMENT__VALUE: - setValue((BigDecimal)newValue); + setValue((Double)newValue); return; } super.eSet(featureID, newValue); @@ -142,7 +139,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement public boolean eIsSet(int featureID) { switch (featureID) { case PartialinterpretationPackage.REAL_ELEMENT__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + return value != VALUE_EDEFAULT; } return super.eIsSet(featureID); } diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore index 47d54258..b2398acd 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore @@ -83,7 +83,7 @@ - + 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 import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory -import java.math.BigDecimal import java.util.HashMap import java.util.HashSet import java.util.List @@ -148,7 +147,7 @@ class InstanceModel2PartialInterpretation { private def createTypeScopesFromKnownAttributeValues(List objects, Set attributesUsed) { val Set integers = new HashSet - val Set reals = new HashSet + val Set reals = new HashSet val Set strings = new HashSet for(object: objects) { for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) { @@ -170,28 +169,28 @@ class InstanceModel2PartialInterpretation { it.knownStrings += strings ] } - private def dispatch shortValue(Boolean value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(Boolean value, Set integers, Set reals, Set strings) { // Do nothing } - private def dispatch shortValue(Integer value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(Integer value, Set integers, Set reals, Set strings) { integers += value } - private def dispatch shortValue(Short value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(Short value, Set integers, Set reals, Set strings) { integers += Integer.valueOf(value) } - private def dispatch shortValue(Float value, Set integers, Set reals, Set strings) { - reals += BigDecimal.valueOf(value) + private def dispatch shortValue(Float value, Set integers, Set reals, Set strings) { + reals += Double.valueOf(value) } - private def dispatch shortValue(Double value, Set integers, Set reals, Set strings) { - reals += BigDecimal.valueOf(value) + private def dispatch shortValue(Double value, Set integers, Set reals, Set strings) { + reals += value } - private def dispatch shortValue(String value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(String value, Set integers, Set reals, Set strings) { strings += value } - private def dispatch shortValue(Void value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(Void value, Set integers, Set reals, Set strings) { // Do nothing } - private def dispatch shortValue(Object value, Set integers, Set reals, Set strings) { + private def dispatch shortValue(Object value, Set integers, Set reals, Set strings) { // Do nothing } @@ -220,11 +219,11 @@ class InstanceModel2PartialInterpretation { } dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { - BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) + value.lookup(partialInterpretationTrace.primitiveValues.realMap) } dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { - BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) + Double.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) } dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index 20ff58f2..92db5c18 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend @@ -52,7 +52,7 @@ import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* PartialIntegerInterpretation integerInterpretation Map integerMap PartialRealInterpretation realInterpretation - Map realMap + Map realMap PartialStringInterpretation stringInterpretation Map stringMap } @@ -146,7 +146,7 @@ class PartialInterpretationInitialiser { return integerInterpretation } - def protected initReals(PartialInterpretation partialInterpretation, SortedSet knownReals, int minNewReals, int maxNewReals) { + def protected initReals(PartialInterpretation partialInterpretation, SortedSet knownReals, int minNewReals, int maxNewReals) { val realInterpretation = createPartialRealInterpretation partialInterpretation.partialtypeinterpratation += realInterpretation -- cgit v1.2.3-70-g09d2