/** */ 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.InternalEList; import org.eclipse.viatra.solver.language.model.problem.Argument; import org.eclipse.viatra.solver.language.model.problem.Atom; import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; import org.eclipse.viatra.solver.language.model.problem.Relation; /** * * An implementation of the model object 'Atom'. * *

* The following features are implemented: *

* * * @generated */ public class AtomImpl extends LiteralImpl implements Atom { /** * The cached value of the '{@link #getRelation() Relation}' reference. * * * @see #getRelation() * @generated * @ordered */ protected Relation relation; /** * The default value of the '{@link #isTransitiveClosure() Transitive Closure}' attribute. * * * @see #isTransitiveClosure() * @generated * @ordered */ protected static final boolean TRANSITIVE_CLOSURE_EDEFAULT = false; /** * The cached value of the '{@link #isTransitiveClosure() Transitive Closure}' attribute. * * * @see #isTransitiveClosure() * @generated * @ordered */ protected boolean transitiveClosure = TRANSITIVE_CLOSURE_EDEFAULT; /** * The cached value of the '{@link #getArguments() Arguments}' containment reference list. * * * @see #getArguments() * @generated * @ordered */ protected EList arguments; /** * * * @generated */ protected AtomImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return ProblemPackage.Literals.ATOM; } /** * * * @generated */ public Relation getRelation() { if (relation != null && relation.eIsProxy()) { InternalEObject oldRelation = (InternalEObject) relation; relation = (Relation) eResolveProxy(oldRelation); if (relation != oldRelation) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProblemPackage.ATOM__RELATION, oldRelation, relation)); } } return relation; } /** * * * @generated */ public Relation basicGetRelation() { return relation; } /** * * * @generated */ public void setRelation(Relation newRelation) { Relation oldRelation = relation; relation = newRelation; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.ATOM__RELATION, oldRelation, relation)); } /** * * * @generated */ public EList getArguments() { if (arguments == null) { arguments = new EObjectContainmentEList(Argument.class, this, ProblemPackage.ATOM__ARGUMENTS); } return arguments; } /** * * * @generated */ public boolean isTransitiveClosure() { return transitiveClosure; } /** * * * @generated */ public void setTransitiveClosure(boolean newTransitiveClosure) { boolean oldTransitiveClosure = transitiveClosure; transitiveClosure = newTransitiveClosure; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.ATOM__TRANSITIVE_CLOSURE, oldTransitiveClosure, transitiveClosure)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ProblemPackage.ATOM__ARGUMENTS: return ((InternalEList) getArguments()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ProblemPackage.ATOM__RELATION: if (resolve) return getRelation(); return basicGetRelation(); case ProblemPackage.ATOM__TRANSITIVE_CLOSURE: return isTransitiveClosure(); case ProblemPackage.ATOM__ARGUMENTS: return getArguments(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ProblemPackage.ATOM__RELATION: setRelation((Relation) newValue); return; case ProblemPackage.ATOM__TRANSITIVE_CLOSURE: setTransitiveClosure((Boolean) newValue); return; case ProblemPackage.ATOM__ARGUMENTS: getArguments().clear(); getArguments().addAll((Collection) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ProblemPackage.ATOM__RELATION: setRelation((Relation) null); return; case ProblemPackage.ATOM__TRANSITIVE_CLOSURE: setTransitiveClosure(TRANSITIVE_CLOSURE_EDEFAULT); return; case ProblemPackage.ATOM__ARGUMENTS: getArguments().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ProblemPackage.ATOM__RELATION: return relation != null; case ProblemPackage.ATOM__TRANSITIVE_CLOSURE: return transitiveClosure != TRANSITIVE_CLOSURE_EDEFAULT; case ProblemPackage.ATOM__ARGUMENTS: return arguments != null && !arguments.isEmpty(); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (transitiveClosure: "); result.append(transitiveClosure); result.append(')'); return result.toString(); } } //AtomImpl