blob: 97a3b74148666305add6142671525da83a6749fe [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016 Willink Transformations and others.
* 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
*
* Contributors:
* E.D.Willink - initial API and implementation
*******************************************************************************/
/**
*/
package example4.kiamaas.impl;
import example4.kiamaas.Composite;
import example4.kiamaas.KiamaasPackage;
import example4.kiamaas.Node;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Composite</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link example4.kiamaas.impl.CompositeImpl#getChild <em>Child</em>}</li>
* </ul>
*
* @generated
*/
public class CompositeImpl extends NodeImpl implements Composite {
/**
* The cached value of the '{@link #getChild() <em>Child</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChild()
* @generated
* @ordered
*/
protected Node child;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CompositeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return KiamaasPackage.Literals.COMPOSITE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Node getChild() {
return child;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetChild(Node newChild, NotificationChain msgs) {
Node oldChild = child;
child = newChild;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, KiamaasPackage.COMPOSITE__CHILD, oldChild, newChild);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setChild(Node newChild) {
if (newChild != child) {
NotificationChain msgs = null;
if (child != null)
msgs = ((InternalEObject)child).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - KiamaasPackage.COMPOSITE__CHILD, null, msgs);
if (newChild != null)
msgs = ((InternalEObject)newChild).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - KiamaasPackage.COMPOSITE__CHILD, null, msgs);
msgs = basicSetChild(newChild, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, KiamaasPackage.COMPOSITE__CHILD, newChild, newChild));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case KiamaasPackage.COMPOSITE__CHILD:
return basicSetChild(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 KiamaasPackage.COMPOSITE__CHILD:
return getChild();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case KiamaasPackage.COMPOSITE__CHILD:
setChild((Node)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case KiamaasPackage.COMPOSITE__CHILD:
setChild((Node)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case KiamaasPackage.COMPOSITE__CHILD:
return child != null;
}
return super.eIsSet(featureID);
}
} //CompositeImpl