/** * 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.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.SiriusParameter; import org.eclipse.sirius.expression.SiriusVariable; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Sirius Parameter</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.sirius.expression.impl.SiriusParameterImpl#isOptional <em>Optional</em>}</li> * <li>{@link org.eclipse.sirius.expression.impl.SiriusParameterImpl#getVariable <em>Variable</em>}</li> * </ul> * * @generated */ public class SiriusParameterImpl extends MinimalEObjectImpl.Container implements SiriusParameter { /** * The default value of the '{@link #isOptional() <em>Optional</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isOptional() * @generated * @ordered */ protected static final boolean OPTIONAL_EDEFAULT = false; /** * The cached value of the '{@link #isOptional() <em>Optional</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isOptional() * @generated * @ordered */ protected boolean optional = OPTIONAL_EDEFAULT; /** * The cached value of the '{@link #getVariable() <em>Variable</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVariable() * @generated * @ordered */ protected SiriusVariable variable; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SiriusParameterImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ExpressionPackage.Literals.SIRIUS_PARAMETER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isOptional() { return optional; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOptional(boolean newOptional) { boolean oldOptional = optional; optional = newOptional; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.SIRIUS_PARAMETER__OPTIONAL, oldOptional, optional)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SiriusVariable getVariable() { if (variable != null && variable.eIsProxy()) { InternalEObject oldVariable = (InternalEObject)variable; variable = (SiriusVariable)eResolveProxy(oldVariable); if (variable != oldVariable) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ExpressionPackage.SIRIUS_PARAMETER__VARIABLE, oldVariable, variable)); } } return variable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SiriusVariable basicGetVariable() { return variable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVariable(SiriusVariable newVariable) { SiriusVariable oldVariable = variable; variable = newVariable; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.SIRIUS_PARAMETER__VARIABLE, oldVariable, variable)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionPackage.SIRIUS_PARAMETER__OPTIONAL: return isOptional(); case ExpressionPackage.SIRIUS_PARAMETER__VARIABLE: if (resolve) return getVariable(); return basicGetVariable(); } 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_PARAMETER__OPTIONAL: setOptional((Boolean)newValue); return; case ExpressionPackage.SIRIUS_PARAMETER__VARIABLE: setVariable((SiriusVariable)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionPackage.SIRIUS_PARAMETER__OPTIONAL: setOptional(OPTIONAL_EDEFAULT); return; case ExpressionPackage.SIRIUS_PARAMETER__VARIABLE: setVariable((SiriusVariable)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionPackage.SIRIUS_PARAMETER__OPTIONAL: return optional != OPTIONAL_EDEFAULT; case ExpressionPackage.SIRIUS_PARAMETER__VARIABLE: return variable != 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(" (optional: "); //$NON-NLS-1$ result.append(optional); result.append(')'); return result.toString(); } } //SiriusParameterImpl