blob: 03da075e9b4825bb7d93fdc1d826a3bb0a4b9c9f [file] [log] [blame]
/**
*/
package anydsl.impl;
import anydsl.Adress;
import anydsl.AnydslPackage;
import anydsl.Chef;
import anydsl.Recipe;
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.InternalEList;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Chef</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link anydsl.impl.ChefImpl#getName <em>Name</em>}</li>
* <li>{@link anydsl.impl.ChefImpl#getAdress <em>Adress</em>}</li>
* <li>{@link anydsl.impl.ChefImpl#getRecipes <em>Recipes</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ChefImpl extends MinimalEObjectImpl.Container implements Chef {
/**
* 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 #getAdress() <em>Adress</em>}' containment reference. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getAdress()
* @generated
* @ordered
*/
protected Adress adress;
/**
* The cached value of the '{@link #getRecipes() <em>Recipes</em>}' containment reference list. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getRecipes()
* @generated
* @ordered
*/
protected EList<Recipe> recipes;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected ChefImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return AnydslPackage.Literals.CHEF;
}
/**
* <!-- 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, AnydslPackage.CHEF__NAME, oldName, name));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public Adress getAdress() {
return adress;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetAdress(Adress newAdress, NotificationChain msgs) {
Adress oldAdress = adress;
adress = newAdress;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
AnydslPackage.CHEF__ADRESS, oldAdress, newAdress);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setAdress(Adress newAdress) {
if (newAdress != adress) {
NotificationChain msgs = null;
if (adress != null)
msgs = ((InternalEObject)adress).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- AnydslPackage.CHEF__ADRESS, null, msgs);
if (newAdress != null)
msgs = ((InternalEObject)newAdress).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
- AnydslPackage.CHEF__ADRESS, null, msgs);
msgs = basicSetAdress(newAdress, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AnydslPackage.CHEF__ADRESS, newAdress,
newAdress));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EList<Recipe> getRecipes() {
if (recipes == null) {
recipes = new EObjectContainmentEList<Recipe>(Recipe.class, this, AnydslPackage.CHEF__RECIPES);
}
return recipes;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AnydslPackage.CHEF__ADRESS:
return basicSetAdress(null, msgs);
case AnydslPackage.CHEF__RECIPES:
return ((InternalEList<?>)getRecipes()).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 AnydslPackage.CHEF__NAME:
return getName();
case AnydslPackage.CHEF__ADRESS:
return getAdress();
case AnydslPackage.CHEF__RECIPES:
return getRecipes();
}
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 AnydslPackage.CHEF__NAME:
setName((String)newValue);
return;
case AnydslPackage.CHEF__ADRESS:
setAdress((Adress)newValue);
return;
case AnydslPackage.CHEF__RECIPES:
getRecipes().clear();
getRecipes().addAll((Collection<? extends Recipe>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AnydslPackage.CHEF__NAME:
setName(NAME_EDEFAULT);
return;
case AnydslPackage.CHEF__ADRESS:
setAdress((Adress)null);
return;
case AnydslPackage.CHEF__RECIPES:
getRecipes().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AnydslPackage.CHEF__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case AnydslPackage.CHEF__ADRESS:
return adress != null;
case AnydslPackage.CHEF__RECIPES:
return recipes != null && !recipes.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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} // ChefImpl