Commit 3f5a8a3b authored by Kai-Holger Brassel's avatar Kai-Holger Brassel
Browse files

Correct type name and README

parent 987f6d41
Pipeline #6097 failed with stage
in 20 seconds
...@@ -4,7 +4,7 @@ Create Eclipse P2 repository with Ecore data type `Quantity` for units based on ...@@ -4,7 +4,7 @@ Create Eclipse P2 repository with Ecore data type `Quantity` for units based on
Also adds another Ecore data type `TimeOfDay` useful to model schedules and the like. Also adds another Ecore data type `TimeOfDay` useful to model schedules and the like.
To install this feature in an Eclipse application add site [https://transfer.hft-stuttgart.de/pages/neqmodplus/de.hft-stuttgart.cityunits/p2repo]() via `Eclipse -> Help -> Install New Software...` and select _City Units_ (If nothing can be selected, ensure that _Group items by category_ is ticked.) To install this feature in an Eclipse application add site [https://transfer.hft-stuttgart.de/pages/neqmodplus/de.hft-stuttgart.cityunits/p2repo]() via `Eclipse -> Help -> Install New Software...` and select _City Units_.
For an introduction on dealing with units in Java, see For an introduction on dealing with units in Java, see
[Baeldung: Introduction to javax.measure](https://www.baeldung.com/javax-measure). [Baeldung: Introduction to javax.measure](https://www.baeldung.com/javax-measure).
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
<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="Quantity" 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="LocalTime" instanceClassName="java.time.LocalTime"/> <eClassifiers xsi:type="ecore:EDataType" name="TimeOfDay" instanceClassName="java.time.LocalTime"/>
</ecore:EPackage> </ecore:EPackage>
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<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#//Quantity" create="return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);"/> <genDataTypes ecoreDataType="Quantities.ecore#//Quantity" create="return de.hftstuttgart.cityunits.model.NullableQuantity.create(it);"/>
<genDataTypes ecoreDataType="Quantities.ecore#//LocalTime" create="return java.time.LocalTime.parse(it);"/> <genDataTypes ecoreDataType="Quantities.ecore#//TimeOfDay"/>
</genPackages> </genPackages>
</genmodel:GenModel> </genmodel:GenModel>
...@@ -66,15 +66,14 @@ public interface QuantitiesPackage extends EPackage { ...@@ -66,15 +66,14 @@ public interface QuantitiesPackage extends EPackage {
/** /**
* The meta object id for the '<em>Local Time</em>' data type. * The meta object id for the '<em>Time Of Day</em>' data type.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see java.time.LocalTime * @see java.time.LocalTime
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getLocalTime() * @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getTimeOfDay()
* @generated * @generated
*/ */
int LOCAL_TIME = 1; int TIME_OF_DAY = 1;
/** /**
* Returns the meta object for data type '{@link de.hftstuttgart.cityunits.model.NullableQuantity <em>Quantity</em>}'. * Returns the meta object for data type '{@link de.hftstuttgart.cityunits.model.NullableQuantity <em>Quantity</em>}'.
...@@ -88,15 +87,15 @@ public interface QuantitiesPackage extends EPackage { ...@@ -88,15 +87,15 @@ public interface QuantitiesPackage extends EPackage {
EDataType getQuantity(); EDataType getQuantity();
/** /**
* Returns the meta object for data type '{@link java.time.LocalTime <em>Local Time</em>}'. * Returns the meta object for data type '{@link java.time.LocalTime <em>Time Of Day</em>}'.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @return the meta object for data type '<em>Local Time</em>'. * @return the meta object for data type '<em>Time Of Day</em>'.
* @see java.time.LocalTime * @see java.time.LocalTime
* @model instanceClass="java.time.LocalTime" * @model instanceClass="java.time.LocalTime"
* @generated * @generated
*/ */
EDataType getLocalTime(); EDataType getTimeOfDay();
/** /**
* Returns the factory that creates the instances of the model. * Returns the factory that creates the instances of the model.
...@@ -131,14 +130,14 @@ public interface QuantitiesPackage extends EPackage { ...@@ -131,14 +130,14 @@ public interface QuantitiesPackage extends EPackage {
*/ */
EDataType QUANTITY = eINSTANCE.getQuantity(); EDataType QUANTITY = eINSTANCE.getQuantity();
/** /**
* The meta object literal for the '<em>Local Time</em>' data type. * The meta object literal for the '<em>Time Of Day</em>' data type.
* <!-- begin-user-doc --> * <!-- begin-user-doc -->
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @see java.time.LocalTime * @see java.time.LocalTime
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getLocalTime() * @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getTimeOfDay()
* @generated * @generated
*/ */
EDataType LOCAL_TIME = eINSTANCE.getLocalTime(); EDataType TIME_OF_DAY = eINSTANCE.getTimeOfDay();
} }
......
...@@ -74,8 +74,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -74,8 +74,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
switch (eDataType.getClassifierID()) { switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY: case QuantitiesPackage.QUANTITY:
return createQuantityFromString(eDataType, initialValue); return createQuantityFromString(eDataType, initialValue);
case QuantitiesPackage.LOCAL_TIME: case QuantitiesPackage.TIME_OF_DAY:
return createLocalTimeFromString(eDataType, initialValue); return createTimeOfDayFromString(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");
} }
...@@ -91,8 +91,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -91,8 +91,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
switch (eDataType.getClassifierID()) { switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY: case QuantitiesPackage.QUANTITY:
return convertQuantityToString(eDataType, instanceValue); return convertQuantityToString(eDataType, instanceValue);
case QuantitiesPackage.LOCAL_TIME: case QuantitiesPackage.TIME_OF_DAY:
return convertLocalTimeToString(eDataType, instanceValue); return convertTimeOfDayToString(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");
} }
...@@ -130,8 +130,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -130,8 +130,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
public LocalTime createLocalTime(final String it) { public LocalTime createTimeOfDayFromString(EDataType eDataType, String initialValue) {
return java.time.LocalTime.parse(it); return (LocalTime)super.createFromString(eDataType, initialValue);
} }
/** /**
...@@ -139,16 +139,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac ...@@ -139,16 +139,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
public LocalTime createLocalTimeFromString(EDataType eDataType, String initialValue) { public String convertTimeOfDayToString(EDataType eDataType, Object instanceValue) {
return createLocalTime(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertLocalTimeToString(EDataType eDataType, Object instanceValue) {
return super.convertToString(eDataType, instanceValue); return super.convertToString(eDataType, instanceValue);
} }
......
...@@ -29,7 +29,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -29,7 +29,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* <!-- end-user-doc --> * <!-- end-user-doc -->
* @generated * @generated
*/ */
private EDataType localTimeEDataType = null; private EDataType timeOfDayEDataType = null;
/** /**
* Creates an instance of the model <b>Package</b>, registered with * Creates an instance of the model <b>Package</b>, registered with
...@@ -108,8 +108,8 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -108,8 +108,8 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* @generated * @generated
*/ */
@Override @Override
public EDataType getLocalTime() { public EDataType getTimeOfDay() {
return localTimeEDataType; return timeOfDayEDataType;
} }
/** /**
...@@ -142,7 +142,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -142,7 +142,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Create data types // Create data types
quantityEDataType = createEDataType(QUANTITY); quantityEDataType = createEDataType(QUANTITY);
localTimeEDataType = createEDataType(LOCAL_TIME); timeOfDayEDataType = createEDataType(TIME_OF_DAY);
} }
/** /**
...@@ -170,7 +170,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac ...@@ -170,7 +170,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Initialize data types // Initialize data types
initEDataType(quantityEDataType, NullableQuantity.class, "Quantity", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); initEDataType(quantityEDataType, NullableQuantity.class, "Quantity", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
initEDataType(localTimeEDataType, LocalTime.class, "LocalTime", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); initEDataType(timeOfDayEDataType, LocalTime.class, "TimeOfDay", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
// Create resource // Create resource
createResource(eNS_URI); createResource(eNS_URI);
......
Markdown is supported
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