blob: 2c345febc63589f2a1c58974f178a72ab4526d92 [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:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.reportdsl.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.osbp.xtext.reportdsl.DatamartTableGroup;
import org.eclipse.osbp.xtext.reportdsl.ReportDSLPackage;
import org.eclipse.osbp.xtext.reportdsl.TableAggregation;
import org.eclipse.osbp.xtext.reportdsl.TableBaseAggregation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Table Aggregation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.TableAggregationImpl#getText <em>Text</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.TableAggregationImpl#getAggregation <em>Aggregation</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.reportdsl.impl.TableAggregationImpl#getOnGroup <em>On Group</em>}</li>
* </ul>
*
* @generated
*/
public class TableAggregationImpl extends ReportLazyResolverImpl implements TableAggregation {
/**
* The default value of the '{@link #getText() <em>Text</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected static final String TEXT_EDEFAULT = null;
/**
* The cached value of the '{@link #getText() <em>Text</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected String text = TEXT_EDEFAULT;
/**
* The cached value of the '{@link #getAggregation() <em>Aggregation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAggregation()
* @generated
* @ordered
*/
protected TableBaseAggregation aggregation;
/**
* The cached value of the '{@link #getOnGroup() <em>On Group</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOnGroup()
* @generated
* @ordered
*/
protected DatamartTableGroup onGroup;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TableAggregationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ReportDSLPackage.Literals.TABLE_AGGREGATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getText() {
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setText(String newText) {
String oldText = text;
text = newText;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.TABLE_AGGREGATION__TEXT, oldText, text));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TableBaseAggregation getAggregation() {
return aggregation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAggregation(TableBaseAggregation newAggregation, NotificationChain msgs) {
TableBaseAggregation oldAggregation = aggregation;
aggregation = newAggregation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION, oldAggregation, newAggregation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAggregation(TableBaseAggregation newAggregation) {
if (newAggregation != aggregation) {
NotificationChain msgs = null;
if (aggregation != null)
msgs = ((InternalEObject)aggregation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION, null, msgs);
if (newAggregation != null)
msgs = ((InternalEObject)newAggregation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION, null, msgs);
msgs = basicSetAggregation(newAggregation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION, newAggregation, newAggregation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartTableGroup getOnGroup() {
if (onGroup != null && onGroup.eIsProxy()) {
InternalEObject oldOnGroup = (InternalEObject)onGroup;
onGroup = (DatamartTableGroup)eResolveProxy(oldOnGroup);
if (onGroup != oldOnGroup) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP, oldOnGroup, onGroup));
}
}
return onGroup;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartTableGroup basicGetOnGroup() {
return onGroup;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOnGroup(DatamartTableGroup newOnGroup) {
DatamartTableGroup oldOnGroup = onGroup;
onGroup = newOnGroup;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP, oldOnGroup, onGroup));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION:
return basicSetAggregation(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 ReportDSLPackage.TABLE_AGGREGATION__TEXT:
return getText();
case ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION:
return getAggregation();
case ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP:
if (resolve) return getOnGroup();
return basicGetOnGroup();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ReportDSLPackage.TABLE_AGGREGATION__TEXT:
setText((String)newValue);
return;
case ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION:
setAggregation((TableBaseAggregation)newValue);
return;
case ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP:
setOnGroup((DatamartTableGroup)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ReportDSLPackage.TABLE_AGGREGATION__TEXT:
setText(TEXT_EDEFAULT);
return;
case ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION:
setAggregation((TableBaseAggregation)null);
return;
case ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP:
setOnGroup((DatamartTableGroup)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ReportDSLPackage.TABLE_AGGREGATION__TEXT:
return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
case ReportDSLPackage.TABLE_AGGREGATION__AGGREGATION:
return aggregation != null;
case ReportDSLPackage.TABLE_AGGREGATION__ON_GROUP:
return onGroup != 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(" (text: ");
result.append(text);
result.append(')');
return result.toString();
}
} //TableAggregationImpl