/** */ package net.certware.argument.language.l.impl; import net.certware.argument.language.l.Head; import net.certware.argument.language.l.LPackage; import net.certware.argument.language.l.Rule; import net.certware.argument.language.l.Sentence; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Rule</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link net.certware.argument.language.l.impl.RuleImpl#getHead <em>Head</em>}</li> * <li>{@link net.certware.argument.language.l.impl.RuleImpl#getCondition <em>Condition</em>}</li> * <li>{@link net.certware.argument.language.l.impl.RuleImpl#getBody <em>Body</em>}</li> * </ul> * * @generated */ public class RuleImpl extends StatementImpl implements Rule { /** * The cached value of the '{@link #getHead() <em>Head</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getHead() * @generated * @ordered */ protected Head head; /** * The default value of the '{@link #getCondition() <em>Condition</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCondition() * @generated * @ordered */ protected static final String CONDITION_EDEFAULT = null; /** * The cached value of the '{@link #getCondition() <em>Condition</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCondition() * @generated * @ordered */ protected String condition = CONDITION_EDEFAULT; /** * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected Sentence body; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RuleImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return LPackage.Literals.RULE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Head getHead() { return head; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetHead(Head newHead, NotificationChain msgs) { Head oldHead = head; head = newHead; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LPackage.RULE__HEAD, oldHead, newHead); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setHead(Head newHead) { if (newHead != head) { NotificationChain msgs = null; if (head != null) msgs = ((InternalEObject)head).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LPackage.RULE__HEAD, null, msgs); if (newHead != null) msgs = ((InternalEObject)newHead).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LPackage.RULE__HEAD, null, msgs); msgs = basicSetHead(newHead, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LPackage.RULE__HEAD, newHead, newHead)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCondition() { return condition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCondition(String newCondition) { String oldCondition = condition; condition = newCondition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LPackage.RULE__CONDITION, oldCondition, condition)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Sentence getBody() { return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBody(Sentence newBody, NotificationChain msgs) { Sentence oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LPackage.RULE__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBody(Sentence newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LPackage.RULE__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LPackage.RULE__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, LPackage.RULE__BODY, newBody, newBody)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case LPackage.RULE__HEAD: return basicSetHead(null, msgs); case LPackage.RULE__BODY: return basicSetBody(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case LPackage.RULE__HEAD: return getHead(); case LPackage.RULE__CONDITION: return getCondition(); case LPackage.RULE__BODY: return getBody(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case LPackage.RULE__HEAD: setHead((Head)newValue); return; case LPackage.RULE__CONDITION: setCondition((String)newValue); return; case LPackage.RULE__BODY: setBody((Sentence)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case LPackage.RULE__HEAD: setHead((Head)null); return; case LPackage.RULE__CONDITION: setCondition(CONDITION_EDEFAULT); return; case LPackage.RULE__BODY: setBody((Sentence)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case LPackage.RULE__HEAD: return head != null; case LPackage.RULE__CONDITION: return CONDITION_EDEFAULT == null ? condition != null : !CONDITION_EDEFAULT.equals(condition); case LPackage.RULE__BODY: return body != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (condition: "); result.append(condition); result.append(')'); return result.toString(); } } //RuleImpl