blob: d8e8585dcedd212c2693e0b014abe1162ee25837 [file] [log] [blame]
/**
* Copyright (c) 2014, Loetz GmbH&Co.KG (Heidelberg)
* 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:
* Loetz GmbH&Co.KG - Initial implementation
*
*/
package org.eclipse.osbp.xtext.blip.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.blip.BlipDSLPackage;
import org.eclipse.osbp.xtext.blip.BlipDto;
import org.eclipse.osbp.xtext.blip.BlipFilter;
import org.eclipse.osbp.xtext.blip.BlipWorkload;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Blip Workload</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.blip.impl.BlipWorkloadImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.blip.impl.BlipWorkloadImpl#getFilters <em>Filters</em>}</li>
* </ul>
*
* @generated
*/
public class BlipWorkloadImpl extends BlipLazyResolverImpl implements BlipWorkload {
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected BlipDto source;
/**
* The cached value of the '{@link #getFilters() <em>Filters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFilters()
* @generated
* @ordered
*/
protected EList<BlipFilter> filters;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BlipWorkloadImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BlipDSLPackage.Literals.BLIP_WORKLOAD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BlipDto getSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(BlipDto newSource, NotificationChain msgs) {
BlipDto oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BlipDSLPackage.BLIP_WORKLOAD__SOURCE, oldSource, newSource);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(BlipDto newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BlipDSLPackage.BLIP_WORKLOAD__SOURCE, null, msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BlipDSLPackage.BLIP_WORKLOAD__SOURCE, null, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BlipDSLPackage.BLIP_WORKLOAD__SOURCE, newSource, newSource));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<BlipFilter> getFilters() {
if (filters == null) {
filters = new EObjectContainmentEList<BlipFilter>(BlipFilter.class, this, BlipDSLPackage.BLIP_WORKLOAD__FILTERS);
}
return filters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BlipDSLPackage.BLIP_WORKLOAD__SOURCE:
return basicSetSource(null, msgs);
case BlipDSLPackage.BLIP_WORKLOAD__FILTERS:
return ((InternalEList<?>)getFilters()).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 BlipDSLPackage.BLIP_WORKLOAD__SOURCE:
return getSource();
case BlipDSLPackage.BLIP_WORKLOAD__FILTERS:
return getFilters();
}
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 BlipDSLPackage.BLIP_WORKLOAD__SOURCE:
setSource((BlipDto)newValue);
return;
case BlipDSLPackage.BLIP_WORKLOAD__FILTERS:
getFilters().clear();
getFilters().addAll((Collection<? extends BlipFilter>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BlipDSLPackage.BLIP_WORKLOAD__SOURCE:
setSource((BlipDto)null);
return;
case BlipDSLPackage.BLIP_WORKLOAD__FILTERS:
getFilters().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BlipDSLPackage.BLIP_WORKLOAD__SOURCE:
return source != null;
case BlipDSLPackage.BLIP_WORKLOAD__FILTERS:
return filters != null && !filters.isEmpty();
}
return super.eIsSet(featureID);
}
} //BlipWorkloadImpl