/**
*/
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.Field;
import org.eclipse.viatra.solver.language.solverLanguage.Multiplicity;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
import org.eclipse.viatra.solver.language.solverLanguage.Symbol;
/**
*
* An implementation of the model object 'Field'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#isContainment Containment}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#isCrossReference Cross Reference}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#getOpposite Opposite}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#getMultiplicity Multiplicity}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#getType Type}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.FieldImpl#getName Name}
*
*
* @generated
*/
public class FieldImpl extends MinimalEObjectImpl.Container implements Field {
/**
* 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 default value of the '{@link #isCrossReference() Cross Reference}' attribute.
*
*
* @see #isCrossReference()
* @generated
* @ordered
*/
protected static final boolean CROSS_REFERENCE_EDEFAULT = false;
/**
* The cached value of the '{@link #isCrossReference() Cross Reference}' attribute.
*
*
* @see #isCrossReference()
* @generated
* @ordered
*/
protected boolean crossReference = CROSS_REFERENCE_EDEFAULT;
/**
* The cached value of the '{@link #getOpposite() Opposite}' reference.
*
*
* @see #getOpposite()
* @generated
* @ordered
*/
protected Symbol opposite;
/**
* The cached value of the '{@link #getMultiplicity() Multiplicity}' containment reference.
*
*
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected Multiplicity multiplicity;
/**
* The cached value of the '{@link #getType() Type}' reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected Symbol type;
/**
* 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;
/**
*
*
* @generated
*/
protected FieldImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.FIELD;
}
/**
*
*
* @generated
*/
public boolean isContainment() {
return containment;
}
/**
*
*
* @generated
*/
public void setContainment(boolean newContainment) {
boolean oldContainment = containment;
containment = newContainment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD__CONTAINMENT,
oldContainment, containment));
}
/**
*
*
* @generated
*/
public boolean isCrossReference() {
return crossReference;
}
/**
*
*
* @generated
*/
public void setCrossReference(boolean newCrossReference) {
boolean oldCrossReference = crossReference;
crossReference = newCrossReference;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD__CROSS_REFERENCE,
oldCrossReference, crossReference));
}
/**
*
*
* @generated
*/
public Symbol getOpposite() {
if (opposite != null && opposite.eIsProxy()) {
InternalEObject oldOpposite = (InternalEObject) opposite;
opposite = (Symbol) eResolveProxy(oldOpposite);
if (opposite != oldOpposite) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SolverLanguagePackage.FIELD__OPPOSITE,
oldOpposite, opposite));
}
}
return opposite;
}
/**
*
*
* @generated
*/
public Symbol basicGetOpposite() {
return opposite;
}
/**
*
*
* @generated
*/
public void setOpposite(Symbol newOpposite) {
Symbol oldOpposite = opposite;
opposite = newOpposite;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD__OPPOSITE, oldOpposite,
opposite));
}
/**
*
*
* @generated
*/
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.FIELD__MULTIPLICITY, oldMultiplicity, newMultiplicity);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setMultiplicity(Multiplicity newMultiplicity) {
if (newMultiplicity != multiplicity) {
NotificationChain msgs = null;
if (multiplicity != null)
msgs = ((InternalEObject) multiplicity).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD__MULTIPLICITY, null, msgs);
if (newMultiplicity != null)
msgs = ((InternalEObject) newMultiplicity).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.FIELD__MULTIPLICITY, null, msgs);
msgs = basicSetMultiplicity(newMultiplicity, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD__MULTIPLICITY,
newMultiplicity, newMultiplicity));
}
/**
*
*
* @generated
*/
public Symbol getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject) type;
type = (Symbol) eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SolverLanguagePackage.FIELD__TYPE,
oldType, type));
}
}
return type;
}
/**
*
*
* @generated
*/
public Symbol basicGetType() {
return type;
}
/**
*
*
* @generated
*/
public void setType(Symbol newType) {
Symbol oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.FIELD__TYPE, oldType, type));
}
/**
*
*
* @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, SolverLanguagePackage.FIELD__NAME, oldName, name));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.FIELD__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.FIELD__CONTAINMENT:
return isContainment();
case SolverLanguagePackage.FIELD__CROSS_REFERENCE:
return isCrossReference();
case SolverLanguagePackage.FIELD__OPPOSITE:
if (resolve)
return getOpposite();
return basicGetOpposite();
case SolverLanguagePackage.FIELD__MULTIPLICITY:
return getMultiplicity();
case SolverLanguagePackage.FIELD__TYPE:
if (resolve)
return getType();
return basicGetType();
case SolverLanguagePackage.FIELD__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.FIELD__CONTAINMENT:
setContainment((Boolean) newValue);
return;
case SolverLanguagePackage.FIELD__CROSS_REFERENCE:
setCrossReference((Boolean) newValue);
return;
case SolverLanguagePackage.FIELD__OPPOSITE:
setOpposite((Symbol) newValue);
return;
case SolverLanguagePackage.FIELD__MULTIPLICITY:
setMultiplicity((Multiplicity) newValue);
return;
case SolverLanguagePackage.FIELD__TYPE:
setType((Symbol) newValue);
return;
case SolverLanguagePackage.FIELD__NAME:
setName((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.FIELD__CONTAINMENT:
setContainment(CONTAINMENT_EDEFAULT);
return;
case SolverLanguagePackage.FIELD__CROSS_REFERENCE:
setCrossReference(CROSS_REFERENCE_EDEFAULT);
return;
case SolverLanguagePackage.FIELD__OPPOSITE:
setOpposite((Symbol) null);
return;
case SolverLanguagePackage.FIELD__MULTIPLICITY:
setMultiplicity((Multiplicity) null);
return;
case SolverLanguagePackage.FIELD__TYPE:
setType((Symbol) null);
return;
case SolverLanguagePackage.FIELD__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.FIELD__CONTAINMENT:
return containment != CONTAINMENT_EDEFAULT;
case SolverLanguagePackage.FIELD__CROSS_REFERENCE:
return crossReference != CROSS_REFERENCE_EDEFAULT;
case SolverLanguagePackage.FIELD__OPPOSITE:
return opposite != null;
case SolverLanguagePackage.FIELD__MULTIPLICITY:
return multiplicity != null;
case SolverLanguagePackage.FIELD__TYPE:
return type != null;
case SolverLanguagePackage.FIELD__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
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(", crossReference: ");
result.append(crossReference);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //FieldImpl