blob: 36a90519bbacf1d376a04fee0857018da19d116d [file] [log] [blame]
/**
* Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
*
* 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
*
* Contributors:
* Lucas Koehler - initial API and implementation
*/
package org.eclipse.emfforms.core.services.databinding.testmodel.test.model.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.EObjectResolvingEList;
import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.A;
import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.B;
import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.TestPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>A</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.emfforms.core.services.databinding.testmodel.test.model.impl.AImpl#getB <em>B</em>}</li>
* <li>{@link org.eclipse.emfforms.core.services.databinding.testmodel.test.model.impl.AImpl#getBList
* <em>BList</em>}</li>
* </ul>
*
* @generated
*/
public class AImpl extends EImpl implements A {
/**
* The cached value of the '{@link #getB() <em>B</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getB()
* @generated
* @ordered
*/
protected B b;
/**
* The cached value of the '{@link #getBList() <em>BList</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getBList()
* @generated
* @ordered
*/
protected EList<B> bList;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected AImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return TestPackage.Literals.A;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public B getB() {
return b;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetB(B newB, NotificationChain msgs) {
final B oldB = b;
b = newB;
if (eNotificationRequired()) {
final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TestPackage.A__B, oldB,
newB);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setB(B newB) {
if (newB != b) {
NotificationChain msgs = null;
if (b != null) {
msgs = ((InternalEObject) b).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TestPackage.A__B, null,
msgs);
}
if (newB != null) {
msgs = ((InternalEObject) newB).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TestPackage.A__B, null,
msgs);
}
msgs = basicSetB(newB, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.A__B, newB, newB));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<B> getBList() {
if (bList == null) {
bList = new EObjectResolvingEList<>(B.class, this, TestPackage.A__BLIST);
}
return bList;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TestPackage.A__B:
return basicSetB(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 TestPackage.A__B:
return getB();
case TestPackage.A__BLIST:
return getBList();
}
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 TestPackage.A__B:
setB((B) newValue);
return;
case TestPackage.A__BLIST:
getBList().clear();
getBList().addAll((Collection<? extends B>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TestPackage.A__B:
setB((B) null);
return;
case TestPackage.A__BLIST:
getBList().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TestPackage.A__B:
return b != null;
case TestPackage.A__BLIST:
return bList != null && !bList.isEmpty();
}
return super.eIsSet(featureID);
}
} // AImpl