/**
*/
package IFML.Core.impl;
import IFML.Core.Annotation;
import IFML.Core.Constraint;
import IFML.Core.CorePackage;
import IFML.Core.Element;
import java.util.Collection;
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.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.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Element</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link IFML.Core.impl.ElementImpl#getId <em>Id</em>}</li>
* <li>{@link IFML.Core.impl.ElementImpl#getConstraints <em>Constraints</em>}</li>
* <li>{@link IFML.Core.impl.ElementImpl#getAnnotations <em>Annotations</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class ElementImpl extends MinimalEObjectImpl.Container implements Element {
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The cached value of the '{@link #getConstraints() <em>Constraints</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstraints()
* @generated
* @ordered
*/
protected EList<Constraint> constraints;
/**
* The cached value of the '{@link #getAnnotations() <em>Annotations</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotations()
* @generated
* @ordered
*/
protected EList<Annotation> annotations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected ElementImpl() {
super();
id=EcoreUtil.generateUUID();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CorePackage.Literals.ELEMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.ELEMENT__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Constraint> getConstraints() {
if (constraints == null) {
constraints = new EObjectContainmentEList<Constraint>(Constraint.class, this, CorePackage.ELEMENT__CONSTRAINTS);
}
return constraints;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Annotation> getAnnotations() {
if (annotations == null) {
annotations = new EObjectContainmentEList<Annotation>(Annotation.class, this, CorePackage.ELEMENT__ANNOTATIONS);
}
return annotations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CorePackage.ELEMENT__CONSTRAINTS:
return ((InternalEList<?>)getConstraints()).basicRemove(otherEnd, msgs);
case CorePackage.ELEMENT__ANNOTATIONS:
return ((InternalEList<?>)getAnnotations()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CorePackage.ELEMENT__ID:
return getId();
case CorePackage.ELEMENT__CONSTRAINTS:
return getConstraints();
case CorePackage.ELEMENT__ANNOTATIONS:
return getAnnotations();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CorePackage.ELEMENT__ID:
setId((String)newValue);
return;
case CorePackage.ELEMENT__CONSTRAINTS:
getConstraints().clear();
getConstraints().addAll((Collection<? extends Constraint>)newValue);
return;
case CorePackage.ELEMENT__ANNOTATIONS:
getAnnotations().clear();
getAnnotations().addAll((Collection<? extends Annotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CorePackage.ELEMENT__ID:
setId(ID_EDEFAULT);
return;
case CorePackage.ELEMENT__CONSTRAINTS:
getConstraints().clear();
return;
case CorePackage.ELEMENT__ANNOTATIONS:
getAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CorePackage.ELEMENT__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case CorePackage.ELEMENT__CONSTRAINTS:
return constraints != null && !constraints.isEmpty();
case CorePackage.ELEMENT__ANNOTATIONS:
return annotations != null && !annotations.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (id: ");
result.append(id);
result.append(')');
return result.toString();
}
} //ElementImpl