Commit 9927dd26 authored by Kai-Holger Brassel's avatar Kai-Holger Brassel
Browse files

Add plug-ins for quantities (Indriya and City Units)

parent 7ac45c5d
......@@ -11,6 +11,8 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-15
Export-Package: org.example.democatalog.provider
Require-Bundle: org.eclipse.core.runtime,
org.example.democatalog;visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport,
org.example.democatalog.model;bundle-version="1.0.0"
de.hftstuttgart.cityunits.model;visibility:=reexport,
de.hftstuttgart.cityunits.model.edit;visibility:=reexport
Bundle-ActivationPolicy: lazy
......@@ -2,6 +2,7 @@
*/
package org.example.democatalog.provider;
import de.hftstuttgart.cityunits.model.quantities.provider.QuantitiesEditPlugin;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
......@@ -36,7 +37,7 @@ public final class DemocatalogEditPlugin extends EMFPlugin {
* @generated
*/
public DemocatalogEditPlugin() {
super(new ResourceLocator[] {});
super(new ResourceLocator[] { QuantitiesEditPlugin.INSTANCE, });
}
/**
......
......@@ -63,7 +63,7 @@ public class InverterItemProvider extends ElectricalDeviceItemProvider {
getString("_UI_PropertyDescriptor_description", "_UI_Inverter_maxDCVoltage_feature",
"_UI_Inverter_type"),
DemocatalogPackage.Literals.INVERTER__MAX_DC_VOLTAGE, true, false, false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null));
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
......@@ -79,7 +79,7 @@ public class InverterItemProvider extends ElectricalDeviceItemProvider {
getString("_UI_PropertyDescriptor_description", "_UI_Inverter_macDCCurrent_feature",
"_UI_Inverter_type"),
DemocatalogPackage.Literals.INVERTER__MAC_DC_CURRENT, true, false, false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null));
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
......
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.example.democatalog.model;singleton:=true
Bundle-SymbolicName: org.example.democatalog;singleton:=true
Automatic-Module-Name: org.example.democatalog
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
......@@ -12,5 +12,6 @@ Export-Package: org.example.democatalog,
org.example.democatalog.impl,
org.example.democatalog.util
Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport,
de.hftstuttgart.cityunits.model;visibility:=reexport,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
......@@ -3,9 +3,11 @@
<viewpoint:DAnalysis uid="_HZnjoCHUEeuLPpz77IfmqA" selectedViews="_HikEQCHUEeuLPpz77IfmqA" version="14.3.1.202003261200">
<semanticResources>democatalog.ecore</semanticResources>
<semanticResources>democatalog.genmodel</semanticResources>
<semanticResources>platform:/resource/de.hftstuttgart.cityunits.model/model/Quantities.ecore</semanticResources>
<semanticResources>platform:/resource/de.hftstuttgart.cityunits.model/model/Quantities.genmodel</semanticResources>
<ownedViews xmi:type="viewpoint:DView" uid="_HikEQCHUEeuLPpz77IfmqA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_HkPfQCHUEeuLPpz77IfmqA" name="democatalog" repPath="#_Hji7sCHUEeuLPpz77IfmqA" changeId="19235c9b-0cc2-4f1a-9aa8-7069bd7e5fa2">
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_HkPfQCHUEeuLPpz77IfmqA" name="democatalog" repPath="#_Hji7sCHUEeuLPpz77IfmqA" changeId="eeb8279a-74c0-4f63-8743-3f1144ab1d0a">
<description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
<target xmi:type="ecore:EPackage" href="democatalog.ecore#/"/>
</ownedRepresentationDescriptors>
......@@ -505,7 +507,7 @@
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_h6CGcCIEEeuUrYII4OYxLg" name="maxDCVoltage : EDouble = 0.0" tooltipText="">
<ownedElements xmi:type="diagram:DNodeListElement" uid="_h6CGcCIEEeuUrYII4OYxLg" name="maxDCVoltage : QuantityDouble = 0.0 V" tooltipText="">
<target xmi:type="ecore:EAttribute" href="democatalog.ecore#//Inverter/maxDCVoltage"/>
<semanticElements xmi:type="ecore:EAttribute" href="democatalog.ecore#//Inverter/maxDCVoltage"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_sAIMsSIEEeuUrYII4OYxLg" labelAlignment="LEFT" description="_hEX5gCHzEeuUrYII4OYxLg">
......
......@@ -35,9 +35,11 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Inverter" eSuperTypes="#//ElectricalDevice">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maxDCVoltage" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble" defaultValueLiteral="0.0"/>
eType="ecore:EDataType ../../de.hftstuttgart.cityunits.model/model/Quantities.ecore#//QuantityDouble"
defaultValueLiteral="0.0 V"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="macDCCurrent" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble" defaultValueLiteral="0.0"/>
eType="ecore:EDataType ../../de.hftstuttgart.cityunits.model/model/Quantities.ecore#//QuantityDouble"
defaultValueLiteral="100.0 mV"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Manufacturer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
......
......@@ -5,7 +5,8 @@
editDirectory="/org.example.democatalog.edit/src-gen" editorDirectory="/org.example.democatalog.editor/src-gen"
modelPluginID="org.example.democatalog" modelName="Democatalog" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="15.0"
copyrightFields="false" operationReflection="true" importOrganizing="true">
copyrightFields="false" usedGenPackages="../../de.hftstuttgart.cityunits.model/model/Quantities.genmodel#//quantities"
operationReflection="true" importOrganizing="true">
<foreignModel>democatalog.ecore</foreignModel>
<testsDirectory xsi:nil="true"/>
<genPackages prefix="Democatalog" basePackage="org.example" disposableProviderFactory="true"
......
......@@ -2,6 +2,8 @@
*/
package org.example.democatalog;
import de.hftstuttgart.cityunits.model.NullableQuantity;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Inverter</b></em>'.
......@@ -22,16 +24,16 @@ package org.example.democatalog;
public interface Inverter extends ElectricalDevice {
/**
* Returns the value of the '<em><b>Max DC Voltage</b></em>' attribute.
* The default value is <code>"0.0"</code>.
* The default value is <code>"0.0 V"</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Max DC Voltage</em>' attribute.
* @see #setMaxDCVoltage(double)
* @see #setMaxDCVoltage(NullableQuantity)
* @see org.example.democatalog.DemocatalogPackage#getInverter_MaxDCVoltage()
* @model default="0.0" required="true"
* @model default="0.0 V" dataType="de.hftstuttgart.cityunits.model.quantities.QuantityDouble" required="true"
* @generated
*/
double getMaxDCVoltage();
NullableQuantity getMaxDCVoltage();
/**
* Sets the value of the '{@link org.example.democatalog.Inverter#getMaxDCVoltage <em>Max DC Voltage</em>}' attribute.
......@@ -41,20 +43,20 @@ public interface Inverter extends ElectricalDevice {
* @see #getMaxDCVoltage()
* @generated
*/
void setMaxDCVoltage(double value);
void setMaxDCVoltage(NullableQuantity value);
/**
* Returns the value of the '<em><b>Mac DC Current</b></em>' attribute.
* The default value is <code>"0.0"</code>.
* The default value is <code>"100.0 mV"</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Mac DC Current</em>' attribute.
* @see #setMacDCCurrent(double)
* @see #setMacDCCurrent(NullableQuantity)
* @see org.example.democatalog.DemocatalogPackage#getInverter_MacDCCurrent()
* @model default="0.0" required="true"
* @model default="100.0 mV" dataType="de.hftstuttgart.cityunits.model.quantities.QuantityDouble" required="true"
* @generated
*/
double getMacDCCurrent();
NullableQuantity getMacDCCurrent();
/**
* Sets the value of the '{@link org.example.democatalog.Inverter#getMacDCCurrent <em>Mac DC Current</em>}' attribute.
......@@ -64,6 +66,6 @@ public interface Inverter extends ElectricalDevice {
* @see #getMacDCCurrent()
* @generated
*/
void setMacDCCurrent(double value);
void setMacDCCurrent(NullableQuantity value);
} // Inverter
......@@ -2,6 +2,7 @@
*/
package org.example.democatalog.impl;
import de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
......@@ -150,6 +151,9 @@ public class DemocatalogPackageImpl extends EPackageImpl implements DemocatalogP
isInited = true;
// Initialize simple dependencies
QuantitiesPackage.eINSTANCE.eClass();
// Create package meta-data objects
theDemocatalogPackage.createPackageContents();
......@@ -538,6 +542,10 @@ public class DemocatalogPackageImpl extends EPackageImpl implements DemocatalogP
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
QuantitiesPackage theQuantitiesPackage = (QuantitiesPackage) EPackage.Registry.INSTANCE
.getEPackage(QuantitiesPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
......@@ -593,11 +601,11 @@ public class DemocatalogPackageImpl extends EPackageImpl implements DemocatalogP
initEClass(inverterEClass, Inverter.class, "Inverter", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getInverter_MaxDCVoltage(), ecorePackage.getEDouble(), "maxDCVoltage", "0.0", 1, 1,
Inverter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
initEAttribute(getInverter_MaxDCVoltage(), theQuantitiesPackage.getQuantityDouble(), "maxDCVoltage", "0.0 V", 1,
1, Inverter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
initEAttribute(getInverter_MacDCCurrent(), ecorePackage.getEDouble(), "macDCCurrent", "0.0", 1, 1,
Inverter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
initEAttribute(getInverter_MacDCCurrent(), theQuantitiesPackage.getQuantityDouble(), "macDCCurrent", "100.0 mV",
1, 1, Inverter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
initEClass(manufacturerEClass, Manufacturer.class, "Manufacturer", !IS_ABSTRACT, !IS_INTERFACE,
......
......@@ -2,6 +2,9 @@
*/
package org.example.democatalog.impl;
import de.hftstuttgart.cityunits.model.NullableQuantity;
import de.hftstuttgart.cityunits.model.quantities.QuantitiesFactory;
import de.hftstuttgart.cityunits.model.quantities.QuantitiesPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
......@@ -34,7 +37,8 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
* @ordered
*/
protected static final double MAX_DC_VOLTAGE_EDEFAULT = 0.0;
protected static final NullableQuantity MAX_DC_VOLTAGE_EDEFAULT = (NullableQuantity) QuantitiesFactory.eINSTANCE
.createFromString(QuantitiesPackage.eINSTANCE.getQuantityDouble(), "0.0 V");
/**
* The cached value of the '{@link #getMaxDCVoltage() <em>Max DC Voltage</em>}' attribute.
......@@ -44,7 +48,7 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
* @ordered
*/
protected double maxDCVoltage = MAX_DC_VOLTAGE_EDEFAULT;
protected NullableQuantity maxDCVoltage = MAX_DC_VOLTAGE_EDEFAULT;
/**
* The default value of the '{@link #getMacDCCurrent() <em>Mac DC Current</em>}' attribute.
......@@ -54,7 +58,8 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
* @ordered
*/
protected static final double MAC_DC_CURRENT_EDEFAULT = 0.0;
protected static final NullableQuantity MAC_DC_CURRENT_EDEFAULT = (NullableQuantity) QuantitiesFactory.eINSTANCE
.createFromString(QuantitiesPackage.eINSTANCE.getQuantityDouble(), "100.0 mV");
/**
* The cached value of the '{@link #getMacDCCurrent() <em>Mac DC Current</em>}' attribute.
......@@ -64,7 +69,7 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
* @ordered
*/
protected double macDCCurrent = MAC_DC_CURRENT_EDEFAULT;
protected NullableQuantity macDCCurrent = MAC_DC_CURRENT_EDEFAULT;
/**
* <!-- begin-user-doc -->
......@@ -91,7 +96,7 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
*/
@Override
public double getMaxDCVoltage() {
public NullableQuantity getMaxDCVoltage() {
return maxDCVoltage;
}
......@@ -101,8 +106,8 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
*/
@Override
public void setMaxDCVoltage(double newMaxDCVoltage) {
double oldMaxDCVoltage = maxDCVoltage;
public void setMaxDCVoltage(NullableQuantity newMaxDCVoltage) {
NullableQuantity oldMaxDCVoltage = maxDCVoltage;
maxDCVoltage = newMaxDCVoltage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DemocatalogPackage.INVERTER__MAX_DC_VOLTAGE,
......@@ -115,7 +120,7 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
*/
@Override
public double getMacDCCurrent() {
public NullableQuantity getMacDCCurrent() {
return macDCCurrent;
}
......@@ -125,8 +130,8 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
* @generated
*/
@Override
public void setMacDCCurrent(double newMacDCCurrent) {
double oldMacDCCurrent = macDCCurrent;
public void setMacDCCurrent(NullableQuantity newMacDCCurrent) {
NullableQuantity oldMacDCCurrent = macDCCurrent;
macDCCurrent = newMacDCCurrent;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DemocatalogPackage.INVERTER__MAC_DC_CURRENT,
......@@ -158,10 +163,10 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DemocatalogPackage.INVERTER__MAX_DC_VOLTAGE:
setMaxDCVoltage((Double) newValue);
setMaxDCVoltage((NullableQuantity) newValue);
return;
case DemocatalogPackage.INVERTER__MAC_DC_CURRENT:
setMacDCCurrent((Double) newValue);
setMacDCCurrent((NullableQuantity) newValue);
return;
}
super.eSet(featureID, newValue);
......@@ -194,9 +199,11 @@ public class InverterImpl extends ElectricalDeviceImpl implements Inverter {
public boolean eIsSet(int featureID) {
switch (featureID) {
case DemocatalogPackage.INVERTER__MAX_DC_VOLTAGE:
return maxDCVoltage != MAX_DC_VOLTAGE_EDEFAULT;
return MAX_DC_VOLTAGE_EDEFAULT == null ? maxDCVoltage != null
: !MAX_DC_VOLTAGE_EDEFAULT.equals(maxDCVoltage);
case DemocatalogPackage.INVERTER__MAC_DC_CURRENT:
return macDCCurrent != MAC_DC_CURRENT_EDEFAULT;
return MAC_DC_CURRENT_EDEFAULT == null ? macDCCurrent != null
: !MAC_DC_CURRENT_EDEFAULT.equals(macDCCurrent);
}
return super.eIsSet(featureID);
}
......
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