| /** |
| * 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.strategy.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.strategy.FocusingEnhancer; |
| import org.eclipse.osbp.xtext.strategy.FocusingStrategy; |
| import org.eclipse.osbp.xtext.strategy.LayoutingStrategy; |
| 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 Target</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyTargetImpl#getLayoutingStrategies <em>Layouting Strategies</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyTargetImpl#getFocusingStrategies <em>Focusing Strategies</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyTargetImpl#getFocusingEnhancer <em>Focusing Enhancer</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.strategy.impl.StrategyTargetImpl#getStrategyDefault <em>Strategy Default</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class StrategyTargetImpl extends MinimalEObjectImpl.Container implements StrategyTarget { |
| /** |
| * The cached value of the '{@link #getLayoutingStrategies() <em>Layouting Strategies</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLayoutingStrategies() |
| * @generated |
| * @ordered |
| */ |
| protected EList<LayoutingStrategy> layoutingStrategies; |
| |
| /** |
| * The cached value of the '{@link #getFocusingStrategies() <em>Focusing Strategies</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFocusingStrategies() |
| * @generated |
| * @ordered |
| */ |
| protected EList<FocusingStrategy> focusingStrategies; |
| |
| /** |
| * The cached value of the '{@link #getFocusingEnhancer() <em>Focusing Enhancer</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFocusingEnhancer() |
| * @generated |
| * @ordered |
| */ |
| protected EList<FocusingEnhancer> focusingEnhancer; |
| |
| /** |
| * 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 StrategyTargetImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return StrategyDSLPackage.Literals.STRATEGY_TARGET; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<LayoutingStrategy> getLayoutingStrategies() { |
| if (layoutingStrategies == null) { |
| layoutingStrategies = new EObjectContainmentEList<LayoutingStrategy>(LayoutingStrategy.class, this, StrategyDSLPackage.STRATEGY_TARGET__LAYOUTING_STRATEGIES); |
| } |
| return layoutingStrategies; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<FocusingStrategy> getFocusingStrategies() { |
| if (focusingStrategies == null) { |
| focusingStrategies = new EObjectContainmentEList<FocusingStrategy>(FocusingStrategy.class, this, StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES); |
| } |
| return focusingStrategies; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<FocusingEnhancer> getFocusingEnhancer() { |
| if (focusingEnhancer == null) { |
| focusingEnhancer = new EObjectContainmentEList<FocusingEnhancer>(FocusingEnhancer.class, this, StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER); |
| } |
| return focusingEnhancer; |
| } |
| |
| /** |
| * <!-- 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_TARGET__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_TARGET__STRATEGY_DEFAULT, null, msgs); |
| if (newStrategyDefault != null) |
| msgs = ((InternalEObject)newStrategyDefault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StrategyDSLPackage.STRATEGY_TARGET__STRATEGY_DEFAULT, null, msgs); |
| msgs = basicSetStrategyDefault(newStrategyDefault, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StrategyDSLPackage.STRATEGY_TARGET__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_TARGET__LAYOUTING_STRATEGIES: |
| return ((InternalEList<?>)getLayoutingStrategies()).basicRemove(otherEnd, msgs); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES: |
| return ((InternalEList<?>)getFocusingStrategies()).basicRemove(otherEnd, msgs); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER: |
| return ((InternalEList<?>)getFocusingEnhancer()).basicRemove(otherEnd, msgs); |
| case StrategyDSLPackage.STRATEGY_TARGET__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_TARGET__LAYOUTING_STRATEGIES: |
| return getLayoutingStrategies(); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES: |
| return getFocusingStrategies(); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER: |
| return getFocusingEnhancer(); |
| case StrategyDSLPackage.STRATEGY_TARGET__STRATEGY_DEFAULT: |
| return getStrategyDefault(); |
| } |
| 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 StrategyDSLPackage.STRATEGY_TARGET__LAYOUTING_STRATEGIES: |
| getLayoutingStrategies().clear(); |
| getLayoutingStrategies().addAll((Collection<? extends LayoutingStrategy>)newValue); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES: |
| getFocusingStrategies().clear(); |
| getFocusingStrategies().addAll((Collection<? extends FocusingStrategy>)newValue); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER: |
| getFocusingEnhancer().clear(); |
| getFocusingEnhancer().addAll((Collection<? extends FocusingEnhancer>)newValue); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__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_TARGET__LAYOUTING_STRATEGIES: |
| getLayoutingStrategies().clear(); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES: |
| getFocusingStrategies().clear(); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER: |
| getFocusingEnhancer().clear(); |
| return; |
| case StrategyDSLPackage.STRATEGY_TARGET__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_TARGET__LAYOUTING_STRATEGIES: |
| return layoutingStrategies != null && !layoutingStrategies.isEmpty(); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_STRATEGIES: |
| return focusingStrategies != null && !focusingStrategies.isEmpty(); |
| case StrategyDSLPackage.STRATEGY_TARGET__FOCUSING_ENHANCER: |
| return focusingEnhancer != null && !focusingEnhancer.isEmpty(); |
| case StrategyDSLPackage.STRATEGY_TARGET__STRATEGY_DEFAULT: |
| return strategyDefault != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //StrategyTargetImpl |