blob: 6d69c2135bd1886965a838eaedf103150d299539 [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.DatamartParameterFunction;
import org.eclipse.osbp.xtext.datamartdsl.ParameterFunctionEnum;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Parameter Function</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartParameterFunctionImpl#getFunction <em>Function</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartParameterFunctionImpl#getParameter <em>Parameter</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartParameterFunctionImpl extends MinimalEObjectImpl.Container implements DatamartParameterFunction {
/**
* The default value of the '{@link #getFunction() <em>Function</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFunction()
* @generated
* @ordered
*/
protected static final ParameterFunctionEnum FUNCTION_EDEFAULT = ParameterFunctionEnum.LAG;
/**
* The cached value of the '{@link #getFunction() <em>Function</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFunction()
* @generated
* @ordered
*/
protected ParameterFunctionEnum function = 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 DatamartParameterFunctionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_PARAMETER_FUNCTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ParameterFunctionEnum getFunction() {
return function;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFunction(ParameterFunctionEnum newFunction) {
ParameterFunctionEnum oldFunction = function;
function = newFunction == null ? FUNCTION_EDEFAULT : newFunction;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_PARAMETER_FUNCTION__FUNCTION, oldFunction, function));
}
/**
* <!-- 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_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_PARAMETER_FUNCTION__PARAMETER, null, msgs);
if (newParameter != null)
msgs = ((InternalEObject)newParameter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_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_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_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_PARAMETER_FUNCTION__FUNCTION:
return getFunction();
case DatamartDSLPackage.DATAMART_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_PARAMETER_FUNCTION__FUNCTION:
setFunction((ParameterFunctionEnum)newValue);
return;
case DatamartDSLPackage.DATAMART_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_PARAMETER_FUNCTION__FUNCTION:
setFunction(FUNCTION_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_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_PARAMETER_FUNCTION__FUNCTION:
return function != FUNCTION_EDEFAULT;
case DatamartDSLPackage.DATAMART_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(" (function: ");
result.append(function);
result.append(')');
return result.toString();
}
} //DatamartParameterFunctionImpl