/** * <copyright> * </copyright> * */ package org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.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.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.CollaborationUseRule; import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.TypeRule; import org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.UmlCollaborationUsePackage; import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.VisibilityKind; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Collaboration Use Rule</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.impl.CollaborationUseRuleImpl#getVisibility <em>Visibility</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.impl.CollaborationUseRuleImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.collaborationuse.xtext.umlCollaborationUse.impl.CollaborationUseRuleImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class CollaborationUseRuleImpl extends MinimalEObjectImpl.Container implements CollaborationUseRule { /** * The default value of the '{@link #getVisibility() <em>Visibility</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVisibility() * @generated * @ordered */ protected static final VisibilityKind VISIBILITY_EDEFAULT = VisibilityKind.PUBLIC; /** * The cached value of the '{@link #getVisibility() <em>Visibility</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVisibility() * @generated * @ordered */ protected VisibilityKind visibility = VISIBILITY_EDEFAULT; /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected TypeRule type; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CollaborationUseRuleImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmlCollaborationUsePackage.Literals.COLLABORATION_USE_RULE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VisibilityKind getVisibility() { return visibility; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVisibility(VisibilityKind newVisibility) { VisibilityKind oldVisibility = visibility; visibility = newVisibility == null ? VISIBILITY_EDEFAULT : newVisibility; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlCollaborationUsePackage.COLLABORATION_USE_RULE__VISIBILITY, oldVisibility, visibility)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlCollaborationUsePackage.COLLABORATION_USE_RULE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypeRule getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetType(TypeRule newType, NotificationChain msgs) { TypeRule oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(TypeRule newType) { if (newType != type) { NotificationChain msgs = null; if (type != null) msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE, newType, newType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE: return basicSetType(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 UmlCollaborationUsePackage.COLLABORATION_USE_RULE__VISIBILITY: return getVisibility(); case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__NAME: return getName(); case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__VISIBILITY: setVisibility((VisibilityKind)newValue); return; case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__NAME: setName((String)newValue); return; case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE: setType((TypeRule)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__VISIBILITY: setVisibility(VISIBILITY_EDEFAULT); return; case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__NAME: setName(NAME_EDEFAULT); return; case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE: setType((TypeRule)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__VISIBILITY: return visibility != VISIBILITY_EDEFAULT; case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case UmlCollaborationUsePackage.COLLABORATION_USE_RULE__TYPE: return type != 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(" (visibility: "); result.append(visibility); result.append(", name: "); result.append(name); result.append(')'); return result.toString(); } } //CollaborationUseRuleImpl