blob: 3350ea68cb2ea89392d489d6c34009615145ec28 [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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* 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.AggregationEnum;
import org.eclipse.osbp.xtext.datamartdsl.DatamartAggregationFunction;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.DatamartFunctionIntParameter;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Aggregation Function</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAggregationFunctionImpl#getAggregation <em>Aggregation</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAggregationFunctionImpl#getParameter <em>Parameter</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartAggregationFunctionImpl extends MinimalEObjectImpl.Container implements DatamartAggregationFunction {
/**
* The default value of the '{@link #getAggregation() <em>Aggregation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAggregation()
* @generated
* @ordered
*/
protected static final AggregationEnum AGGREGATION_EDEFAULT = AggregationEnum.AVG;
/**
* The cached value of the '{@link #getAggregation() <em>Aggregation</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAggregation()
* @generated
* @ordered
*/
protected AggregationEnum aggregation = AGGREGATION_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 DatamartAggregationFunctionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_AGGREGATION_FUNCTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AggregationEnum getAggregation() {
return aggregation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAggregation(AggregationEnum newAggregation) {
AggregationEnum oldAggregation = aggregation;
aggregation = newAggregation == null ? AGGREGATION_EDEFAULT : newAggregation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_AGGREGATION_FUNCTION__AGGREGATION, oldAggregation, aggregation));
}
/**
* <!-- 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_AGGREGATION_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_AGGREGATION_FUNCTION__PARAMETER, null, msgs);
if (newParameter != null)
msgs = ((InternalEObject)newParameter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_AGGREGATION_FUNCTION__PARAMETER, null, msgs);
msgs = basicSetParameter(newParameter, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_AGGREGATION_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_AGGREGATION_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_AGGREGATION_FUNCTION__AGGREGATION:
return getAggregation();
case DatamartDSLPackage.DATAMART_AGGREGATION_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_AGGREGATION_FUNCTION__AGGREGATION:
setAggregation((AggregationEnum)newValue);
return;
case DatamartDSLPackage.DATAMART_AGGREGATION_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_AGGREGATION_FUNCTION__AGGREGATION:
setAggregation(AGGREGATION_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_AGGREGATION_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_AGGREGATION_FUNCTION__AGGREGATION:
return aggregation != AGGREGATION_EDEFAULT;
case DatamartDSLPackage.DATAMART_AGGREGATION_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(" (aggregation: ");
result.append(aggregation);
result.append(')');
return result.toString();
}
} //DatamartAggregationFunctionImpl