//------------------------------------------------------------------------------ // Copyright (c) 2005, 2006 IBM Corporation 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: // IBM Corporation - initial implementation //------------------------------------------------------------------------------ package org.eclipse.epf.uma.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.epf.uma.UmaPackage; import org.eclipse.epf.uma.VariabilityElement; import org.eclipse.epf.uma.VariabilityType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Variability Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.epf.uma.impl.VariabilityElementImpl#getVariabilityType <em>Variability Type</em>}</li> * <li>{@link org.eclipse.epf.uma.impl.VariabilityElementImpl#getVariabilityBasedOnElement <em>Variability Based On Element</em>}</li> * </ul> * </p> * * @generated */ public abstract class VariabilityElementImpl extends MethodElementImpl implements VariabilityElement { /** * The default value of the '{@link #getVariabilityType() <em>Variability Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariabilityType() * @generated * @ordered */ protected static final VariabilityType VARIABILITY_TYPE_EDEFAULT = VariabilityType.NA; /** * The cached value of the '{@link #getVariabilityType() <em>Variability Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariabilityType() * @generated * @ordered */ protected VariabilityType variabilityType = VARIABILITY_TYPE_EDEFAULT; /** * The cached value of the '{@link #getVariabilityBasedOnElement() <em>Variability Based On Element</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariabilityBasedOnElement() * @generated * @ordered */ protected VariabilityElement variabilityBasedOnElement; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VariabilityElementImpl() { super(); //UMA--> reassignDefaultValues(); //UMA<-- } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmaPackage.Literals.VARIABILITY_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VariabilityType getVariabilityType() { return variabilityType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVariabilityType(VariabilityType newVariabilityType) { VariabilityType oldVariabilityType = variabilityType; variabilityType = newVariabilityType == null ? VARIABILITY_TYPE_EDEFAULT : newVariabilityType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_TYPE, oldVariabilityType, variabilityType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VariabilityElement getVariabilityBasedOnElement() { if (variabilityBasedOnElement != null && ((EObject) variabilityBasedOnElement).eIsProxy()) { InternalEObject oldVariabilityBasedOnElement = (InternalEObject) variabilityBasedOnElement; variabilityBasedOnElement = (VariabilityElement) eResolveProxy(oldVariabilityBasedOnElement); if (variabilityBasedOnElement != oldVariabilityBasedOnElement) { if (eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.RESOLVE, UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT, oldVariabilityBasedOnElement, variabilityBasedOnElement)); } } return variabilityBasedOnElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VariabilityElement basicGetVariabilityBasedOnElement() { return variabilityBasedOnElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVariabilityBasedOnElement( VariabilityElement newVariabilityBasedOnElement) { VariabilityElement oldVariabilityBasedOnElement = variabilityBasedOnElement; variabilityBasedOnElement = newVariabilityBasedOnElement; if (eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.SET, UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT, oldVariabilityBasedOnElement, variabilityBasedOnElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_TYPE: return getVariabilityType(); case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT: if (resolve) return getVariabilityBasedOnElement(); return basicGetVariabilityBasedOnElement(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_TYPE: setVariabilityType((VariabilityType) newValue); return; case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT: setVariabilityBasedOnElement((VariabilityElement) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_TYPE: setVariabilityType(VARIABILITY_TYPE_EDEFAULT); return; case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT: setVariabilityBasedOnElement((VariabilityElement) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { //UMA--> EStructuralFeature feature = getFeatureWithOverridenDefaultValue(featureID); if (feature != null) { return isFeatureWithOverridenDefaultValueSet(feature); } //UMA<-- switch (featureID) { case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_TYPE: return variabilityType != VARIABILITY_TYPE_EDEFAULT; case UmaPackage.VARIABILITY_ELEMENT__VARIABILITY_BASED_ON_ELEMENT: return variabilityBasedOnElement != null; } 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(" (variabilityType: "); //$NON-NLS-1$ result.append(variabilityType); result.append(')'); return result.toString(); } } //VariabilityElementImpl