/**
*/
package org.eclipse.viatra.solver.language.model.problem.impl;
import java.util.Collection;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration;
import org.eclipse.viatra.solver.language.model.problem.Node;
import org.eclipse.viatra.solver.language.model.problem.ProblemPackage;
import org.eclipse.viatra.solver.language.model.problem.ReferenceDeclaration;
/**
*
* An implementation of the model object 'Class Declaration'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.ClassDeclarationImpl#isAbstract Abstract}
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.ClassDeclarationImpl#getSuperTypes Super Types}
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.ClassDeclarationImpl#getReferenceDeclarations Reference Declarations}
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.ClassDeclarationImpl#getNewNode New Node}
*
*
* @generated
*/
public class ClassDeclarationImpl extends RelationImpl implements ClassDeclaration {
/**
* The default value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected static final boolean ABSTRACT_EDEFAULT = false;
/**
* The cached value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected boolean abstract_ = ABSTRACT_EDEFAULT;
/**
* The cached value of the '{@link #getSuperTypes() Super Types}' reference list.
*
*
* @see #getSuperTypes()
* @generated
* @ordered
*/
protected EList superTypes;
/**
* The cached value of the '{@link #getReferenceDeclarations() Reference Declarations}' containment reference list.
*
*
* @see #getReferenceDeclarations()
* @generated
* @ordered
*/
protected EList referenceDeclarations;
/**
* The cached value of the '{@link #getNewNode() New Node}' containment reference.
*
*
* @see #getNewNode()
* @generated
* @ordered
*/
protected Node newNode;
/**
*
*
* @generated
*/
protected ClassDeclarationImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProblemPackage.Literals.CLASS_DECLARATION;
}
/**
*
*
* @generated
*/
public boolean isAbstract() {
return abstract_;
}
/**
*
*
* @generated
*/
public void setAbstract(boolean newAbstract) {
boolean oldAbstract = abstract_;
abstract_ = newAbstract;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.CLASS_DECLARATION__ABSTRACT,
oldAbstract, abstract_));
}
/**
*
*
* @generated
*/
public EList getSuperTypes() {
if (superTypes == null) {
superTypes = new EObjectResolvingEList(ClassDeclaration.class, this,
ProblemPackage.CLASS_DECLARATION__SUPER_TYPES);
}
return superTypes;
}
/**
*
*
* @generated
*/
public EList getReferenceDeclarations() {
if (referenceDeclarations == null) {
referenceDeclarations = new EObjectContainmentEList(ReferenceDeclaration.class, this,
ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS);
}
return referenceDeclarations;
}
/**
*
*
* @generated
*/
public Node getNewNode() {
return newNode;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetNewNode(Node newNewNode, NotificationChain msgs) {
Node oldNewNode = newNode;
newNode = newNewNode;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
ProblemPackage.CLASS_DECLARATION__NEW_NODE, oldNewNode, newNewNode);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setNewNode(Node newNewNode) {
if (newNewNode != newNode) {
NotificationChain msgs = null;
if (newNode != null)
msgs = ((InternalEObject) newNode).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - ProblemPackage.CLASS_DECLARATION__NEW_NODE, null, msgs);
if (newNewNode != null)
msgs = ((InternalEObject) newNewNode).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - ProblemPackage.CLASS_DECLARATION__NEW_NODE, null, msgs);
msgs = basicSetNewNode(newNewNode, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.CLASS_DECLARATION__NEW_NODE,
newNewNode, newNewNode));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS:
return ((InternalEList>) getReferenceDeclarations()).basicRemove(otherEnd, msgs);
case ProblemPackage.CLASS_DECLARATION__NEW_NODE:
return basicSetNewNode(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ProblemPackage.CLASS_DECLARATION__ABSTRACT:
return isAbstract();
case ProblemPackage.CLASS_DECLARATION__SUPER_TYPES:
return getSuperTypes();
case ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS:
return getReferenceDeclarations();
case ProblemPackage.CLASS_DECLARATION__NEW_NODE:
return getNewNode();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProblemPackage.CLASS_DECLARATION__ABSTRACT:
setAbstract((Boolean) newValue);
return;
case ProblemPackage.CLASS_DECLARATION__SUPER_TYPES:
getSuperTypes().clear();
getSuperTypes().addAll((Collection extends ClassDeclaration>) newValue);
return;
case ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS:
getReferenceDeclarations().clear();
getReferenceDeclarations().addAll((Collection extends ReferenceDeclaration>) newValue);
return;
case ProblemPackage.CLASS_DECLARATION__NEW_NODE:
setNewNode((Node) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProblemPackage.CLASS_DECLARATION__ABSTRACT:
setAbstract(ABSTRACT_EDEFAULT);
return;
case ProblemPackage.CLASS_DECLARATION__SUPER_TYPES:
getSuperTypes().clear();
return;
case ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS:
getReferenceDeclarations().clear();
return;
case ProblemPackage.CLASS_DECLARATION__NEW_NODE:
setNewNode((Node) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProblemPackage.CLASS_DECLARATION__ABSTRACT:
return abstract_ != ABSTRACT_EDEFAULT;
case ProblemPackage.CLASS_DECLARATION__SUPER_TYPES:
return superTypes != null && !superTypes.isEmpty();
case ProblemPackage.CLASS_DECLARATION__REFERENCE_DECLARATIONS:
return referenceDeclarations != null && !referenceDeclarations.isEmpty();
case ProblemPackage.CLASS_DECLARATION__NEW_NODE:
return newNode != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (abstract: ");
result.append(abstract_);
result.append(')');
return result.toString();
}
} //ClassDeclarationImpl