blob: 9a360a21986397284356225894d6ee26b56bc6fe [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.datamartdsl.impl;
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;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.DatamartFunctionIntParameter;
import org.eclipse.osbp.xtext.datamartdsl.DatamartSetParameterFunction;
import org.eclipse.osbp.xtext.datamartdsl.SetParameterFunctionEnum;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Set Parameter Function</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartSetParameterFunctionImpl#getSetFunction <em>Set Function</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartSetParameterFunctionImpl#getParameter <em>Parameter</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartSetParameterFunctionImpl extends MinimalEObjectImpl.Container implements DatamartSetParameterFunction {
/**
* The default value of the '{@link #getSetFunction() <em>Set Function</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSetFunction()
* @generated
* @ordered
*/
protected static final SetParameterFunctionEnum SET_FUNCTION_EDEFAULT = SetParameterFunctionEnum.TAIL;
/**
* The cached value of the '{@link #getSetFunction() <em>Set Function</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSetFunction()
* @generated
* @ordered
*/
protected SetParameterFunctionEnum setFunction = SET_FUNCTION_EDEFAULT;
/**
* The cached value of the '{@link #getParameter() <em>Parameter</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParameter()
* @generated
* @ordered
*/
protected DatamartFunctionIntParameter parameter;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatamartSetParameterFunctionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_SET_PARAMETER_FUNCTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SetParameterFunctionEnum getSetFunction() {
return setFunction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSetFunction(SetParameterFunctionEnum newSetFunction) {
SetParameterFunctionEnum oldSetFunction = setFunction;
setFunction = newSetFunction == null ? SET_FUNCTION_EDEFAULT : newSetFunction;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__SET_FUNCTION, oldSetFunction, setFunction));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartFunctionIntParameter getParameter() {
return parameter;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetParameter(DatamartFunctionIntParameter newParameter, NotificationChain msgs) {
DatamartFunctionIntParameter oldParameter = parameter;
parameter = newParameter;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER, oldParameter, newParameter);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setParameter(DatamartFunctionIntParameter newParameter) {
if (newParameter != parameter) {
NotificationChain msgs = null;
if (parameter != null)
msgs = ((InternalEObject)parameter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER, null, msgs);
if (newParameter != null)
msgs = ((InternalEObject)newParameter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER, null, msgs);
msgs = basicSetParameter(newParameter, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER, newParameter, newParameter));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER:
return basicSetParameter(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 DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__SET_FUNCTION:
return getSetFunction();
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER:
return getParameter();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__SET_FUNCTION:
setSetFunction((SetParameterFunctionEnum)newValue);
return;
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER:
setParameter((DatamartFunctionIntParameter)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__SET_FUNCTION:
setSetFunction(SET_FUNCTION_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER:
setParameter((DatamartFunctionIntParameter)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__SET_FUNCTION:
return setFunction != SET_FUNCTION_EDEFAULT;
case DatamartDSLPackage.DATAMART_SET_PARAMETER_FUNCTION__PARAMETER:
return parameter != 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(" (setFunction: ");
result.append(setFunction);
result.append(')');
return result.toString();
}
} //DatamartSetParameterFunctionImpl