/** * Copyright (c) 2013 itemis AG 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: * Mark Broerkens - initial API and implementation * */ package org.eclipse.rmf.reqif10.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.rmf.reqif10.AlternativeID; import org.eclipse.rmf.reqif10.ReqIF10Package; /** * <!-- begin-user-doc --> An implementation of the model object '<em><b>Alternative ID</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.rmf.reqif10.impl.AlternativeIDImpl#getIdentifier <em>Identifier</em>}</li> * </ul> * </p> * * @generated */ public class AlternativeIDImpl extends MinimalEObjectImpl implements AlternativeID { /** * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. <!-- begin-user-doc --> <!-- * end-user-doc --> * * @see #getIdentifier() * @generated * @ordered */ protected static final String IDENTIFIER_EDEFAULT = null; /** * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. <!-- begin-user-doc --> <!-- * end-user-doc --> * * @see #getIdentifier() * @generated * @ordered */ protected String identifier = IDENTIFIER_EDEFAULT; /** * This is true if the Identifier attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated * @ordered */ protected boolean identifierESet; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected AlternativeIDImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ReqIF10Package.Literals.ALTERNATIVE_ID; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public String getIdentifier() { return identifier; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void setIdentifier(String newIdentifier) { String oldIdentifier = identifier; identifier = newIdentifier; boolean oldIdentifierESet = identifierESet; identifierESet = true; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER, oldIdentifier, identifier, !oldIdentifierESet)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void unsetIdentifier() { String oldIdentifier = identifier; boolean oldIdentifierESet = identifierESet; identifier = IDENTIFIER_EDEFAULT; identifierESet = false; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER, oldIdentifier, IDENTIFIER_EDEFAULT, oldIdentifierESet)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public boolean isSetIdentifier() { return identifierESet; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER: return getIdentifier(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER: setIdentifier((String) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER: unsetIdentifier(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ReqIF10Package.ALTERNATIVE_ID__IDENTIFIER: return isSetIdentifier(); } 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(" (identifier: "); //$NON-NLS-1$ if (identifierESet) { result.append(identifier); } else { result.append("<unset>"); //$NON-NLS-1$ } result.append(')'); return result.toString(); } } // AlternativeIDImpl