|
@@ -1,46 +1,44 @@
|
|
|
/**
|
|
/**
|
|
|
- * <copyright>
|
|
|
|
|
- * </copyright>
|
|
|
|
|
- *
|
|
|
|
|
- * $Id$
|
|
|
|
|
*/
|
|
*/
|
|
|
package org.yakindu.base.types.impl;
|
|
package org.yakindu.base.types.impl;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import org.eclipse.emf.common.notify.Notification;
|
|
import org.eclipse.emf.common.notify.Notification;
|
|
|
-import org.eclipse.emf.common.notify.NotificationChain;
|
|
|
|
|
|
|
+
|
|
|
import org.eclipse.emf.common.util.EList;
|
|
import org.eclipse.emf.common.util.EList;
|
|
|
|
|
+
|
|
|
import org.eclipse.emf.ecore.EClass;
|
|
import org.eclipse.emf.ecore.EClass;
|
|
|
import org.eclipse.emf.ecore.InternalEObject;
|
|
import org.eclipse.emf.ecore.InternalEObject;
|
|
|
|
|
+
|
|
|
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
|
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
|
|
import org.eclipse.emf.ecore.impl.EObjectImpl;
|
|
import org.eclipse.emf.ecore.impl.EObjectImpl;
|
|
|
|
|
+
|
|
|
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
|
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
|
|
-import org.eclipse.emf.ecore.util.EcoreUtil;
|
|
|
|
|
|
|
+
|
|
|
import org.yakindu.base.base.BasePackage;
|
|
import org.yakindu.base.base.BasePackage;
|
|
|
import org.yakindu.base.base.NamedElement;
|
|
import org.yakindu.base.base.NamedElement;
|
|
|
-import org.yakindu.base.types.ComplexType;
|
|
|
|
|
-import org.yakindu.base.types.Feature;
|
|
|
|
|
|
|
+
|
|
|
|
|
+import org.yakindu.base.types.Declaration;
|
|
|
import org.yakindu.base.types.Type;
|
|
import org.yakindu.base.types.Type;
|
|
|
import org.yakindu.base.types.TypesPackage;
|
|
import org.yakindu.base.types.TypesPackage;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <!-- begin-user-doc -->
|
|
* <!-- begin-user-doc -->
|
|
|
- * An implementation of the model object '<em><b>Feature</b></em>'.
|
|
|
|
|
|
|
+ * An implementation of the model object '<em><b>Declaration</b></em>'.
|
|
|
* <!-- end-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
|
* <p>
|
|
* <p>
|
|
|
* The following features are implemented:
|
|
* The following features are implemented:
|
|
|
* <ul>
|
|
* <ul>
|
|
|
- * <li>{@link org.yakindu.base.types.impl.FeatureImpl#getType <em>Type</em>}</li>
|
|
|
|
|
- * <li>{@link org.yakindu.base.types.impl.FeatureImpl#getTypeArguments <em>Type Arguments</em>}</li>
|
|
|
|
|
- * <li>{@link org.yakindu.base.types.impl.FeatureImpl#getName <em>Name</em>}</li>
|
|
|
|
|
- * <li>{@link org.yakindu.base.types.impl.FeatureImpl#getOwningType <em>Owning Type</em>}</li>
|
|
|
|
|
|
|
+ * <li>{@link org.yakindu.base.types.impl.DeclarationImpl#getType <em>Type</em>}</li>
|
|
|
|
|
+ * <li>{@link org.yakindu.base.types.impl.DeclarationImpl#getTypeArguments <em>Type Arguments</em>}</li>
|
|
|
|
|
+ * <li>{@link org.yakindu.base.types.impl.DeclarationImpl#getName <em>Name</em>}</li>
|
|
|
* </ul>
|
|
* </ul>
|
|
|
* </p>
|
|
* </p>
|
|
|
*
|
|
*
|
|
|
* @generated
|
|
* @generated
|
|
|
*/
|
|
*/
|
|
|
-public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
|
|
|
|
+public abstract class DeclarationImpl extends EObjectImpl implements Declaration {
|
|
|
/**
|
|
/**
|
|
|
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
|
|
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
|
|
|
* <!-- begin-user-doc -->
|
|
* <!-- begin-user-doc -->
|
|
@@ -86,7 +84,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
* <!-- end-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
|
* @generated
|
|
* @generated
|
|
|
*/
|
|
*/
|
|
|
- protected FeatureImpl() {
|
|
|
|
|
|
|
+ protected DeclarationImpl() {
|
|
|
super();
|
|
super();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -97,7 +95,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
protected EClass eStaticClass() {
|
|
protected EClass eStaticClass() {
|
|
|
- return TypesPackage.Literals.FEATURE;
|
|
|
|
|
|
|
+ return TypesPackage.Literals.DECLARATION;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -111,7 +109,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
type = (Type)eResolveProxy(oldType);
|
|
type = (Type)eResolveProxy(oldType);
|
|
|
if (type != oldType) {
|
|
if (type != oldType) {
|
|
|
if (eNotificationRequired())
|
|
if (eNotificationRequired())
|
|
|
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.FEATURE__TYPE, oldType, type));
|
|
|
|
|
|
|
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.DECLARATION__TYPE, oldType, type));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return type;
|
|
return type;
|
|
@@ -135,7 +133,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
Type oldType = type;
|
|
Type oldType = type;
|
|
|
type = newType;
|
|
type = newType;
|
|
|
if (eNotificationRequired())
|
|
if (eNotificationRequired())
|
|
|
- eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.FEATURE__TYPE, oldType, type));
|
|
|
|
|
|
|
+ eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.DECLARATION__TYPE, oldType, type));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -145,7 +143,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
*/
|
|
*/
|
|
|
public EList<Type> getTypeArguments() {
|
|
public EList<Type> getTypeArguments() {
|
|
|
if (typeArguments == null) {
|
|
if (typeArguments == null) {
|
|
|
- typeArguments = new EObjectResolvingEList<Type>(Type.class, this, TypesPackage.FEATURE__TYPE_ARGUMENTS);
|
|
|
|
|
|
|
+ typeArguments = new EObjectResolvingEList<Type>(Type.class, this, TypesPackage.DECLARATION__TYPE_ARGUMENTS);
|
|
|
}
|
|
}
|
|
|
return typeArguments;
|
|
return typeArguments;
|
|
|
}
|
|
}
|
|
@@ -168,92 +166,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
String oldName = name;
|
|
String oldName = name;
|
|
|
name = newName;
|
|
name = newName;
|
|
|
if (eNotificationRequired())
|
|
if (eNotificationRequired())
|
|
|
- eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.FEATURE__NAME, oldName, name));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- public ComplexType getOwningType() {
|
|
|
|
|
- if (eContainerFeatureID() != TypesPackage.FEATURE__OWNING_TYPE) return null;
|
|
|
|
|
- return (ComplexType)eInternalContainer();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- public NotificationChain basicSetOwningType(ComplexType newOwningType, NotificationChain msgs) {
|
|
|
|
|
- msgs = eBasicSetContainer((InternalEObject)newOwningType, TypesPackage.FEATURE__OWNING_TYPE, msgs);
|
|
|
|
|
- return msgs;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- public void setOwningType(ComplexType newOwningType) {
|
|
|
|
|
- if (newOwningType != eInternalContainer() || (eContainerFeatureID() != TypesPackage.FEATURE__OWNING_TYPE && newOwningType != null)) {
|
|
|
|
|
- if (EcoreUtil.isAncestor(this, newOwningType))
|
|
|
|
|
- throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
|
|
|
|
|
- NotificationChain msgs = null;
|
|
|
|
|
- if (eInternalContainer() != null)
|
|
|
|
|
- msgs = eBasicRemoveFromContainer(msgs);
|
|
|
|
|
- if (newOwningType != null)
|
|
|
|
|
- msgs = ((InternalEObject)newOwningType).eInverseAdd(this, TypesPackage.COMPLEX_TYPE__FEATURES, ComplexType.class, msgs);
|
|
|
|
|
- msgs = basicSetOwningType(newOwningType, msgs);
|
|
|
|
|
- if (msgs != null) msgs.dispatch();
|
|
|
|
|
- }
|
|
|
|
|
- else if (eNotificationRequired())
|
|
|
|
|
- eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.FEATURE__OWNING_TYPE, newOwningType, newOwningType));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
|
|
|
|
- switch (featureID) {
|
|
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- if (eInternalContainer() != null)
|
|
|
|
|
- msgs = eBasicRemoveFromContainer(msgs);
|
|
|
|
|
- return basicSetOwningType((ComplexType)otherEnd, msgs);
|
|
|
|
|
- }
|
|
|
|
|
- return super.eInverseAdd(otherEnd, featureID, msgs);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
|
|
|
|
- switch (featureID) {
|
|
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- return basicSetOwningType(null, msgs);
|
|
|
|
|
- }
|
|
|
|
|
- return super.eInverseRemove(otherEnd, featureID, msgs);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * <!-- begin-user-doc -->
|
|
|
|
|
- * <!-- end-user-doc -->
|
|
|
|
|
- * @generated
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
|
|
|
|
|
- switch (eContainerFeatureID()) {
|
|
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- return eInternalContainer().eInverseRemove(this, TypesPackage.COMPLEX_TYPE__FEATURES, ComplexType.class, msgs);
|
|
|
|
|
- }
|
|
|
|
|
- return super.eBasicRemoveFromContainerFeature(msgs);
|
|
|
|
|
|
|
+ eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.DECLARATION__NAME, oldName, name));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -264,15 +177,13 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
@Override
|
|
@Override
|
|
|
public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
|
public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
|
|
switch (featureID) {
|
|
switch (featureID) {
|
|
|
- case TypesPackage.FEATURE__TYPE:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE:
|
|
|
if (resolve) return getType();
|
|
if (resolve) return getType();
|
|
|
return basicGetType();
|
|
return basicGetType();
|
|
|
- case TypesPackage.FEATURE__TYPE_ARGUMENTS:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE_ARGUMENTS:
|
|
|
return getTypeArguments();
|
|
return getTypeArguments();
|
|
|
- case TypesPackage.FEATURE__NAME:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__NAME:
|
|
|
return getName();
|
|
return getName();
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- return getOwningType();
|
|
|
|
|
}
|
|
}
|
|
|
return super.eGet(featureID, resolve, coreType);
|
|
return super.eGet(featureID, resolve, coreType);
|
|
|
}
|
|
}
|
|
@@ -286,19 +197,16 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
@Override
|
|
@Override
|
|
|
public void eSet(int featureID, Object newValue) {
|
|
public void eSet(int featureID, Object newValue) {
|
|
|
switch (featureID) {
|
|
switch (featureID) {
|
|
|
- case TypesPackage.FEATURE__TYPE:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE:
|
|
|
setType((Type)newValue);
|
|
setType((Type)newValue);
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__TYPE_ARGUMENTS:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE_ARGUMENTS:
|
|
|
getTypeArguments().clear();
|
|
getTypeArguments().clear();
|
|
|
getTypeArguments().addAll((Collection<? extends Type>)newValue);
|
|
getTypeArguments().addAll((Collection<? extends Type>)newValue);
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__NAME:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__NAME:
|
|
|
setName((String)newValue);
|
|
setName((String)newValue);
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- setOwningType((ComplexType)newValue);
|
|
|
|
|
- return;
|
|
|
|
|
}
|
|
}
|
|
|
super.eSet(featureID, newValue);
|
|
super.eSet(featureID, newValue);
|
|
|
}
|
|
}
|
|
@@ -311,18 +219,15 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
@Override
|
|
@Override
|
|
|
public void eUnset(int featureID) {
|
|
public void eUnset(int featureID) {
|
|
|
switch (featureID) {
|
|
switch (featureID) {
|
|
|
- case TypesPackage.FEATURE__TYPE:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE:
|
|
|
setType((Type)null);
|
|
setType((Type)null);
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__TYPE_ARGUMENTS:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE_ARGUMENTS:
|
|
|
getTypeArguments().clear();
|
|
getTypeArguments().clear();
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__NAME:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__NAME:
|
|
|
setName(NAME_EDEFAULT);
|
|
setName(NAME_EDEFAULT);
|
|
|
return;
|
|
return;
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- setOwningType((ComplexType)null);
|
|
|
|
|
- return;
|
|
|
|
|
}
|
|
}
|
|
|
super.eUnset(featureID);
|
|
super.eUnset(featureID);
|
|
|
}
|
|
}
|
|
@@ -335,14 +240,12 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean eIsSet(int featureID) {
|
|
public boolean eIsSet(int featureID) {
|
|
|
switch (featureID) {
|
|
switch (featureID) {
|
|
|
- case TypesPackage.FEATURE__TYPE:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE:
|
|
|
return type != null;
|
|
return type != null;
|
|
|
- case TypesPackage.FEATURE__TYPE_ARGUMENTS:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__TYPE_ARGUMENTS:
|
|
|
return typeArguments != null && !typeArguments.isEmpty();
|
|
return typeArguments != null && !typeArguments.isEmpty();
|
|
|
- case TypesPackage.FEATURE__NAME:
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__NAME:
|
|
|
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
|
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
|
|
- case TypesPackage.FEATURE__OWNING_TYPE:
|
|
|
|
|
- return getOwningType() != null;
|
|
|
|
|
}
|
|
}
|
|
|
return super.eIsSet(featureID);
|
|
return super.eIsSet(featureID);
|
|
|
}
|
|
}
|
|
@@ -356,7 +259,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
|
|
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
|
|
|
if (baseClass == NamedElement.class) {
|
|
if (baseClass == NamedElement.class) {
|
|
|
switch (derivedFeatureID) {
|
|
switch (derivedFeatureID) {
|
|
|
- case TypesPackage.FEATURE__NAME: return BasePackage.NAMED_ELEMENT__NAME;
|
|
|
|
|
|
|
+ case TypesPackage.DECLARATION__NAME: return BasePackage.NAMED_ELEMENT__NAME;
|
|
|
default: return -1;
|
|
default: return -1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -372,7 +275,7 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
|
|
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
|
|
|
if (baseClass == NamedElement.class) {
|
|
if (baseClass == NamedElement.class) {
|
|
|
switch (baseFeatureID) {
|
|
switch (baseFeatureID) {
|
|
|
- case BasePackage.NAMED_ELEMENT__NAME: return TypesPackage.FEATURE__NAME;
|
|
|
|
|
|
|
+ case BasePackage.NAMED_ELEMENT__NAME: return TypesPackage.DECLARATION__NAME;
|
|
|
default: return -1;
|
|
default: return -1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -395,4 +298,4 @@ public abstract class FeatureImpl extends EObjectImpl implements Feature {
|
|
|
return result.toString();
|
|
return result.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-} //FeatureImpl
|
|
|
|
|
|
|
+} //DeclarationImpl
|