| /** |
| * <copyright> |
| * </copyright> |
| * |
| */ |
| package org.eclipse.xtext.example.arithmetics.arithmetics.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.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.xtext.example.arithmetics.arithmetics.ArithmeticsPackage; |
| import org.eclipse.xtext.example.arithmetics.arithmetics.Import; |
| import org.eclipse.xtext.example.arithmetics.arithmetics.Module; |
| import org.eclipse.xtext.example.arithmetics.arithmetics.Statement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Module</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.xtext.example.arithmetics.arithmetics.impl.ModuleImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.xtext.example.arithmetics.arithmetics.impl.ModuleImpl#getImports <em>Imports</em>}</li> |
| * <li>{@link org.eclipse.xtext.example.arithmetics.arithmetics.impl.ModuleImpl#getStatements <em>Statements</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ModuleImpl extends MinimalEObjectImpl.Container implements Module |
| { |
| /** |
| * 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 #getImports() <em>Imports</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImports() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Import> imports; |
| |
| /** |
| * The cached value of the '{@link #getStatements() <em>Statements</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStatements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Statement> statements; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ModuleImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return ArithmeticsPackage.Literals.MODULE; |
| } |
| |
| /** |
| * <!-- 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, ArithmeticsPackage.MODULE__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Import> getImports() |
| { |
| if (imports == null) |
| { |
| imports = new EObjectContainmentEList<Import>(Import.class, this, ArithmeticsPackage.MODULE__IMPORTS); |
| } |
| return imports; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Statement> getStatements() |
| { |
| if (statements == null) |
| { |
| statements = new EObjectContainmentEList<Statement>(Statement.class, this, ArithmeticsPackage.MODULE__STATEMENTS); |
| } |
| return statements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case ArithmeticsPackage.MODULE__IMPORTS: |
| return ((InternalEList<?>)getImports()).basicRemove(otherEnd, msgs); |
| case ArithmeticsPackage.MODULE__STATEMENTS: |
| return ((InternalEList<?>)getStatements()).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 ArithmeticsPackage.MODULE__NAME: |
| return getName(); |
| case ArithmeticsPackage.MODULE__IMPORTS: |
| return getImports(); |
| case ArithmeticsPackage.MODULE__STATEMENTS: |
| return getStatements(); |
| } |
| 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 ArithmeticsPackage.MODULE__NAME: |
| setName((String)newValue); |
| return; |
| case ArithmeticsPackage.MODULE__IMPORTS: |
| getImports().clear(); |
| getImports().addAll((Collection<? extends Import>)newValue); |
| return; |
| case ArithmeticsPackage.MODULE__STATEMENTS: |
| getStatements().clear(); |
| getStatements().addAll((Collection<? extends Statement>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case ArithmeticsPackage.MODULE__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case ArithmeticsPackage.MODULE__IMPORTS: |
| getImports().clear(); |
| return; |
| case ArithmeticsPackage.MODULE__STATEMENTS: |
| getStatements().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case ArithmeticsPackage.MODULE__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case ArithmeticsPackage.MODULE__IMPORTS: |
| return imports != null && !imports.isEmpty(); |
| case ArithmeticsPackage.MODULE__STATEMENTS: |
| return statements != null && !statements.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(); |
| } |
| |
| } //ModuleImpl |