Skip to content
Snippets Groups Projects
Commit 8178aa69 authored by Bernhard Johannes Berger's avatar Bernhard Johannes Berger
Browse files

ddl::DataDescription is also a valid Definition. Therefore, it has to derive from Definition. #54

parent 1180b432
No related branches found
No related tags found
No related merge requests found
Pipeline #306748 passed
Showing
with 51 additions and 133 deletions
......@@ -85,17 +85,12 @@
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataDescription" abstract="true">
<eClassifiers xsi:type="ecore:EClass" name="DataDescription" abstract="true" eSuperTypes="../../de.evoal.languages.model.base/model/model.ecore#//Definition">
<eOperations name="getScale" eType="#//ScaleType">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the associated scale if existing."/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Name of the described data."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="constraints" ordered="false"
upperBound="-1" eType="ecore:EClass ../../de.evoal.languages.model.base/model/model.ecore#//Expression"
containment="true">
......
......@@ -39,7 +39,6 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference model.ecore#//DataTypeDefinition/constraints"/>
</genClasses>
<genClasses ecoreClass="model.ecore#//DataDescription">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//DataDescription/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference model.ecore#//DataDescription/constraints"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//DataDescription/representation"/>
<genOperations ecoreOperation="model.ecore#//DataDescription/getScale"/>
......
......@@ -2,12 +2,11 @@
*/
package de.evoal.languages.model.ddl;
import de.evoal.languages.model.base.Definition;
import de.evoal.languages.model.base.Expression;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Data Description</b></em>'.
......@@ -17,7 +16,6 @@ import org.eclipse.emf.ecore.EObject;
* The following features are supported:
* </p>
* <ul>
* <li>{@link de.evoal.languages.model.ddl.DataDescription#getName <em>Name</em>}</li>
* <li>{@link de.evoal.languages.model.ddl.DataDescription#getConstraints <em>Constraints</em>}</li>
* <li>{@link de.evoal.languages.model.ddl.DataDescription#getRepresentation <em>Representation</em>}</li>
* </ul>
......@@ -26,32 +24,7 @@ import org.eclipse.emf.ecore.EObject;
* @model abstract="true"
* @generated
*/
public interface DataDescription extends EObject {
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Name of the described data.
* <!-- end-model-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see de.evoal.languages.model.ddl.DdlPackage#getDataDescription_Name()
* @model required="true"
* @generated
*/
String getName();
/**
* Sets the value of the '{@link de.evoal.languages.model.ddl.DataDescription#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
public interface DataDescription extends Definition {
/**
* Returns the value of the '<em><b>Constraints</b></em>' containment reference list.
* The list contents are of type {@link de.evoal.languages.model.base.Expression}.
......
......@@ -195,7 +195,7 @@ public interface DdlPackage extends EPackage {
* @generated
* @ordered
*/
int DATA_DESCRIPTION__NAME = 0;
int DATA_DESCRIPTION__NAME = BasePackage.DEFINITION__NAME;
/**
* The feature id for the '<em><b>Constraints</b></em>' containment reference list.
......@@ -204,7 +204,7 @@ public interface DdlPackage extends EPackage {
* @generated
* @ordered
*/
int DATA_DESCRIPTION__CONSTRAINTS = 1;
int DATA_DESCRIPTION__CONSTRAINTS = BasePackage.DEFINITION_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>Representation</b></em>' attribute.
......@@ -213,7 +213,7 @@ public interface DdlPackage extends EPackage {
* @generated
* @ordered
*/
int DATA_DESCRIPTION__REPRESENTATION = 2;
int DATA_DESCRIPTION__REPRESENTATION = BasePackage.DEFINITION_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Data Description</em>' class.
......@@ -222,7 +222,7 @@ public interface DdlPackage extends EPackage {
* @generated
* @ordered
*/
int DATA_DESCRIPTION_FEATURE_COUNT = 3;
int DATA_DESCRIPTION_FEATURE_COUNT = BasePackage.DEFINITION_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link de.evoal.languages.model.ddl.impl.TypedDataDescriptionImpl <em>Typed Data Description</em>}' class.
......@@ -531,17 +531,6 @@ public interface DdlPackage extends EPackage {
*/
EClass getDataDescription();
/**
* Returns the meta object for the attribute '{@link de.evoal.languages.model.ddl.DataDescription#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see de.evoal.languages.model.ddl.DataDescription#getName()
* @see #getDataDescription()
* @generated
*/
EAttribute getDataDescription_Name();
/**
* Returns the meta object for the containment reference list '{@link de.evoal.languages.model.ddl.DataDescription#getConstraints <em>Constraints</em>}'.
* <!-- begin-user-doc -->
......@@ -781,14 +770,6 @@ public interface DdlPackage extends EPackage {
*/
EClass DATA_DESCRIPTION = eINSTANCE.getDataDescription();
/**
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute DATA_DESCRIPTION__NAME = eINSTANCE.getDataDescription_Name();
/**
* The meta object literal for the '<em><b>Constraints</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
......
......@@ -4,6 +4,7 @@ package de.evoal.languages.model.ddl.impl;
import de.evoal.languages.model.base.Expression;
import de.evoal.languages.model.base.impl.DefinitionImpl;
import de.evoal.languages.model.ddl.DataDescription;
import de.evoal.languages.model.ddl.DdlPackage;
import de.evoal.languages.model.ddl.RepresentationType;
......@@ -20,8 +21,6 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
......@@ -33,34 +32,13 @@ import org.eclipse.emf.ecore.util.InternalEList;
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.evoal.languages.model.ddl.impl.DataDescriptionImpl#getName <em>Name</em>}</li>
* <li>{@link de.evoal.languages.model.ddl.impl.DataDescriptionImpl#getConstraints <em>Constraints</em>}</li>
* <li>{@link de.evoal.languages.model.ddl.impl.DataDescriptionImpl#getRepresentation <em>Representation</em>}</li>
* </ul>
*
* @generated
*/
public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container implements DataDescription {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
public abstract class DataDescriptionImpl extends DefinitionImpl implements DataDescription {
/**
* The cached value of the '{@link #getConstraints() <em>Constraints</em>}' containment reference list.
* <!-- begin-user-doc -->
......@@ -110,29 +88,6 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
return DdlPackage.Literals.DATA_DESCRIPTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DdlPackage.DATA_DESCRIPTION__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
......@@ -203,8 +158,6 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DdlPackage.DATA_DESCRIPTION__NAME:
return getName();
case DdlPackage.DATA_DESCRIPTION__CONSTRAINTS:
return getConstraints();
case DdlPackage.DATA_DESCRIPTION__REPRESENTATION:
......@@ -222,9 +175,6 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DdlPackage.DATA_DESCRIPTION__NAME:
setName((String)newValue);
return;
case DdlPackage.DATA_DESCRIPTION__CONSTRAINTS:
getConstraints().clear();
getConstraints().addAll((Collection<? extends Expression>)newValue);
......@@ -244,9 +194,6 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DdlPackage.DATA_DESCRIPTION__NAME:
setName(NAME_EDEFAULT);
return;
case DdlPackage.DATA_DESCRIPTION__CONSTRAINTS:
getConstraints().clear();
return;
......@@ -265,8 +212,6 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DdlPackage.DATA_DESCRIPTION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case DdlPackage.DATA_DESCRIPTION__CONSTRAINTS:
return constraints != null && !constraints.isEmpty();
case DdlPackage.DATA_DESCRIPTION__REPRESENTATION:
......@@ -285,9 +230,7 @@ public abstract class DataDescriptionImpl extends MinimalEObjectImpl.Container i
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", representation: ");
result.append(" (representation: ");
result.append(representation);
result.append(')');
return result.toString();
......
......@@ -277,16 +277,6 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
return dataDescriptionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EAttribute getDataDescription_Name() {
return (EAttribute)dataDescriptionEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
......@@ -294,7 +284,7 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
*/
@Override
public EReference getDataDescription_Constraints() {
return (EReference)dataDescriptionEClass.getEStructuralFeatures().get(1);
return (EReference)dataDescriptionEClass.getEStructuralFeatures().get(0);
}
/**
......@@ -304,7 +294,7 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
*/
@Override
public EAttribute getDataDescription_Representation() {
return (EAttribute)dataDescriptionEClass.getEStructuralFeatures().get(2);
return (EAttribute)dataDescriptionEClass.getEStructuralFeatures().get(1);
}
/**
......@@ -440,7 +430,6 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
createEReference(dataTypeDefinitionEClass, DATA_TYPE_DEFINITION__CONSTRAINTS);
dataDescriptionEClass = createEClass(DATA_DESCRIPTION);
createEAttribute(dataDescriptionEClass, DATA_DESCRIPTION__NAME);
createEReference(dataDescriptionEClass, DATA_DESCRIPTION__CONSTRAINTS);
createEAttribute(dataDescriptionEClass, DATA_DESCRIPTION__REPRESENTATION);
......@@ -491,6 +480,7 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
// Set bounds for type parameters
// Add supertypes to classes
dataDescriptionEClass.getESuperTypes().add(theBasePackage.getDefinition());
typedDataDescriptionEClass.getESuperTypes().add(this.getDataDescription());
untypedDataDescriptionEClass.getESuperTypes().add(this.getDataDescription());
dataReferenceEClass.getESuperTypes().add(theBasePackage.getValueReference());
......@@ -511,7 +501,6 @@ public class DdlPackageImpl extends EPackageImpl implements DdlPackage {
initEReference(getDataTypeDefinition_Constraints(), theBasePackage.getExpression(), null, "constraints", null, 0, -1, DataTypeDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(dataDescriptionEClass, DataDescription.class, "DataDescription", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getDataDescription_Name(), ecorePackage.getEString(), "name", null, 1, 1, DataDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getDataDescription_Constraints(), theBasePackage.getExpression(), null, "constraints", null, 0, -1, DataDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getDataDescription_Representation(), this.getRepresentationType(), "representation", "real", 1, 1, DataDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
......
......@@ -2,6 +2,7 @@
*/
package de.evoal.languages.model.ddl.util;
import de.evoal.languages.model.base.Definition;
import de.evoal.languages.model.base.Value;
import de.evoal.languages.model.base.ValueReference;
......@@ -99,6 +100,10 @@ public class DdlAdapterFactory extends AdapterFactoryImpl {
return createSelfReferenceAdapter();
}
@Override
public Adapter caseDefinition(Definition object) {
return createDefinitionAdapter();
}
@Override
public Adapter caseValue(Value object) {
return createValueAdapter();
}
......@@ -224,6 +229,20 @@ public class DdlAdapterFactory extends AdapterFactoryImpl {
return null;
}
/**
* Creates a new adapter for an object of class '{@link de.evoal.languages.model.base.Definition <em>Definition</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see de.evoal.languages.model.base.Definition
* @generated
*/
public Adapter createDefinitionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link de.evoal.languages.model.base.Value <em>Value</em>}'.
* <!-- begin-user-doc -->
......
......@@ -2,6 +2,7 @@
*/
package de.evoal.languages.model.ddl.util;
import de.evoal.languages.model.base.Definition;
import de.evoal.languages.model.base.Value;
import de.evoal.languages.model.base.ValueReference;
......@@ -84,6 +85,7 @@ public class DdlSwitch<T> extends Switch<T> {
case DdlPackage.DATA_DESCRIPTION: {
DataDescription dataDescription = (DataDescription)theEObject;
T result = caseDataDescription(dataDescription);
if (result == null) result = caseDefinition(dataDescription);
if (result == null) result = defaultCase(theEObject);
return result;
}
......@@ -91,6 +93,7 @@ public class DdlSwitch<T> extends Switch<T> {
TypedDataDescription typedDataDescription = (TypedDataDescription)theEObject;
T result = caseTypedDataDescription(typedDataDescription);
if (result == null) result = caseDataDescription(typedDataDescription);
if (result == null) result = caseDefinition(typedDataDescription);
if (result == null) result = defaultCase(theEObject);
return result;
}
......@@ -98,6 +101,7 @@ public class DdlSwitch<T> extends Switch<T> {
UntypedDataDescription untypedDataDescription = (UntypedDataDescription)theEObject;
T result = caseUntypedDataDescription(untypedDataDescription);
if (result == null) result = caseDataDescription(untypedDataDescription);
if (result == null) result = caseDefinition(untypedDataDescription);
if (result == null) result = defaultCase(theEObject);
return result;
}
......@@ -226,6 +230,21 @@ public class DdlSwitch<T> extends Switch<T> {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Definition</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Definition</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDefinition(Definition object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Value</em>'.
* <!-- begin-user-doc -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment