blob: f8321960955d2beab1592073235e09a79210d816 [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{
* Jose C. Dominguez - Initial implementation
*
*/
package org.eclipse.osbp.xtext.strategy.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.strategy.Strategy;
import org.eclipse.osbp.xtext.strategy.StrategyDSLPackage;
import org.eclipse.osbp.xtext.strategy.StrategyDefault;
import org.eclipse.osbp.xtext.strategy.StrategyTarget;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Strategy</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyImpl#getTargets <em>Targets</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyImpl#getStrategyDefault <em>Strategy Default</em>}</li>
* </ul>
*
* @generated
*/
public class StrategyImpl extends MinimalEObjectImpl.Container implements Strategy {
/**
* The cached value of the '{@link #getTargets() <em>Targets</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargets()
* @generated
* @ordered
*/
protected StrategyTarget targets;
/**
* The cached value of the '{@link #getStrategyDefault() <em>Strategy Default</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStrategyDefault()
* @generated
* @ordered
*/
protected StrategyDefault strategyDefault;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StrategyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StrategyDSLPackage.Literals.STRATEGY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StrategyTarget getTargets() {
return targets;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTargets(StrategyTarget newTargets, NotificationChain msgs) {
StrategyTarget oldTargets = targets;
targets = newTargets;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StrategyDSLPackage.STRATEGY__TARGETS, oldTargets, newTargets);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTargets(StrategyTarget newTargets) {
if (newTargets != targets) {
NotificationChain msgs = null;
if (targets != null)
msgs = ((InternalEObject)targets).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StrategyDSLPackage.STRATEGY__TARGETS, null, msgs);
if (newTargets != null)
msgs = ((InternalEObject)newTargets).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StrategyDSLPackage.STRATEGY__TARGETS, null, msgs);
msgs = basicSetTargets(newTargets, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StrategyDSLPackage.STRATEGY__TARGETS, newTargets, newTargets));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StrategyDefault getStrategyDefault() {
return strategyDefault;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStrategyDefault(StrategyDefault newStrategyDefault, NotificationChain msgs) {
StrategyDefault oldStrategyDefault = strategyDefault;
strategyDefault = newStrategyDefault;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT, oldStrategyDefault, newStrategyDefault);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStrategyDefault(StrategyDefault newStrategyDefault) {
if (newStrategyDefault != strategyDefault) {
NotificationChain msgs = null;
if (strategyDefault != null)
msgs = ((InternalEObject)strategyDefault).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT, null, msgs);
if (newStrategyDefault != null)
msgs = ((InternalEObject)newStrategyDefault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT, null, msgs);
msgs = basicSetStrategyDefault(newStrategyDefault, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT, newStrategyDefault, newStrategyDefault));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StrategyDSLPackage.STRATEGY__TARGETS:
return basicSetTargets(null, msgs);
case StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT:
return basicSetStrategyDefault(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 StrategyDSLPackage.STRATEGY__TARGETS:
return getTargets();
case StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT:
return getStrategyDefault();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StrategyDSLPackage.STRATEGY__TARGETS:
setTargets((StrategyTarget)newValue);
return;
case StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT:
setStrategyDefault((StrategyDefault)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StrategyDSLPackage.STRATEGY__TARGETS:
setTargets((StrategyTarget)null);
return;
case StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT:
setStrategyDefault((StrategyDefault)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StrategyDSLPackage.STRATEGY__TARGETS:
return targets != null;
case StrategyDSLPackage.STRATEGY__STRATEGY_DEFAULT:
return strategyDefault != null;
}
return super.eIsSet(featureID);
}
} //StrategyImpl