blob: 9ceecd4784b3c23ad77f448e6354526cb55b23a1 [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 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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchyLevelMultiple;
import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchyLevelSingle;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Hierarchy Level Multiple</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartHierarchyLevelMultipleImpl#isPost <em>Post</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartHierarchyLevelMultipleImpl#getLevels <em>Levels</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartHierarchyLevelMultipleImpl extends DatamartLazyResolverImpl implements DatamartHierarchyLevelMultiple {
/**
* The default value of the '{@link #isPost() <em>Post</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPost()
* @generated
* @ordered
*/
protected static final boolean POST_EDEFAULT = false;
/**
* The cached value of the '{@link #isPost() <em>Post</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPost()
* @generated
* @ordered
*/
protected boolean post = POST_EDEFAULT;
/**
* The cached value of the '{@link #getLevels() <em>Levels</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLevels()
* @generated
* @ordered
*/
protected EList<DatamartHierarchyLevelSingle> levels;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatamartHierarchyLevelMultipleImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_HIERARCHY_LEVEL_MULTIPLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isPost() {
return post;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPost(boolean newPost) {
boolean oldPost = post;
post = newPost;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__POST, oldPost, post));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<DatamartHierarchyLevelSingle> getLevels() {
if (levels == null) {
levels = new EObjectContainmentEList<DatamartHierarchyLevelSingle>(DatamartHierarchyLevelSingle.class, this, DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS);
}
return levels;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS:
return ((InternalEList<?>)getLevels()).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_HIERARCHY_LEVEL_MULTIPLE__POST:
return isPost();
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS:
return getLevels();
}
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_HIERARCHY_LEVEL_MULTIPLE__POST:
setPost((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS:
getLevels().clear();
getLevels().addAll((Collection<? extends DatamartHierarchyLevelSingle>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__POST:
setPost(POST_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS:
getLevels().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__POST:
return post != POST_EDEFAULT;
case DatamartDSLPackage.DATAMART_HIERARCHY_LEVEL_MULTIPLE__LEVELS:
return levels != null && !levels.isEmpty();
}
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(" (post: ");
result.append(post);
result.append(')');
return result.toString();
}
} //DatamartHierarchyLevelMultipleImpl