blob: 7ad14ef0d4cad8364e62e6b415848b704799baaa [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 java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis;
import org.eclipse.osbp.xtext.datamartdsl.DatamartCubeAxis;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.DatamartElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Cube Axis</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartCubeAxisImpl#getAxis <em>Axis</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartCubeAxisImpl#getElements <em>Elements</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartCubeAxisImpl extends MinimalEObjectImpl.Container implements DatamartCubeAxis {
/**
* The cached value of the '{@link #getAxis() <em>Axis</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAxis()
* @generated
* @ordered
*/
protected DatamartAxis axis;
/**
* The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElements()
* @generated
* @ordered
*/
protected EList<DatamartElement> elements;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatamartCubeAxisImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_CUBE_AXIS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis getAxis() {
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAxis(DatamartAxis newAxis, NotificationChain msgs) {
DatamartAxis oldAxis = axis;
axis = newAxis;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS, oldAxis, newAxis);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAxis(DatamartAxis newAxis) {
if (newAxis != axis) {
NotificationChain msgs = null;
if (axis != null)
msgs = ((InternalEObject)axis).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS, null, msgs);
if (newAxis != null)
msgs = ((InternalEObject)newAxis).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS, null, msgs);
msgs = basicSetAxis(newAxis, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS, newAxis, newAxis));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<DatamartElement> getElements() {
if (elements == null) {
elements = new EObjectContainmentEList<DatamartElement>(DatamartElement.class, this, DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS);
}
return elements;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS:
return basicSetAxis(null, msgs);
case DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS:
return ((InternalEList<?>)getElements()).basicRemove(otherEnd, 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_CUBE_AXIS__AXIS:
return getAxis();
case DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS:
return getElements();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS:
setAxis((DatamartAxis)newValue);
return;
case DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS:
getElements().clear();
getElements().addAll((Collection<? extends DatamartElement>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS:
setAxis((DatamartAxis)null);
return;
case DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS:
getElements().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_CUBE_AXIS__AXIS:
return axis != null;
case DatamartDSLPackage.DATAMART_CUBE_AXIS__ELEMENTS:
return elements != null && !elements.isEmpty();
}
return super.eIsSet(featureID);
}
} //DatamartCubeAxisImpl