org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.20.0
*/
package org.contextmapper.tactic.dsl.tacticdsl.impl;
import java.util.Collection;
import org.contextmapper.tactic.dsl.tacticdsl.Consumer;
import org.contextmapper.tactic.dsl.tacticdsl.Dependency;
import org.contextmapper.tactic.dsl.tacticdsl.DomainObject;
import org.contextmapper.tactic.dsl.tacticdsl.Subscribe;
import org.contextmapper.tactic.dsl.tacticdsl.TacticdslPackage;
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;
/**
*
* An implementation of the model object 'Consumer'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getDoc Doc}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getName Name}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getHint Hint}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getDependencies Dependencies}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getMessageRoot Message Root}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getChannel Channel}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ConsumerImpl#getSubscribe Subscribe}
*
*
* @generated
*/
public class ConsumerImpl extends MinimalEObjectImpl.Container implements Consumer
{
/**
* The default value of the '{@link #getDoc() Doc}' attribute.
*
*
* @see #getDoc()
* @generated
* @ordered
*/
protected static final String DOC_EDEFAULT = null;
/**
* The cached value of the '{@link #getDoc() Doc}' attribute.
*
*
* @see #getDoc()
* @generated
* @ordered
*/
protected String doc = DOC_EDEFAULT;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getHint() Hint}' attribute.
*
*
* @see #getHint()
* @generated
* @ordered
*/
protected static final String HINT_EDEFAULT = null;
/**
* The cached value of the '{@link #getHint() Hint}' attribute.
*
*
* @see #getHint()
* @generated
* @ordered
*/
protected String hint = HINT_EDEFAULT;
/**
* The cached value of the '{@link #getDependencies() Dependencies}' containment reference list.
*
*
* @see #getDependencies()
* @generated
* @ordered
*/
protected EList dependencies;
/**
* The cached value of the '{@link #getMessageRoot() Message Root}' reference.
*
*
* @see #getMessageRoot()
* @generated
* @ordered
*/
protected DomainObject messageRoot;
/**
* The default value of the '{@link #getChannel() Channel}' attribute.
*
*
* @see #getChannel()
* @generated
* @ordered
*/
protected static final String CHANNEL_EDEFAULT = null;
/**
* The cached value of the '{@link #getChannel() Channel}' attribute.
*
*
* @see #getChannel()
* @generated
* @ordered
*/
protected String channel = CHANNEL_EDEFAULT;
/**
* The cached value of the '{@link #getSubscribe() Subscribe}' containment reference.
*
*
* @see #getSubscribe()
* @generated
* @ordered
*/
protected Subscribe subscribe;
/**
*
*
* @generated
*/
protected ConsumerImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return TacticdslPackage.Literals.CONSUMER;
}
/**
*
*
* @generated
*/
public String getDoc()
{
return doc;
}
/**
*
*
* @generated
*/
public void setDoc(String newDoc)
{
String oldDoc = doc;
doc = newDoc;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__DOC, oldDoc, doc));
}
/**
*
*
* @generated
*/
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public String getHint()
{
return hint;
}
/**
*
*
* @generated
*/
public void setHint(String newHint)
{
String oldHint = hint;
hint = newHint;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__HINT, oldHint, hint));
}
/**
*
*
* @generated
*/
public EList getDependencies()
{
if (dependencies == null)
{
dependencies = new EObjectContainmentEList(Dependency.class, this, TacticdslPackage.CONSUMER__DEPENDENCIES);
}
return dependencies;
}
/**
*
*
* @generated
*/
public DomainObject getMessageRoot()
{
if (messageRoot != null && messageRoot.eIsProxy())
{
InternalEObject oldMessageRoot = (InternalEObject)messageRoot;
messageRoot = (DomainObject)eResolveProxy(oldMessageRoot);
if (messageRoot != oldMessageRoot)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TacticdslPackage.CONSUMER__MESSAGE_ROOT, oldMessageRoot, messageRoot));
}
}
return messageRoot;
}
/**
*
*
* @generated
*/
public DomainObject basicGetMessageRoot()
{
return messageRoot;
}
/**
*
*
* @generated
*/
public void setMessageRoot(DomainObject newMessageRoot)
{
DomainObject oldMessageRoot = messageRoot;
messageRoot = newMessageRoot;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__MESSAGE_ROOT, oldMessageRoot, messageRoot));
}
/**
*
*
* @generated
*/
public String getChannel()
{
return channel;
}
/**
*
*
* @generated
*/
public void setChannel(String newChannel)
{
String oldChannel = channel;
channel = newChannel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__CHANNEL, oldChannel, channel));
}
/**
*
*
* @generated
*/
public Subscribe getSubscribe()
{
return subscribe;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSubscribe(Subscribe newSubscribe, NotificationChain msgs)
{
Subscribe oldSubscribe = subscribe;
subscribe = newSubscribe;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__SUBSCRIBE, oldSubscribe, newSubscribe);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setSubscribe(Subscribe newSubscribe)
{
if (newSubscribe != subscribe)
{
NotificationChain msgs = null;
if (subscribe != null)
msgs = ((InternalEObject)subscribe).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TacticdslPackage.CONSUMER__SUBSCRIBE, null, msgs);
if (newSubscribe != null)
msgs = ((InternalEObject)newSubscribe).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TacticdslPackage.CONSUMER__SUBSCRIBE, null, msgs);
msgs = basicSetSubscribe(newSubscribe, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.CONSUMER__SUBSCRIBE, newSubscribe, newSubscribe));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case TacticdslPackage.CONSUMER__DEPENDENCIES:
return ((InternalEList>)getDependencies()).basicRemove(otherEnd, msgs);
case TacticdslPackage.CONSUMER__SUBSCRIBE:
return basicSetSubscribe(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case TacticdslPackage.CONSUMER__DOC:
return getDoc();
case TacticdslPackage.CONSUMER__NAME:
return getName();
case TacticdslPackage.CONSUMER__HINT:
return getHint();
case TacticdslPackage.CONSUMER__DEPENDENCIES:
return getDependencies();
case TacticdslPackage.CONSUMER__MESSAGE_ROOT:
if (resolve) return getMessageRoot();
return basicGetMessageRoot();
case TacticdslPackage.CONSUMER__CHANNEL:
return getChannel();
case TacticdslPackage.CONSUMER__SUBSCRIBE:
return getSubscribe();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case TacticdslPackage.CONSUMER__DOC:
setDoc((String)newValue);
return;
case TacticdslPackage.CONSUMER__NAME:
setName((String)newValue);
return;
case TacticdslPackage.CONSUMER__HINT:
setHint((String)newValue);
return;
case TacticdslPackage.CONSUMER__DEPENDENCIES:
getDependencies().clear();
getDependencies().addAll((Collection extends Dependency>)newValue);
return;
case TacticdslPackage.CONSUMER__MESSAGE_ROOT:
setMessageRoot((DomainObject)newValue);
return;
case TacticdslPackage.CONSUMER__CHANNEL:
setChannel((String)newValue);
return;
case TacticdslPackage.CONSUMER__SUBSCRIBE:
setSubscribe((Subscribe)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TacticdslPackage.CONSUMER__DOC:
setDoc(DOC_EDEFAULT);
return;
case TacticdslPackage.CONSUMER__NAME:
setName(NAME_EDEFAULT);
return;
case TacticdslPackage.CONSUMER__HINT:
setHint(HINT_EDEFAULT);
return;
case TacticdslPackage.CONSUMER__DEPENDENCIES:
getDependencies().clear();
return;
case TacticdslPackage.CONSUMER__MESSAGE_ROOT:
setMessageRoot((DomainObject)null);
return;
case TacticdslPackage.CONSUMER__CHANNEL:
setChannel(CHANNEL_EDEFAULT);
return;
case TacticdslPackage.CONSUMER__SUBSCRIBE:
setSubscribe((Subscribe)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TacticdslPackage.CONSUMER__DOC:
return DOC_EDEFAULT == null ? doc != null : !DOC_EDEFAULT.equals(doc);
case TacticdslPackage.CONSUMER__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case TacticdslPackage.CONSUMER__HINT:
return HINT_EDEFAULT == null ? hint != null : !HINT_EDEFAULT.equals(hint);
case TacticdslPackage.CONSUMER__DEPENDENCIES:
return dependencies != null && !dependencies.isEmpty();
case TacticdslPackage.CONSUMER__MESSAGE_ROOT:
return messageRoot != null;
case TacticdslPackage.CONSUMER__CHANNEL:
return CHANNEL_EDEFAULT == null ? channel != null : !CHANNEL_EDEFAULT.equals(channel);
case TacticdslPackage.CONSUMER__SUBSCRIBE:
return subscribe != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (doc: ");
result.append(doc);
result.append(", name: ");
result.append(name);
result.append(", hint: ");
result.append(hint);
result.append(", channel: ");
result.append(channel);
result.append(')');
return result.toString();
}
} //ConsumerImpl