blob: e91028aef723266983e3d2b73cd4ef601d1b28b3 [file] [log] [blame]
/**
* *******************************************************************************
* 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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Fabien Giquel (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.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.gmt.modisco.java.ArrayLengthAccess;
import org.eclipse.gmt.modisco.java.Expression;
import org.eclipse.gmt.modisco.java.emf.classic.JavaPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Array Length Access</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.java.emf.classic.impl.ArrayLengthAccessImpl#getArray <em>Array</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ArrayLengthAccessImpl extends ExpressionImpl implements ArrayLengthAccess {
/**
* 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ArrayLengthAccessImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getArrayLengthAccess();
}
/**
* <!-- 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_LENGTH_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_LENGTH_ACCESS__ARRAY, null, msgs);
if (newArray != null)
msgs = ((InternalEObject)newArray).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ARRAY_LENGTH_ACCESS__ARRAY, null, msgs);
msgs = basicSetArray(newArray, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.ARRAY_LENGTH_ACCESS__ARRAY, newArray, newArray));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.ARRAY_LENGTH_ACCESS__ARRAY:
return basicSetArray(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_LENGTH_ACCESS__ARRAY:
return getArray();
}
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_LENGTH_ACCESS__ARRAY:
setArray((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_LENGTH_ACCESS__ARRAY:
setArray((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.ARRAY_LENGTH_ACCESS__ARRAY:
return array != null;
}
return super.eIsSet(featureID);
}
} //ArrayLengthAccessImpl