| /** |
| * generated by Xtext |
| */ |
| package org.eclipse.handly.examples.basic.foo.impl; |
| |
| import java.util.Collection; |
| |
| 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.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.handly.examples.basic.foo.Def; |
| import org.eclipse.handly.examples.basic.foo.FooPackage; |
| import org.eclipse.handly.examples.basic.foo.Unit; |
| import org.eclipse.handly.examples.basic.foo.Var; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Unit</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.handly.examples.basic.foo.impl.UnitImpl#getVars <em>Vars</em>}</li> |
| * <li>{@link org.eclipse.handly.examples.basic.foo.impl.UnitImpl#getDefs <em>Defs</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class UnitImpl extends MinimalEObjectImpl.Container implements Unit |
| { |
| /** |
| * The cached value of the '{@link #getVars() <em>Vars</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVars() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Var> vars; |
| |
| /** |
| * The cached value of the '{@link #getDefs() <em>Defs</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDefs() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Def> defs; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected UnitImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return FooPackage.Literals.UNIT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Var> getVars() |
| { |
| if (vars == null) |
| { |
| vars = new EObjectContainmentEList<Var>(Var.class, this, FooPackage.UNIT__VARS); |
| } |
| return vars; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Def> getDefs() |
| { |
| if (defs == null) |
| { |
| defs = new EObjectContainmentEList<Def>(Def.class, this, FooPackage.UNIT__DEFS); |
| } |
| return defs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case FooPackage.UNIT__VARS: |
| return ((InternalEList<?>)getVars()).basicRemove(otherEnd, msgs); |
| case FooPackage.UNIT__DEFS: |
| return ((InternalEList<?>)getDefs()).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 FooPackage.UNIT__VARS: |
| return getVars(); |
| case FooPackage.UNIT__DEFS: |
| return getDefs(); |
| } |
| 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 FooPackage.UNIT__VARS: |
| getVars().clear(); |
| getVars().addAll((Collection<? extends Var>)newValue); |
| return; |
| case FooPackage.UNIT__DEFS: |
| getDefs().clear(); |
| getDefs().addAll((Collection<? extends Def>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case FooPackage.UNIT__VARS: |
| getVars().clear(); |
| return; |
| case FooPackage.UNIT__DEFS: |
| getDefs().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case FooPackage.UNIT__VARS: |
| return vars != null && !vars.isEmpty(); |
| case FooPackage.UNIT__DEFS: |
| return defs != null && !defs.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //UnitImpl |