| /******************************************************************************* |
| * Copyright (c) 2015 Willink Transformations and others. |
| * 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: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package example1.source.impl; |
| |
| import example1.source.PathElementCS; |
| import example1.source.PathNameCS; |
| import example1.source.SElement; |
| import example1.source.SourcePackage; |
| |
| 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.EObjectContainmentWithInverseEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Path Name CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link example1.source.impl.PathNameCSImpl#getPath <em>Path</em>}</li> |
| * <li>{@link example1.source.impl.PathNameCSImpl#getContext <em>Context</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PathNameCSImpl extends SElementImpl implements PathNameCS { |
| /** |
| * The cached value of the '{@link #getPath() <em>Path</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPath() |
| * @generated |
| * @ordered |
| */ |
| protected EList<PathElementCS> path; |
| |
| /** |
| * The cached value of the '{@link #getContext() <em>Context</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContext() |
| * @generated |
| * @ordered |
| */ |
| protected SElement context; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PathNameCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return SourcePackage.Literals.PATH_NAME_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<PathElementCS> getPath() { |
| if (path == null) { |
| path = new EObjectContainmentWithInverseEList<PathElementCS>(PathElementCS.class, this, SourcePackage.PATH_NAME_CS__PATH, SourcePackage.PATH_ELEMENT_CS__PATH_NAME); |
| } |
| return path; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SElement getContext() { |
| if (context != null && context.eIsProxy()) { |
| InternalEObject oldContext = (InternalEObject)context; |
| context = (SElement)eResolveProxy(oldContext); |
| if (context != oldContext) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SourcePackage.PATH_NAME_CS__CONTEXT, oldContext, context)); |
| } |
| } |
| return context; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SElement basicGetContext() { |
| return context; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setContext(SElement newContext) { |
| SElement oldContext = context; |
| context = newContext; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SourcePackage.PATH_NAME_CS__CONTEXT, oldContext, context)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case SourcePackage.PATH_NAME_CS__PATH: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getPath()).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 SourcePackage.PATH_NAME_CS__PATH: |
| return ((InternalEList<?>)getPath()).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 SourcePackage.PATH_NAME_CS__PATH: |
| return getPath(); |
| case SourcePackage.PATH_NAME_CS__CONTEXT: |
| if (resolve) return getContext(); |
| return basicGetContext(); |
| } |
| 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 SourcePackage.PATH_NAME_CS__PATH: |
| getPath().clear(); |
| getPath().addAll((Collection<? extends PathElementCS>)newValue); |
| return; |
| case SourcePackage.PATH_NAME_CS__CONTEXT: |
| setContext((SElement)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case SourcePackage.PATH_NAME_CS__PATH: |
| getPath().clear(); |
| return; |
| case SourcePackage.PATH_NAME_CS__CONTEXT: |
| setContext((SElement)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case SourcePackage.PATH_NAME_CS__PATH: |
| return path != null && !path.isEmpty(); |
| case SourcePackage.PATH_NAME_CS__CONTEXT: |
| return context != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| |
| } //PathNameCSImpl |