/******************************************************************************
* Copyright (c) 2009-2013, Linagora
*
* 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:
* Linagora - initial API and implementation
*******************************************************************************/
package com.sun.java.xml.ns.jbi.impl;
import com.sun.java.xml.ns.jbi.Connection;
import com.sun.java.xml.ns.jbi.Consumer;
import com.sun.java.xml.ns.jbi.JbiPackage;
import com.sun.java.xml.ns.jbi.Provider;
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.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Connection</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.sun.java.xml.ns.jbi.impl.ConnectionImpl#getConsumer <em>Consumer</em>}</li>
* <li>{@link com.sun.java.xml.ns.jbi.impl.ConnectionImpl#getProvider <em>Provider</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConnectionImpl extends EObjectImpl implements Connection {
/**
* The cached value of the '{@link #getConsumer() <em>Consumer</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConsumer()
* @generated
* @ordered
*/
protected Consumer consumer;
/**
* The cached value of the '{@link #getProvider() <em>Provider</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProvider()
* @generated
* @ordered
*/
protected Provider provider;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConnectionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JbiPackage.Literals.CONNECTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Consumer getConsumer() {
return consumer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetConsumer(Consumer newConsumer, NotificationChain msgs) {
Consumer oldConsumer = consumer;
consumer = newConsumer;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JbiPackage.CONNECTION__CONSUMER, oldConsumer, newConsumer);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConsumer(Consumer newConsumer) {
if (newConsumer != consumer) {
NotificationChain msgs = null;
if (consumer != null)
msgs = ((InternalEObject)consumer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JbiPackage.CONNECTION__CONSUMER, null, msgs);
if (newConsumer != null)
msgs = ((InternalEObject)newConsumer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JbiPackage.CONNECTION__CONSUMER, null, msgs);
msgs = basicSetConsumer(newConsumer, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JbiPackage.CONNECTION__CONSUMER, newConsumer, newConsumer));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Provider getProvider() {
return provider;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetProvider(Provider newProvider, NotificationChain msgs) {
Provider oldProvider = provider;
provider = newProvider;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JbiPackage.CONNECTION__PROVIDER, oldProvider, newProvider);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProvider(Provider newProvider) {
if (newProvider != provider) {
NotificationChain msgs = null;
if (provider != null)
msgs = ((InternalEObject)provider).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JbiPackage.CONNECTION__PROVIDER, null, msgs);
if (newProvider != null)
msgs = ((InternalEObject)newProvider).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JbiPackage.CONNECTION__PROVIDER, null, msgs);
msgs = basicSetProvider(newProvider, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JbiPackage.CONNECTION__PROVIDER, newProvider, newProvider));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JbiPackage.CONNECTION__CONSUMER:
return basicSetConsumer(null, msgs);
case JbiPackage.CONNECTION__PROVIDER:
return basicSetProvider(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 JbiPackage.CONNECTION__CONSUMER:
return getConsumer();
case JbiPackage.CONNECTION__PROVIDER:
return getProvider();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JbiPackage.CONNECTION__CONSUMER:
setConsumer((Consumer)newValue);
return;
case JbiPackage.CONNECTION__PROVIDER:
setProvider((Provider)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JbiPackage.CONNECTION__CONSUMER:
setConsumer((Consumer)null);
return;
case JbiPackage.CONNECTION__PROVIDER:
setProvider((Provider)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JbiPackage.CONNECTION__CONSUMER:
return consumer != null;
case JbiPackage.CONNECTION__PROVIDER:
return provider != null;
}
return super.eIsSet(featureID);
}
} //ConnectionImpl