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
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
[Baeldung: Introduction to javax.measure](https://www.baeldung.com/javax-measure).
......
......@@ -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"
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="LocalTime" instanceClassName="java.time.LocalTime"/>
<eClassifiers xsi:type="ecore:EDataType" name="TimeOfDay" instanceClassName="java.time.LocalTime"/>
</ecore:EPackage>
......@@ -8,6 +8,6 @@
<genPackages prefix="Quantities" basePackage="de.hftstuttgart.cityunits.model" disposableProviderFactory="true"
ecorePackage="Quantities.ecore#/">
<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>
</genmodel:GenModel>
......@@ -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 -->
* <!-- end-user-doc -->
* @see java.time.LocalTime
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getLocalTime()
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getTimeOfDay()
* @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>}'.
......@@ -88,15 +87,15 @@ public interface QuantitiesPackage extends EPackage {
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 -->
* <!-- 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
* @model instanceClass="java.time.LocalTime"
* @generated
*/
EDataType getLocalTime();
EDataType getTimeOfDay();
/**
* Returns the factory that creates the instances of the model.
......@@ -131,14 +130,14 @@ public interface QuantitiesPackage extends EPackage {
*/
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 -->
* <!-- end-user-doc -->
* @see java.time.LocalTime
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getLocalTime()
* @see de.hftstuttgart.cityunits.model.quantities.impl.QuantitiesPackageImpl#getTimeOfDay()
* @generated
*/
EDataType LOCAL_TIME = eINSTANCE.getLocalTime();
EDataType TIME_OF_DAY = eINSTANCE.getTimeOfDay();
}
......
......@@ -74,8 +74,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY:
return createQuantityFromString(eDataType, initialValue);
case QuantitiesPackage.LOCAL_TIME:
return createLocalTimeFromString(eDataType, initialValue);
case QuantitiesPackage.TIME_OF_DAY:
return createTimeOfDayFromString(eDataType, initialValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
......@@ -91,8 +91,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
switch (eDataType.getClassifierID()) {
case QuantitiesPackage.QUANTITY:
return convertQuantityToString(eDataType, instanceValue);
case QuantitiesPackage.LOCAL_TIME:
return convertLocalTimeToString(eDataType, instanceValue);
case QuantitiesPackage.TIME_OF_DAY:
return convertTimeOfDayToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
......@@ -130,8 +130,8 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc -->
* @generated
*/
public LocalTime createLocalTime(final String it) {
return java.time.LocalTime.parse(it);
public LocalTime createTimeOfDayFromString(EDataType eDataType, String initialValue) {
return (LocalTime)super.createFromString(eDataType, initialValue);
}
/**
......@@ -139,16 +139,7 @@ public class QuantitiesFactoryImpl extends EFactoryImpl implements QuantitiesFac
* <!-- end-user-doc -->
* @generated
*/
public LocalTime createLocalTimeFromString(EDataType eDataType, String initialValue) {
return createLocalTime(initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertLocalTimeToString(EDataType eDataType, Object instanceValue) {
public String convertTimeOfDayToString(EDataType eDataType, Object instanceValue) {
return super.convertToString(eDataType, instanceValue);
}
......
......@@ -29,7 +29,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* <!-- end-user-doc -->
* @generated
*/
private EDataType localTimeEDataType = null;
private EDataType timeOfDayEDataType = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
......@@ -108,8 +108,8 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
* @generated
*/
@Override
public EDataType getLocalTime() {
return localTimeEDataType;
public EDataType getTimeOfDay() {
return timeOfDayEDataType;
}
/**
......@@ -142,7 +142,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Create data types
quantityEDataType = createEDataType(QUANTITY);
localTimeEDataType = createEDataType(LOCAL_TIME);
timeOfDayEDataType = createEDataType(TIME_OF_DAY);
}
/**
......@@ -170,7 +170,7 @@ public class QuantitiesPackageImpl extends EPackageImpl implements QuantitiesPac
// Initialize data types
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
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