/** * Copyright (c) 2015 Obeo. * 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.htm */ package org.eclipse.sirius.expression.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.sirius.expression.ExpressionPackage; import org.eclipse.sirius.expression.SiriusVariable; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Sirius Variable</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.sirius.expression.impl.SiriusVariableImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.sirius.expression.impl.SiriusVariableImpl#getDocumentation <em>Documentation</em>}</li> * <li>{@link org.eclipse.sirius.expression.impl.SiriusVariableImpl#getEType <em>EType</em>}</li> * </ul> * * @generated */ public class SiriusVariableImpl extends MinimalEObjectImpl.Container implements SiriusVariable { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDocumentation() * @generated * @ordered */ protected static final String DOCUMENTATION_EDEFAULT = null; /** * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDocumentation() * @generated * @ordered */ protected String documentation = DOCUMENTATION_EDEFAULT; /** * The cached value of the '{@link #getEType() <em>EType</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEType() * @generated * @ordered */ protected EClassifier eType; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SiriusVariableImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ExpressionPackage.Literals.SIRIUS_VARIABLE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.SIRIUS_VARIABLE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getDocumentation() { return documentation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDocumentation(String newDocumentation) { String oldDocumentation = documentation; documentation = newDocumentation; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.SIRIUS_VARIABLE__DOCUMENTATION, oldDocumentation, documentation)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClassifier getEType() { if (eType != null && eType.eIsProxy()) { InternalEObject oldEType = (InternalEObject)eType; eType = (EClassifier)eResolveProxy(oldEType); if (eType != oldEType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ExpressionPackage.SIRIUS_VARIABLE__ETYPE, oldEType, eType)); } } return eType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClassifier basicGetEType() { return eType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEType(EClassifier newEType) { EClassifier oldEType = eType; eType = newEType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.SIRIUS_VARIABLE__ETYPE, oldEType, eType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionPackage.SIRIUS_VARIABLE__NAME: return getName(); case ExpressionPackage.SIRIUS_VARIABLE__DOCUMENTATION: return getDocumentation(); case ExpressionPackage.SIRIUS_VARIABLE__ETYPE: if (resolve) return getEType(); return basicGetEType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExpressionPackage.SIRIUS_VARIABLE__NAME: setName((String)newValue); return; case ExpressionPackage.SIRIUS_VARIABLE__DOCUMENTATION: setDocumentation((String)newValue); return; case ExpressionPackage.SIRIUS_VARIABLE__ETYPE: setEType((EClassifier)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionPackage.SIRIUS_VARIABLE__NAME: setName(NAME_EDEFAULT); return; case ExpressionPackage.SIRIUS_VARIABLE__DOCUMENTATION: setDocumentation(DOCUMENTATION_EDEFAULT); return; case ExpressionPackage.SIRIUS_VARIABLE__ETYPE: setEType((EClassifier)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionPackage.SIRIUS_VARIABLE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case ExpressionPackage.SIRIUS_VARIABLE__DOCUMENTATION: return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); case ExpressionPackage.SIRIUS_VARIABLE__ETYPE: return eType != 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(" (name: "); //$NON-NLS-1$ result.append(name); result.append(", documentation: "); //$NON-NLS-1$ result.append(documentation); result.append(')'); return result.toString(); } } //SiriusVariableImpl