/** | |
* ******************************************************************************* | |
* Copyright (c) 2009 Mia-Software. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* | |
* Fabien Giquel (Mia-Software) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.modisco.java.emf.classic.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.modisco.java.ArrayAccess; | |
import org.eclipse.modisco.java.Expression; | |
import org.eclipse.modisco.java.emf.classic.JavaPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Array Access</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.java.emf.classic.impl.ArrayAccessImpl#getArray <em>Array</em>}</li> | |
* <li>{@link org.eclipse.modisco.java.emf.classic.impl.ArrayAccessImpl#getIndex <em>Index</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class ArrayAccessImpl extends ExpressionImpl implements ArrayAccess { | |
/** | |
* The cached value of the '{@link #getArray() <em>Array</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getArray() | |
* @generated | |
* @ordered | |
*/ | |
protected Expression array; | |
/** | |
* The cached value of the '{@link #getIndex() <em>Index</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getIndex() | |
* @generated | |
* @ordered | |
*/ | |
protected Expression index; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected ArrayAccessImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return JavaPackage.eINSTANCE.getArrayAccess(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Expression getArray() { | |
return array; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetArray(Expression newArray, NotificationChain msgs) { | |
Expression oldArray = array; | |
array = newArray; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.ARRAY_ACCESS__ARRAY, oldArray, newArray); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setArray(Expression newArray) { | |
if (newArray != array) { | |
NotificationChain msgs = null; | |
if (array != null) | |
msgs = ((InternalEObject)array).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ARRAY_ACCESS__ARRAY, null, msgs); | |
if (newArray != null) | |
msgs = ((InternalEObject)newArray).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ARRAY_ACCESS__ARRAY, null, msgs); | |
msgs = basicSetArray(newArray, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.ARRAY_ACCESS__ARRAY, newArray, newArray)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Expression getIndex() { | |
return index; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetIndex(Expression newIndex, NotificationChain msgs) { | |
Expression oldIndex = index; | |
index = newIndex; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.ARRAY_ACCESS__INDEX, oldIndex, newIndex); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setIndex(Expression newIndex) { | |
if (newIndex != index) { | |
NotificationChain msgs = null; | |
if (index != null) | |
msgs = ((InternalEObject)index).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ARRAY_ACCESS__INDEX, null, msgs); | |
if (newIndex != null) | |
msgs = ((InternalEObject)newIndex).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ARRAY_ACCESS__INDEX, null, msgs); | |
msgs = basicSetIndex(newIndex, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.ARRAY_ACCESS__INDEX, newIndex, newIndex)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case JavaPackage.ARRAY_ACCESS__ARRAY: | |
return basicSetArray(null, msgs); | |
case JavaPackage.ARRAY_ACCESS__INDEX: | |
return basicSetIndex(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 JavaPackage.ARRAY_ACCESS__ARRAY: | |
return getArray(); | |
case JavaPackage.ARRAY_ACCESS__INDEX: | |
return getIndex(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case JavaPackage.ARRAY_ACCESS__ARRAY: | |
setArray((Expression)newValue); | |
return; | |
case JavaPackage.ARRAY_ACCESS__INDEX: | |
setIndex((Expression)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case JavaPackage.ARRAY_ACCESS__ARRAY: | |
setArray((Expression)null); | |
return; | |
case JavaPackage.ARRAY_ACCESS__INDEX: | |
setIndex((Expression)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case JavaPackage.ARRAY_ACCESS__ARRAY: | |
return array != null; | |
case JavaPackage.ARRAY_ACCESS__INDEX: | |
return index != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //ArrayAccessImpl |