blob: 57c3a7a0f04bd3cfa1f01a4dc8144266e3f06076 [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
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.core.common.model.core.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.osbp.ecview.core.common.model.binding.impl.YListBindingEndpointImpl;
import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
import org.eclipse.osbp.ecview.core.common.model.core.YCollectionBindable;
import org.eclipse.osbp.ecview.core.common.model.core.YElement;
import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>YEmbeddable Collection Endpoint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YEmbeddableCollectionEndpointImpl#getElement <em>Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class YEmbeddableCollectionEndpointImpl extends YListBindingEndpointImpl implements YEmbeddableCollectionEndpoint {
/**
* The cached value of the '{@link #getElement() <em>Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElement()
* @generated
* @ordered
*/
protected YCollectionBindable element;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected YEmbeddableCollectionEndpointImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CoreModelPackage.Literals.YEMBEDDABLE_COLLECTION_ENDPOINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public YCollectionBindable getElement() {
if (element != null && element.eIsProxy()) {
InternalEObject oldElement = (InternalEObject)element;
element = (YCollectionBindable)eResolveProxy(oldElement);
if (element != oldElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT, oldElement, element));
}
}
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public YCollectionBindable basicGetElement() {
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetElement(YCollectionBindable newElement, NotificationChain msgs) {
YCollectionBindable oldElement = element;
element = newElement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT, oldElement, newElement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setElement(YCollectionBindable newElement) {
if (newElement != element) {
NotificationChain msgs = null;
if (element != null)
msgs = ((InternalEObject)element).eInverseRemove(this, CoreModelPackage.YCOLLECTION_BINDABLE__COLLECTION_BINDING_ENDPOINT, YCollectionBindable.class, msgs);
if (newElement != null)
msgs = ((InternalEObject)newElement).eInverseAdd(this, CoreModelPackage.YCOLLECTION_BINDABLE__COLLECTION_BINDING_ENDPOINT, YCollectionBindable.class, msgs);
msgs = basicSetElement(newElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT, newElement, newElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
if (element != null)
msgs = ((InternalEObject)element).eInverseRemove(this, CoreModelPackage.YCOLLECTION_BINDABLE__COLLECTION_BINDING_ENDPOINT, YCollectionBindable.class, msgs);
return basicSetElement((YCollectionBindable)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
return basicSetElement(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 CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
if (resolve) return getElement();
return basicGetElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
setElement((YCollectionBindable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
setElement((YCollectionBindable)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CoreModelPackage.YEMBEDDABLE_COLLECTION_ENDPOINT__ELEMENT:
return element != null;
}
return super.eIsSet(featureID);
}
@Override
public boolean isBindsElement(YElement element) {
return element == getElement();
}
} //YEmbeddableCollectionEndpointImpl