/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.foundation.typemapping.impl;
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.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import orgomg.cwm.foundation.softwaredeployment.SoftwareSystem;
import orgomg.cwm.foundation.softwaredeployment.SoftwaredeploymentPackage;
import orgomg.cwm.foundation.typemapping.TypeSystem;
import orgomg.cwm.foundation.typemapping.TypemappingPackage;
import orgomg.cwm.objectmodel.core.impl.PackageImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Type System</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.foundation.typemapping.impl.TypeSystemImpl#getSupportingSystem <em>Supporting System</em>}</li>
* <li>{@link orgomg.cwm.foundation.typemapping.impl.TypeSystemImpl#getVersion <em>Version</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TypeSystemImpl extends PackageImpl implements TypeSystem {
/**
* The cached value of the '{@link #getSupportingSystem() <em>Supporting System</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSupportingSystem()
* @generated
* @ordered
*/
protected EList<SoftwareSystem> supportingSystem;
/**
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected static final String VERSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected String version = VERSION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TypeSystemImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TypemappingPackage.Literals.TYPE_SYSTEM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<SoftwareSystem> getSupportingSystem() {
if (supportingSystem == null) {
supportingSystem = new EObjectWithInverseResolvingEList.ManyInverse<SoftwareSystem>(SoftwareSystem.class, this, TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM, SoftwaredeploymentPackage.SOFTWARE_SYSTEM__TYPESPACE);
}
return supportingSystem;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getVersion() {
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(String newVersion) {
String oldVersion = version;
version = newVersion;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypemappingPackage.TYPE_SYSTEM__VERSION, oldVersion, version));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getSupportingSystem()).basicAdd(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 TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
return ((InternalEList<?>)getSupportingSystem()).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 TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
return getSupportingSystem();
case TypemappingPackage.TYPE_SYSTEM__VERSION:
return getVersion();
}
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 TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
getSupportingSystem().clear();
getSupportingSystem().addAll((Collection<? extends SoftwareSystem>)newValue);
return;
case TypemappingPackage.TYPE_SYSTEM__VERSION:
setVersion((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
getSupportingSystem().clear();
return;
case TypemappingPackage.TYPE_SYSTEM__VERSION:
setVersion(VERSION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypemappingPackage.TYPE_SYSTEM__SUPPORTING_SYSTEM:
return supportingSystem != null && !supportingSystem.isEmpty();
case TypemappingPackage.TYPE_SYSTEM__VERSION:
return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
}
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(" (version: ");
result.append(version);
result.append(')');
return result.toString();
}
} //TypeSystemImpl