blob: 73a18392dafb26bd9da226cf58d007a2f97fad9d [file] [log] [blame]
/**
* Copyright (c) 2010, 2015 Mia-Software.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Frederic Madiot (Mia-Software) - metamodel design and initial implementation
* Grégoire Dupé (Mia-Software) - Bug 480183 - The manifest.mf discoverer should manage 'Export-Package'
*/
package org.eclipse.modisco.manifest.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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.EObjectImpl;
import org.eclipse.modisco.manifest.ImportedPackage;
import org.eclipse.modisco.manifest.ManifestPackage;
import org.eclipse.modisco.manifest.Version;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Imported Package</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.modisco.manifest.impl.ImportedPackageImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.modisco.manifest.impl.ImportedPackageImpl#getVersion <em>Version</em>}</li>
* </ul>
*
* @generated
*/
public class ImportedPackageImpl extends EObjectImpl implements ImportedPackage {
/**
* 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;
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected Version version;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ImportedPackageImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ManifestPackage.Literals.IMPORTED_PACKAGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ManifestPackage.IMPORTED_PACKAGE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Version getVersion() {
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVersion(Version newVersion, NotificationChain msgs) {
Version oldVersion = version;
version = newVersion;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ManifestPackage.IMPORTED_PACKAGE__VERSION, oldVersion, newVersion);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(Version newVersion) {
if (newVersion != version) {
NotificationChain msgs = null;
if (version != null)
msgs = ((InternalEObject)version).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ManifestPackage.IMPORTED_PACKAGE__VERSION, null, msgs);
if (newVersion != null)
msgs = ((InternalEObject)newVersion).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ManifestPackage.IMPORTED_PACKAGE__VERSION, null, msgs);
msgs = basicSetVersion(newVersion, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ManifestPackage.IMPORTED_PACKAGE__VERSION, newVersion, newVersion));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ManifestPackage.IMPORTED_PACKAGE__VERSION:
return basicSetVersion(null, 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 ManifestPackage.IMPORTED_PACKAGE__NAME:
return getName();
case ManifestPackage.IMPORTED_PACKAGE__VERSION:
return getVersion();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ManifestPackage.IMPORTED_PACKAGE__NAME:
setName((String)newValue);
return;
case ManifestPackage.IMPORTED_PACKAGE__VERSION:
setVersion((Version)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ManifestPackage.IMPORTED_PACKAGE__NAME:
setName(NAME_EDEFAULT);
return;
case ManifestPackage.IMPORTED_PACKAGE__VERSION:
setVersion((Version)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ManifestPackage.IMPORTED_PACKAGE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ManifestPackage.IMPORTED_PACKAGE__VERSION:
return version != null;
}
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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //ImportedPackageImpl