/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.amalgam.tutorials.emf.droid.impl;
import org.eclipse.amalgam.tutorials.emf.droid.DimensionRA;
import org.eclipse.amalgam.tutorials.emf.droid.DimensionVA;
import org.eclipse.amalgam.tutorials.emf.droid.DimensionVD;
import org.eclipse.amalgam.tutorials.emf.droid.DroidPackage;
import org.eclipse.amalgam.tutorials.emf.droid.LayoutDimensionKind;
import org.eclipse.amalgam.tutorials.emf.droid.LayoutDimensionVA;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Dimension VA</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.amalgam.tutorials.emf.droid.impl.DimensionVAImpl#getConstant_value <em>Constant value</em>}</li>
* <li>{@link org.eclipse.amalgam.tutorials.emf.droid.impl.DimensionVAImpl#getAccess <em>Access</em>}</li>
* <li>{@link org.eclipse.amalgam.tutorials.emf.droid.impl.DimensionVAImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DimensionVAImpl extends ValueAccessImpl implements DimensionVA {
/**
* The default value of the '{@link #getConstant_value() <em>Constant value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstant_value()
* @generated
* @ordered
*/
protected static final LayoutDimensionKind CONSTANT_VALUE_EDEFAULT = LayoutDimensionKind.FILL_PARENT;
/**
* The cached value of the '{@link #getConstant_value() <em>Constant value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstant_value()
* @generated
* @ordered
*/
protected LayoutDimensionKind constant_value = CONSTANT_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getAccess() <em>Access</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAccess()
* @generated
* @ordered
*/
protected DimensionRA access;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected DimensionVD value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DimensionVAImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DroidPackage.eINSTANCE.getDimensionVA();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LayoutDimensionKind getConstant_value() {
return constant_value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConstant_value(LayoutDimensionKind newConstant_value) {
LayoutDimensionKind oldConstant_value = constant_value;
constant_value = newConstant_value == null ? CONSTANT_VALUE_EDEFAULT : newConstant_value;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DroidPackage.DIMENSION_VA__CONSTANT_VALUE, oldConstant_value, constant_value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DimensionRA getAccess() {
return access;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAccess(DimensionRA newAccess, NotificationChain msgs) {
DimensionRA oldAccess = access;
access = newAccess;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DroidPackage.DIMENSION_VA__ACCESS, oldAccess, newAccess);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAccess(DimensionRA newAccess) {
if (newAccess != access) {
NotificationChain msgs = null;
if (access != null)
msgs = ((InternalEObject)access).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DroidPackage.DIMENSION_VA__ACCESS, null, msgs);
if (newAccess != null)
msgs = ((InternalEObject)newAccess).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DroidPackage.DIMENSION_VA__ACCESS, null, msgs);
msgs = basicSetAccess(newAccess, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DroidPackage.DIMENSION_VA__ACCESS, newAccess, newAccess));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DimensionVD getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(DimensionVD newValue, NotificationChain msgs) {
DimensionVD oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DroidPackage.DIMENSION_VA__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(DimensionVD newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DroidPackage.DIMENSION_VA__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DroidPackage.DIMENSION_VA__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DroidPackage.DIMENSION_VA__VALUE, newValue, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DroidPackage.DIMENSION_VA__ACCESS:
return basicSetAccess(null, msgs);
case DroidPackage.DIMENSION_VA__VALUE:
return basicSetValue(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 DroidPackage.DIMENSION_VA__CONSTANT_VALUE:
return getConstant_value();
case DroidPackage.DIMENSION_VA__ACCESS:
return getAccess();
case DroidPackage.DIMENSION_VA__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DroidPackage.DIMENSION_VA__CONSTANT_VALUE:
setConstant_value((LayoutDimensionKind)newValue);
return;
case DroidPackage.DIMENSION_VA__ACCESS:
setAccess((DimensionRA)newValue);
return;
case DroidPackage.DIMENSION_VA__VALUE:
setValue((DimensionVD)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DroidPackage.DIMENSION_VA__CONSTANT_VALUE:
setConstant_value(CONSTANT_VALUE_EDEFAULT);
return;
case DroidPackage.DIMENSION_VA__ACCESS:
setAccess((DimensionRA)null);
return;
case DroidPackage.DIMENSION_VA__VALUE:
setValue((DimensionVD)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DroidPackage.DIMENSION_VA__CONSTANT_VALUE:
return constant_value != CONSTANT_VALUE_EDEFAULT;
case DroidPackage.DIMENSION_VA__ACCESS:
return access != null;
case DroidPackage.DIMENSION_VA__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == LayoutDimensionVA.class) {
switch (derivedFeatureID) {
case DroidPackage.DIMENSION_VA__CONSTANT_VALUE: return DroidPackage.LAYOUT_DIMENSION_VA__CONSTANT_VALUE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == LayoutDimensionVA.class) {
switch (baseFeatureID) {
case DroidPackage.LAYOUT_DIMENSION_VA__CONSTANT_VALUE: return DroidPackage.DIMENSION_VA__CONSTANT_VALUE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (constant_value: ");
result.append(constant_value);
result.append(')');
return result.toString();
}
} //DimensionVAImpl