Commit 85e919ec authored by Kai-Holger Brassel's avatar Kai-Holger Brassel
Browse files

New release 1.1.0

 * Switch from EMF Forms to Sirius
 * Replace QuantityLong and QuantityDouble by Quantity (only doubles)
 * Switch from JDK 15 to JDK 16
 * Add obligatory annotation for minnimal and maximal values
 * Allow dimensionless and/or nullable Quantites
 * Tests for nullable and dimensionless Quantites
parent 89b2e825
Pipeline #4791 failed with stage
in 4 seconds
Showing with 72 additions and 483 deletions
+72 -483
variables: variables:
RELEASE_DIR: "public/release_target_102" RELEASE_DIR: "public/release_target_110"
pages: pages:
stage: deploy stage: deploy
tags: tags:
- docker # use shared runner - docker # use shared runner
image: maven:3.6.3-adoptopenjdk-15 image: maven:3.6.3-adoptopenjdk-16
script: script:
- mvn --version - mvn --version
- mvn clean install # build p2 repo - mvn clean install # build p2 repo
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
<feature <feature
id="de.hftstuttgart.cityunits.feature" id="de.hftstuttgart.cityunits.feature"
label="City Units" label="City Units"
version="1.0.2" version="1.1.0"
provider-name="HfT Stuttgart"> provider-name="HfT Stuttgart">
<description url="http://www.example.com/description"> <description url="http://www.example.com/description">
Provides Indriya reference implementation of units of measurement Provides Indriya reference implementation of units of measurement
(JSR 385) together with required dependencies and extensions (JSR 385) together with required dependencies and extensions
that introduces Ecore data types for double and long valued units. that introduces Ecore data types for double valued units.
Certain units relevant to City simulations are also added. Certain units relevant to City simulations are also added.
</description> </description>
...@@ -22,24 +21,12 @@ Certain units relevant to City simulations are also added. ...@@ -22,24 +21,12 @@ Certain units relevant to City simulations are also added.
</license> </license>
<requires> <requires>
<import plugin="org.eclipse.emf.ecore"/>
<import plugin="org.eclipse.emf.edit" version="2.8.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.emf.databinding" version="1.3.0" match="compatible"/>
<import plugin="org.eclipse.jface"/>
<import plugin="javax.inject"/>
<import plugin="org.eclipse.emfforms.common"/>
<import plugin="org.eclipse.swt"/>
<import plugin="tech.units.indriya" version="2.1.1" match="compatible"/> <import plugin="tech.units.indriya" version="2.1.1" match="compatible"/>
<import plugin="javax.measure.unit-api" version="2.1.1" match="compatible"/> <import plugin="javax.measure.unit-api" version="2.1.1" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecore"/>
<import plugin="uom-lib-common" version="2.1.0" match="compatible"/> <import plugin="uom-lib-common" version="2.1.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecp.edit.swt" version="1.24.0" match="compatible"/> <import plugin="org.eclipse.emf.edit" version="2.8.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecp.ui.view.swt" version="1.24.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecp.view.core.swt" version="1.24.0" match="compatible"/>
<import plugin="org.eclipse.emf.ecp.view.template.model" version="1.24.0" match="compatible"/>
<import plugin="org.eclipse.emfforms.core.services.editsupport" version="1.24.0" match="compatible"/>
<import plugin="org.eclipse.emfforms.swt.core.di" version="1.24.0" match="compatible"/>
<import plugin="org.eclipse.emfforms.localization" version="1.24.0" match="compatible"/>
</requires> </requires>
<plugin <plugin
...@@ -49,13 +36,6 @@ Certain units relevant to City simulations are also added. ...@@ -49,13 +36,6 @@ Certain units relevant to City simulations are also added.
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="de.hftstuttgart.cityunits.ui.renderer"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="de.hftstuttgart.cityunits.model.edit" id="de.hftstuttgart.cityunits.model.edit"
download-size="0" download-size="0"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>de.hftstuttgart</groupId> <groupId>de.hftstuttgart</groupId>
<artifactId>de.hftstuttgart.cityunits</artifactId> <artifactId>de.hftstuttgart.cityunits</artifactId>
<version>1.0.2</version> <version>1.1.0</version>
</parent> </parent>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/> <classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
......
...@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 ...@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: de.hftstuttgart.cityunits.model.edit;singleton:=true Bundle-SymbolicName: de.hftstuttgart.cityunits.model.edit;singleton:=true
Automatic-Module-Name: de.hftstuttgart.cityunits.model.edit Automatic-Module-Name: de.hftstuttgart.cityunits.model.edit
Bundle-Version: 1.0.2 Bundle-Version: 1.1.0
Bundle-ClassPath: . Bundle-ClassPath: .
Bundle-Activator: de.hftstuttgart.cityunits.model.quantities.provider.QuantitiesEditPlugin$Implementation Bundle-Activator: de.hftstuttgart.cityunits.model.quantities.provider.QuantitiesEditPlugin$Implementation
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
...@@ -12,4 +12,5 @@ Export-Package: de.hftstuttgart.cityunits.model.quantities.provider ...@@ -12,4 +12,5 @@ Export-Package: de.hftstuttgart.cityunits.model.quantities.provider
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
de.hftstuttgart.cityunits.model;visibility:=reexport, de.hftstuttgart.cityunits.model;visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport org.eclipse.emf.edit;visibility:=reexport
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<parent> <parent>
<groupId>de.hftstuttgart</groupId> <groupId>de.hftstuttgart</groupId>
<artifactId>de.hftstuttgart.cityunits</artifactId> <artifactId>de.hftstuttgart.cityunits</artifactId>
<version>1.0.2</version> <version>1.1.0</version>
</parent> </parent>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>
...@@ -2,7 +2,7 @@ Manifest-Version: 1.0 ...@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: de.hftstuttgart.cityunits.model;singleton:=true Bundle-SymbolicName: de.hftstuttgart.cityunits.model;singleton:=true
Bundle-Version: 1.0.2 Bundle-Version: 1.1.0
Bundle-ClassPath: . Bundle-ClassPath: .
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin
...@@ -12,6 +12,7 @@ Require-Bundle: tech.units.indriya;bundle-version="[2.1.1,3.0.0)", ...@@ -12,6 +12,7 @@ Require-Bundle: tech.units.indriya;bundle-version="[2.1.1,3.0.0)",
org.eclipse.core.runtime, org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.ecore;visibility:=reexport,
uom-lib-common;bundle-version="[2.1.0,3.0.0)" uom-lib-common;bundle-version="[2.1.0,3.0.0)"
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: de.hftstuttgart.cityunits.model; Export-Package: de.hftstuttgart.cityunits.model;
uses:="javax.measure, uses:="javax.measure,
...@@ -19,5 +20,4 @@ Export-Package: de.hftstuttgart.cityunits.model; ...@@ -19,5 +20,4 @@ Export-Package: de.hftstuttgart.cityunits.model;
tech.units.indriya", tech.units.indriya",
de.hftstuttgart.cityunits.model.quantities; de.hftstuttgart.cityunits.model.quantities;
uses:="org.eclipse.emf.ecore", uses:="org.eclipse.emf.ecore",
de.hftstuttgart.cityunits.model.quantities.impl, de.hftstuttgart.cityunits.model.quantities.impl
de.hftstuttgart.cityunits.model.quantities.util
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="quantities" nsURI="https://www.hftstuttgart.de/quantities" nsPrefix="quant"> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="quantities" nsURI="https://www.hftstuttgart.de/quantities" nsPrefix="quant">
<eClassifiers xsi:type="ecore:EDataType" name="QuantityDouble" instanceClassName="de.hftstuttgart.cityunits.model.NullableQuantity"/> <eClassifiers xsi:type="ecore:EDataType" name="Quantity" instanceClassName="de.hftstuttgart.cityunits.model.NullableQuantity"/>
<eClassifiers xsi:type="ecore:EDataType" name="QuantityLong" instanceClassName="de.hftstuttgart.cityunits.model.NullableQuantity"/>
<eClassifiers xsi:type="ecore:EDataType" name="Fraction" instanceClassName="java.lang.Double">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="minInclusive" value="0.0"/>
<details key="maxInclusive" value="1.0"/>
</eAnnotations>
</eClassifiers>
</ecore:EPackage> </ecore:EPackage>
...@@ -2,15 +2,11 @@ ...@@ -2,15 +2,11 @@
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel"
modelDirectory="/de.hftstuttgart.cityunits.model/src" creationIcons="false" modelDirectory="/de.hftstuttgart.cityunits.model/src" creationIcons="false"
modelPluginID="de.hftstuttgart.cityunits.model" modelName="Quantities" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" modelPluginID="de.hftstuttgart.cityunits.model" modelName="Quantities" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="15.0" copyrightFields="false" importerID="org.eclipse.emf.importer.ecore" complianceLevel="11.0" copyrightFields="false"
operationReflection="true" importOrganizing="true"> importOrganizing="true">
<foreignModel>Quantities.ecore</foreignModel> <foreignModel>Quantities.ecore</foreignModel>
<genPackages prefix="Quantities" basePackage="de.hftstuttgart.cityunits.model" disposableProviderFactory="true" <genPackages prefix="Quantities" basePackage="de.hftstuttgart.cityunits.model" disposableProviderFactory="true"
ecorePackage="Quantities.ecore#/"> ecorePackage="Quantities.ecore#/">
<genDataTypes ecoreDataType="Quantities.ecore#//QuantityDouble" create="return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);" <genDataTypes ecoreDataType="Quantities.ecore#//Quantity" create="return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);"/>
convert="return it == null ? null : it.toString();"/>
<genDataTypes ecoreDataType="Quantities.ecore#//QuantityLong" create="return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);"
convert="return it == null ? null : it.toString();"/>
<genDataTypes ecoreDataType="Quantities.ecore#//Fraction"/>
</genPackages> </genPackages>
</genmodel:GenModel> </genmodel:GenModel>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<parent> <parent>
<groupId>de.hftstuttgart</groupId> <groupId>de.hftstuttgart</groupId>
<artifactId>de.hftstuttgart.cityunits</artifactId> <artifactId>de.hftstuttgart.cityunits</artifactId>
<version>1.0.2</version> <version>1.1.0</version>
</parent> </parent>
</project> </project>
\ No newline at end of file
...@@ -10,6 +10,7 @@ import javax.measure.Unit; ...@@ -10,6 +10,7 @@ import javax.measure.Unit;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import tech.units.indriya.AbstractUnit;
import tech.units.indriya.format.SimpleQuantityFormat; import tech.units.indriya.format.SimpleQuantityFormat;
import tech.units.indriya.quantity.Quantities; import tech.units.indriya.quantity.Quantities;
...@@ -32,25 +33,33 @@ public class NullableQuantity { ...@@ -32,25 +33,33 @@ public class NullableQuantity {
UrbanSimulationUnits.getInstance(); UrbanSimulationUnits.getInstance();
} }
public static NullableQuantity create(String str) { public static NullableQuantity create(String quantityString) {
NullableQuantity newNullableQuantity = null; NullableQuantity newNullableQuantity;
Number num = null;
String trimmed = quantityString.trim();
try { try {
NumberFormat.getInstance().parse(str); num = NumberFormat.getInstance().parse(trimmed);
newNullableQuantity = new NullableQuantity(str); newNullableQuantity = new NullableQuantity(trimmed);
} catch (final ParseException ex) { // no number value present: create NullQuantity just with unit } catch (final ParseException ex) {
// no number value present: create NullQuantity just with unit
try { try {
NullableQuantity dummy = new NullableQuantity("1 " + str); //$NON-NLS-1$ NullableQuantity dummy = new NullableQuantity("1 " + trimmed); //$NON-NLS-1$
newNullableQuantity = new NullQuantity(dummy.getUnit()); newNullableQuantity = new NullQuantity(dummy.getUnit());
} catch (final IllegalArgumentException ex1) { // Unit could not be parsed } catch (final IllegalArgumentException ex1) {
Platform.getLog(NullableQuantity.class).warn("Unit '" + str + "' could not be parsed!", ex); // number and unit could not be parsed: default to dimensionless null quantity
newNullableQuantity = new NullQuantity(AbstractUnit.ONE);
} }
} catch (final IllegalArgumentException ex) { // Quantity could not be parsed } catch (final IllegalArgumentException ex) { // Quantity could not be parsed
Platform.getLog(NullableQuantity.class).warn("Quantity '" + str + "' could not be parsed!", ex); // unit could not be parsed: default to dimensionless quantity
newNullableQuantity = create(num, AbstractUnit.ONE);
} }
return newNullableQuantity; return newNullableQuantity;
} }
public static NullableQuantity create(Number number, Unit<?> unit) { public static NullableQuantity create(Number number, Unit<?> unit) {
if (unit == null) {
unit = AbstractUnit.ONE;
}
return number == null ? new NullQuantity(unit) : new NullableQuantity(number, unit); return number == null ? new NullQuantity(unit) : new NullableQuantity(number, unit);
} }
...@@ -80,7 +89,7 @@ public class NullableQuantity { ...@@ -80,7 +89,7 @@ public class NullableQuantity {
} }
public Unit<?> getUnit() { public Unit<?> getUnit() {
return quantity.getUnit(); return quantity.getUnit(); // AbstractUnit.ONE is just omitted
} }
@Override @Override
...@@ -100,7 +109,7 @@ public class NullableQuantity { ...@@ -100,7 +109,7 @@ public class NullableQuantity {
@Override @Override
public String toString() { public String toString() {
return "<unknown> " + getUnit().toString(); return getUnit() == AbstractUnit.ONE ? "" : getUnit().toString();
} }
} }
} }
...@@ -55,70 +55,26 @@ public interface QuantitiesPackage extends EPackage { ...@@ -55,70 +55,26 @@ public interface QuantitiesPackage extends EPackage {
QuantitiesPackage eINSTANCE = de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl.init(); QuantitiesPackage eINSTANCE = de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl.init();
/** /**
* The meta object id for the '<em>Quantity Double</em>' data type. * The meta object id for the '<em>Quantity</em>' data type.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.NullableQuantity * @see de.hftstuttgart.cityunits.model.NullableQuantity
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantityDouble() * @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantity()
* @generated * @generated
*/ */
int QUANTITY_DOUBLE = 0; int QUANTITY = 0;
/**
* The meta object id for the '<em>Quantity Long</em>' data type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.NullableQuantity
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantityLong()
* @generated
*/
int QUANTITY_LONG = 1;
/** /**
* The meta object id for the '<em>Fraction</em>' data type. * Returns the meta object for data type '{@link de.hftstuttgart.cityunits.model.NullableQuantity <em>Quantity</em>}'.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see java.lang.Double * @return the meta object for data type '<em>Quantity</em>'.
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getFraction()
* @generated
*/
int FRACTION = 2;
/**
* Returns the meta object for data type '{@link de.hftstuttgart.cityunits.model.NullableQuantity <em>Quantity Double</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Quantity Double</em>'.
* @see de.hftstuttgart.cityunits.model.NullableQuantity * @see de.hftstuttgart.cityunits.model.NullableQuantity
* @model instanceClass="de.hftstuttgart.cityunits.model.NullableQuantity" * @model instanceClass="de.hftstuttgart.cityunits.model.NullableQuantity"
* @generated * @generated
*/ */
EDataType getQuantityDouble(); EDataType getQuantity();
/**
* Returns the meta object for data type '{@link de.hftstuttgart.cityunits.model.NullableQuantity <em>Quantity Long</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Quantity Long</em>'.
* @see de.hftstuttgart.cityunits.model.NullableQuantity
* @model instanceClass="de.hftstuttgart.cityunits.model.NullableQuantity"
* @generated
*/
EDataType getQuantityLong();
/**
* Returns the meta object for data type '{@link java.lang.Double <em>Fraction</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Fraction</em>'.
* @see java.lang.Double
* @model instanceClass="java.lang.Double"
* extendedMetaData="minInclusive='0.0' maxInclusive='1.0'"
* @generated
*/
EDataType getFraction();
/** /**
* Returns the factory that creates the instances of the model. * Returns the factory that creates the instances of the model.
...@@ -144,34 +100,14 @@ public interface QuantitiesPackage extends EPackage { ...@@ -144,34 +100,14 @@ public interface QuantitiesPackage extends EPackage {
*/ */
interface Literals { interface Literals {
/** /**
* The meta object literal for the '<em>Quantity Double</em>' data type. * The meta object literal for the '<em>Quantity</em>' data type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.NullableQuantity
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantityDouble()
* @generated
*/
EDataType QUANTITY_DOUBLE = eINSTANCE.getQuantityDouble();
/**
* The meta object literal for the '<em>Quantity Long</em>' data type.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.NullableQuantity * @see de.hftstuttgart.cityunits.model.NullableQuantity
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantityLong() * @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getQuantity()
* @generated
*/
EDataType QUANTITY_LONG = eINSTANCE.getQuantityLong();
/**
* The meta object literal for the '<em>Fraction</em>' data type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see java.lang.Double
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getFraction()
* @generated * @generated
*/ */
EDataType FRACTION = eINSTANCE.getFraction(); EDataType QUANTITY = eINSTANCE.getQuantity();
} }
......
...@@ -71,12 +71,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -71,12 +71,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
@Override @Override
public Object createFromString(EDataType eDataType, String initialValue) { public Object createFromString(EDataType eDataType, String initialValue) {
switch (eDataType.getClassifierID()) { switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY_DOUBLE: case QuantitiesPackage.QUANTITY:
return createQuantityDoubleFromString(eDataType, initialValue); return createQuantityFromString(eDataType, initialValue);
case QuantitiesPackage.QUANTITY_LONG:
return createQuantityLongFromString(eDataType, initialValue);
case QuantitiesPackage.FRACTION:
return createFractionFromString(eDataType, initialValue);
default: default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
} }
...@@ -90,12 +86,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -90,12 +86,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
@Override @Override
public String convertToString(EDataType eDataType, Object instanceValue) { public String convertToString(EDataType eDataType, Object instanceValue) {
switch (eDataType.getClassifierID()) { switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY_DOUBLE: case QuantitiesPackage.QUANTITY:
return convertQuantityDoubleToString(eDataType, instanceValue); return convertQuantityToString(eDataType, instanceValue);
case QuantitiesPackage.QUANTITY_LONG:
return convertQuantityLongToString(eDataType, instanceValue);
case QuantitiesPackage.FRACTION:
return convertFractionToString(eDataType, instanceValue);
default: default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
} }
...@@ -106,7 +98,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -106,7 +98,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
public NullableQuantity createQuantityDouble(final String it) { public NullableQuantity createQuantity(final String it) {
return de.hftstuttgart.cityunits.model.NullableQuantity.create(it); return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);
} }
...@@ -115,8 +107,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -115,8 +107,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
public NullableQuantity createQuantityDoubleFromString(EDataType eDataType, String initialValue) { public NullableQuantity createQuantityFromString(EDataType eDataType, String initialValue) {
return createQuantityDouble(initialValue); return createQuantity(initialValue);
} }
/** /**
...@@ -124,70 +116,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -124,70 +116,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
public String convertQuantityDouble(final NullableQuantity it) { public String convertQuantityToString(EDataType eDataType, Object instanceValue) {
return it == null ? null : it.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertQuantityDoubleToString(EDataType eDataType, Object instanceValue) {
return convertQuantityDouble((NullableQuantity)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NullableQuantity createQuantityLong(final String it) {
return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NullableQuantity createQuantityLongFromString(EDataType eDataType, String initialValue) {
return createQuantityLong(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertQuantityLong(final NullableQuantity it) {
return it == null ? null : it.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertQuantityLongToString(EDataType eDataType, Object instanceValue) {
return convertQuantityLong((NullableQuantity)instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Double createFractionFromString(EDataType eDataType, String initialValue) {
return (Double)super.createFromString(eDataType, initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertFractionToString(EDataType eDataType, Object instanceValue) {
return super.convertToString(eDataType, instanceValue); return super.convertToString(eDataType, instanceValue);
} }
......
...@@ -5,12 +5,8 @@ package de.hftstuttgart.cityunits.model.quantities.impl; ...@@ -5,12 +5,8 @@ package de.hftstuttgart.cityunits.model.quantities.impl;
import de.hftstuttgart.cityunits.model.NullableQuantity; import de.hftstuttgart.cityunits.model.NullableQuantity;
import de.hftstuttgart.cityunits.model.quantities.QuantitiesFactory; import de.hftstuttgart.cityunits.model.quantities.QuantitiesFactory;
import de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage; import de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage;
import de.hftstuttgart.cityunits.model.quantities.util.QuantitiesValidator;
import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.emf.ecore.impl.EPackageImpl;
/** /**
...@@ -25,21 +21,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -25,21 +21,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
private EDataType quantityDoubleEDataType = null; private EDataType quantityEDataType = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EDataType quantityLongEDataType = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EDataType fractionEDataType = null;
/** /**
* Creates an instance of the model <b>Package</b>, registered with * Creates an instance of the model <b>Package</b>, registered with
...@@ -94,16 +76,6 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -94,16 +76,6 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Initialize created meta-data // Initialize created meta-data
theQuantitiesPackage.initializePackageContents(); theQuantitiesPackage.initializePackageContents();
// Register package validator
EValidator.Registry.INSTANCE.put
(theQuantitiesPackage,
new EValidator.Descriptor() {
@Override
public EValidator getEValidator() {
return QuantitiesValidator.INSTANCE;
}
});
// Mark meta-data to indicate it can't be changed // Mark meta-data to indicate it can't be changed
theQuantitiesPackage.freeze(); theQuantitiesPackage.freeze();
...@@ -118,28 +90,8 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -118,28 +90,8 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* @generated * @generated
*/ */
@Override @Override
public EDataType getQuantityDouble() { public EDataType getQuantity() {
return quantityDoubleEDataType; return quantityEDataType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EDataType getQuantityLong() {
return quantityLongEDataType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EDataType getFraction() {
return fractionEDataType;
} }
/** /**
...@@ -171,9 +123,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -171,9 +123,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
isCreated = true; isCreated = true;
// Create data types // Create data types
quantityDoubleEDataType = createEDataType(QUANTITY_DOUBLE); quantityEDataType = createEDataType(QUANTITY);
quantityLongEDataType = createEDataType(QUANTITY_LONG);
fractionEDataType = createEDataType(FRACTION);
} }
/** /**
...@@ -200,33 +150,10 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -200,33 +150,10 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
setNsURI(eNS_URI); setNsURI(eNS_URI);
// Initialize data types // Initialize data types
initEDataType(quantityDoubleEDataType, NullableQuantity.class, "QuantityDouble", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); initEDataType(quantityEDataType, NullableQuantity.class, "Quantity", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(quantityLongEDataType, NullableQuantity.class, "QuantityLong", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(fractionEDataType, Double.class, "Fraction", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
// Create resource // Create resource
createResource(eNS_URI); createResource(eNS_URI);
// Create annotations
// http:///org/eclipse/emf/ecore/util/ExtendedMetaData
createExtendedMetaDataAnnotations();
}
/**
* Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createExtendedMetaDataAnnotations() {
String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
addAnnotation
(fractionEDataType,
source,
new String[] {
"minInclusive", "0.0",
"maxInclusive", "1.0"
});
} }
} //QuantitiesPackageImpl } //QuantitiesPackageImpl
/**
*/
package de.hftstuttgart.cityunits.model.quantities.util;
import de.hftstuttgart.cityunits.model.NullableQuantity;
import de.hftstuttgart.cityunits.model.quantities.*;
import java.util.Map;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EObjectValidator;
/**
* <!-- begin-user-doc -->
* The <b>Validator</b> for the model.
* <!-- end-user-doc -->
* @see de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage
* @generated
*/
public class QuantitiesValidator extends EObjectValidator {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final QuantitiesValidator INSTANCE = new QuantitiesValidator();
/**
* A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.common.util.Diagnostic#getSource()
* @see org.eclipse.emf.common.util.Diagnostic#getCode()
* @generated
*/
public static final String DIAGNOSTIC_SOURCE = "de.hftstuttgart.cityunits.model.quantities";
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
/**
* A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QuantitiesValidator() {
super();
}
/**
* Returns the package of this validator switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EPackage getEPackage() {
return QuantitiesPackage.eINSTANCE;
}
/**
* Calls <code>validateXXX</code> for the corresponding classifier of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
switch (classifierID) {
case QuantitiesPackage.QUANTITY_DOUBLE:
return validateQuantityDouble((NullableQuantity)value, diagnostics, context);
case QuantitiesPackage.QUANTITY_LONG:
return validateQuantityLong((NullableQuantity)value, diagnostics, context);
case QuantitiesPackage.FRACTION:
return validateFraction((Double)value, diagnostics, context);
default:
return true;
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateQuantityDouble(NullableQuantity quantityDouble, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateQuantityLong(NullableQuantity quantityLong, DiagnosticChain diagnostics, Map<Object, Object> context) {
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateFraction(Double fraction, DiagnosticChain diagnostics, Map<Object, Object> context) {
boolean result = validateFraction_Min(fraction, diagnostics, context);
if (result || diagnostics != null) result &= validateFraction_Max(fraction, diagnostics, context);
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @see #validateFraction_Min
*/
public static final Double FRACTION__MIN__VALUE = Double.valueOf(0.0);
/**
* Validates the Min constraint of '<em>Fraction</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateFraction_Min(Double fraction, DiagnosticChain diagnostics, Map<Object, Object> context) {
boolean result = fraction.compareTo(FRACTION__MIN__VALUE) >= 0;
if (!result && diagnostics != null)
reportMinViolation(QuantitiesPackage.Literals.FRACTION, fraction, FRACTION__MIN__VALUE, true, diagnostics, context);
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @see #validateFraction_Max
*/
public static final Double FRACTION__MAX__VALUE = Double.valueOf(1.0);
/**
* Validates the Max constraint of '<em>Fraction</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateFraction_Max(Double fraction, DiagnosticChain diagnostics, Map<Object, Object> context) {
boolean result = fraction.compareTo(FRACTION__MAX__VALUE) <= 0;
if (!result && diagnostics != null)
reportMaxViolation(QuantitiesPackage.Literals.FRACTION, fraction, FRACTION__MAX__VALUE, true, diagnostics, context);
return result;
}
/**
* Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
// TODO
// Specialize this to return a resource locator for messages specific to this validator.
// Ensure that you remove @generated or mark it @generated NOT
return super.getResourceLocator();
}
} //QuantitiesValidator
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<artifactId>de.hftstuttgart.cityunits.p2site</artifactId> <artifactId>de.hftstuttgart.cityunits.p2site</artifactId>
<packaging>eclipse-repository</packaging> <packaging>eclipse-repository</packaging>
<name>City Units P2 Site Generation</name> <name>City Units P2 Site Generation</name>
<parent> <parent>
<groupId>de.hftstuttgart</groupId> <groupId>de.hftstuttgart</groupId>
<artifactId>de.hftstuttgart.cityunits</artifactId> <artifactId>de.hftstuttgart.cityunits</artifactId>
<version>1.0.2</version> <version>1.1.0</version>
</parent> </parent>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<site> <site>
<feature url="features/de.hftstuttgart.cityunits.feature_1.0.2.jar" id="de.hftstuttgart.cityunits.feature" version="1.0.2"> <feature url="features/de.hftstuttgart.cityunits.feature_1.1.0.jar" id="de.hftstuttgart.cityunits.feature" version="1.1.0">
<category name="de.hftstuttgart.cityunits"/> <category name="de.hftstuttgart.cityunits"/>
</feature> </feature>
<category-def name="de.hftstuttgart.cityunits" label="HfT Stuttgart City Units"> <category-def name="de.hftstuttgart.cityunits" label="HfT Stuttgart City Units">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Create new or edit old `.target` file. Create new or edit old `.target` file.
In Target Definition editor add target definition file and add add six features from four P2 sites: In Target Definition editor add target definition file and add six features from four P2 sites:
* From the site for latest Eclipse release, e.g. `http://download.eclipse.org/releases/2020-12` add: `Eclipse RT Target Platform Components -> Equinox Target Components` and `General Purpose Tools -> Eclipse e4 Tools Developer Resources`. * From the site for latest Eclipse release, e.g. `http://download.eclipse.org/releases/2020-12` add: `Eclipse RT Target Platform Components -> Equinox Target Components` and `General Purpose Tools -> Eclipse e4 Tools Developer Resources`.
* From the site for latest Orbit release, e.g. `https://download.eclipse.org/tools/orbit/downloads/2020-12/` add: `JUnit` and `JUnit Jupiter API` from category `Orbit Bundles By Scope: Testing`. * From the site for latest Orbit release, e.g. `https://download.eclipse.org/tools/orbit/downloads/2020-12/` add: `JUnit` and `JUnit Jupiter API` from category `Orbit Bundles By Scope: Testing`.
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit"> <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<repository location="http://download.eclipse.org/ecp/releases/releases_target_125/"/> <repository location="http://download.eclipse.org/ecp/releases/releases_target_125/"/>
<unit id="org.eclipse.emf.ecp.emfforms.sdk.feature.feature.group" version="1.25.0.20200916-0800"/>
</location> </location>
</locations> </locations>
</target> </target>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment