/**
* generated by Xtext 2.21.0
*/
package org.eclipse.viatra.solver.language.solverLanguage.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.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.viatra.solver.language.solverLanguage.MemberDefinition;
import org.eclipse.viatra.solver.language.solverLanguage.Multiplicity;
import org.eclipse.viatra.solver.language.solverLanguage.NamedElement;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Member Definition'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.MemberDefinitionImpl#isContainment Containment}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.MemberDefinitionImpl#getType Type}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.MemberDefinitionImpl#getMultiplicity Multiplicity}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.MemberDefinitionImpl#getName Name}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.MemberDefinitionImpl#getOpposite Opposite}
*
*
* @generated
*/
public class MemberDefinitionImpl extends MinimalEObjectImpl.Container implements MemberDefinition {
/**
* The default value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected static final boolean CONTAINMENT_EDEFAULT = false;
/**
* The cached value of the '{@link #isContainment() Containment}' attribute.
*
*
* @see #isContainment()
* @generated
* @ordered
*/
protected boolean containment = CONTAINMENT_EDEFAULT;
/**
* The cached value of the '{@link #getType() Type}' reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected NamedElement type;
/**
* The cached value of the '{@link #getMultiplicity() Multiplicity}' containment reference.
*
*
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected Multiplicity multiplicity;
/**
* 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 cached value of the '{@link #getOpposite() Opposite}' reference.
*
*
* @see #getOpposite()
* @generated
* @ordered
*/
protected NamedElement opposite;
/**
*
*
* @generated
*/
protected MemberDefinitionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.MEMBER_DEFINITION;
}
/**
*
*
* @generated
*/
@Override
public boolean isContainment() {
return containment;
}
/**
*
*
* @generated
*/
@Override
public void setContainment(boolean newContainment) {
boolean oldContainment = containment;
containment = newContainment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__CONTAINMENT, oldContainment, containment));
}
/**
*
*
* @generated
*/
@Override
public NamedElement getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject)type;
type = (NamedElement)eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SolverLanguagePackage.MEMBER_DEFINITION__TYPE, oldType, type));
}
}
return type;
}
/**
*
*
* @generated
*/
public NamedElement basicGetType() {
return type;
}
/**
*
*
* @generated
*/
@Override
public void setType(NamedElement newType) {
NamedElement oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
@Override
public Multiplicity getMultiplicity() {
return multiplicity;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetMultiplicity(Multiplicity newMultiplicity, NotificationChain msgs) {
Multiplicity oldMultiplicity = multiplicity;
multiplicity = newMultiplicity;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY, oldMultiplicity, newMultiplicity);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setMultiplicity(Multiplicity newMultiplicity) {
if (newMultiplicity != multiplicity) {
NotificationChain msgs = null;
if (multiplicity != null)
msgs = ((InternalEObject)multiplicity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY, null, msgs);
if (newMultiplicity != null)
msgs = ((InternalEObject)newMultiplicity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY, null, msgs);
msgs = basicSetMultiplicity(newMultiplicity, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY, newMultiplicity, newMultiplicity));
}
/**
*
*
* @generated
*/
@Override
public String getName() {
return name;
}
/**
*
*
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__NAME, oldName, name));
}
/**
*
*
* @generated
*/
@Override
public NamedElement getOpposite() {
if (opposite != null && opposite.eIsProxy()) {
InternalEObject oldOpposite = (InternalEObject)opposite;
opposite = (NamedElement)eResolveProxy(oldOpposite);
if (opposite != oldOpposite) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE, oldOpposite, opposite));
}
}
return opposite;
}
/**
*
*
* @generated
*/
public NamedElement basicGetOpposite() {
return opposite;
}
/**
*
*
* @generated
*/
@Override
public void setOpposite(NamedElement newOpposite) {
NamedElement oldOpposite = opposite;
opposite = newOpposite;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE, oldOpposite, opposite));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY:
return basicSetMultiplicity(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SolverLanguagePackage.MEMBER_DEFINITION__CONTAINMENT:
return isContainment();
case SolverLanguagePackage.MEMBER_DEFINITION__TYPE:
if (resolve) return getType();
return basicGetType();
case SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY:
return getMultiplicity();
case SolverLanguagePackage.MEMBER_DEFINITION__NAME:
return getName();
case SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE:
if (resolve) return getOpposite();
return basicGetOpposite();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.MEMBER_DEFINITION__CONTAINMENT:
setContainment((Boolean)newValue);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__TYPE:
setType((NamedElement)newValue);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY:
setMultiplicity((Multiplicity)newValue);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__NAME:
setName((String)newValue);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE:
setOpposite((NamedElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.MEMBER_DEFINITION__CONTAINMENT:
setContainment(CONTAINMENT_EDEFAULT);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__TYPE:
setType((NamedElement)null);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY:
setMultiplicity((Multiplicity)null);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__NAME:
setName(NAME_EDEFAULT);
return;
case SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE:
setOpposite((NamedElement)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.MEMBER_DEFINITION__CONTAINMENT:
return containment != CONTAINMENT_EDEFAULT;
case SolverLanguagePackage.MEMBER_DEFINITION__TYPE:
return type != null;
case SolverLanguagePackage.MEMBER_DEFINITION__MULTIPLICITY:
return multiplicity != null;
case SolverLanguagePackage.MEMBER_DEFINITION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case SolverLanguagePackage.MEMBER_DEFINITION__OPPOSITE:
return opposite != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (containment: ");
result.append(containment);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //MemberDefinitionImpl