/** */ package vmlogo.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 vmlogo.Point; import vmlogo.Segment; import vmlogo.VmlogoPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Segment</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link vmlogo.impl.SegmentImpl#getBegin <em>Begin</em>}</li> * <li>{@link vmlogo.impl.SegmentImpl#getEnd <em>End</em>}</li> * </ul> * * @generated */ public class SegmentImpl extends MinimalEObjectImpl.Container implements Segment { /** * The cached value of the '{@link #getBegin() <em>Begin</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBegin() * @generated * @ordered */ protected Point begin; /** * The cached value of the '{@link #getEnd() <em>End</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEnd() * @generated * @ordered */ protected Point end; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SegmentImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return VmlogoPackage.Literals.SEGMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Point getBegin() { return begin; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBegin(Point newBegin, NotificationChain msgs) { Point oldBegin = begin; begin = newBegin; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VmlogoPackage.SEGMENT__BEGIN, oldBegin, newBegin); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBegin(Point newBegin) { if (newBegin != begin) { NotificationChain msgs = null; if (begin != null) msgs = ((InternalEObject)begin).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VmlogoPackage.SEGMENT__BEGIN, null, msgs); if (newBegin != null) msgs = ((InternalEObject)newBegin).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VmlogoPackage.SEGMENT__BEGIN, null, msgs); msgs = basicSetBegin(newBegin, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, VmlogoPackage.SEGMENT__BEGIN, newBegin, newBegin)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Point getEnd() { return end; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetEnd(Point newEnd, NotificationChain msgs) { Point oldEnd = end; end = newEnd; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VmlogoPackage.SEGMENT__END, oldEnd, newEnd); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEnd(Point newEnd) { if (newEnd != end) { NotificationChain msgs = null; if (end != null) msgs = ((InternalEObject)end).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VmlogoPackage.SEGMENT__END, null, msgs); if (newEnd != null) msgs = ((InternalEObject)newEnd).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VmlogoPackage.SEGMENT__END, null, msgs); msgs = basicSetEnd(newEnd, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, VmlogoPackage.SEGMENT__END, newEnd, newEnd)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case VmlogoPackage.SEGMENT__BEGIN: return basicSetBegin(null, msgs); case VmlogoPackage.SEGMENT__END: return basicSetEnd(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 VmlogoPackage.SEGMENT__BEGIN: return getBegin(); case VmlogoPackage.SEGMENT__END: return getEnd(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case VmlogoPackage.SEGMENT__BEGIN: setBegin((Point)newValue); return; case VmlogoPackage.SEGMENT__END: setEnd((Point)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case VmlogoPackage.SEGMENT__BEGIN: setBegin((Point)null); return; case VmlogoPackage.SEGMENT__END: setEnd((Point)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case VmlogoPackage.SEGMENT__BEGIN: return begin != null; case VmlogoPackage.SEGMENT__END: return end != null; } return super.eIsSet(featureID); } } //SegmentImpl