| /** |
| * Copyright (c) 2016 CEA LIST and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * CEA LIST - Initial API and implementation |
| * |
| */ |
| package org.eclipse.papyrus.interoperability.rpy.rpymetamodel.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.papyrus.interoperability.rpy.rpymetamodel.IAnchor; |
| import org.eclipse.papyrus.interoperability.rpy.rpymetamodel.IClassifier; |
| import org.eclipse.papyrus.interoperability.rpy.rpymetamodel.IConstraint; |
| import org.eclipse.papyrus.interoperability.rpy.rpymetamodel.IPropertyContainer; |
| import org.eclipse.papyrus.interoperability.rpy.rpymetamodel.UMLRpyPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>IConstraint</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getMyState <em>My State</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getModifiedTimeWeak <em>Modified Time Weak</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getStereotypes <em>Stereotypes</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getProperties <em>Properties</em>}</li> |
| * <li>{@link org.eclipse.papyrus.interoperability.rpy.rpymetamodel.impl.IConstraintImpl#getAnchors <em>Anchors</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class IConstraintImpl extends IAnnotationImpl implements IConstraint { |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ID_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected String id = ID_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getMyState() <em>My State</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMyState() |
| * @generated |
| * @ordered |
| */ |
| protected static final String MY_STATE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getMyState() <em>My State</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMyState() |
| * @generated |
| * @ordered |
| */ |
| protected String myState = MY_STATE_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 default value of the '{@link #getModifiedTimeWeak() <em>Modified Time Weak</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getModifiedTimeWeak() |
| * @generated |
| * @ordered |
| */ |
| protected static final String MODIFIED_TIME_WEAK_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getModifiedTimeWeak() <em>Modified Time Weak</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getModifiedTimeWeak() |
| * @generated |
| * @ordered |
| */ |
| protected String modifiedTimeWeak = MODIFIED_TIME_WEAK_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getStereotypes() <em>Stereotypes</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStereotypes() |
| * @generated |
| * @ordered |
| */ |
| protected IClassifier stereotypes; |
| |
| /** |
| * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProperties() |
| * @generated |
| * @ordered |
| */ |
| protected IPropertyContainer properties; |
| |
| /** |
| * The cached value of the '{@link #getAnchors() <em>Anchors</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAnchors() |
| * @generated |
| * @ordered |
| */ |
| protected IAnchor anchors; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected IConstraintImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLRpyPackage.eINSTANCE.getIConstraint(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(String newId) { |
| String oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getMyState() { |
| return myState; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMyState(String newMyState) { |
| String oldMyState = myState; |
| myState = newMyState; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__MY_STATE, oldMyState, myState)); |
| } |
| |
| /** |
| * <!-- 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, UMLRpyPackage.ICONSTRAINT__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getModifiedTimeWeak() { |
| return modifiedTimeWeak; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setModifiedTimeWeak(String newModifiedTimeWeak) { |
| String oldModifiedTimeWeak = modifiedTimeWeak; |
| modifiedTimeWeak = newModifiedTimeWeak; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__MODIFIED_TIME_WEAK, oldModifiedTimeWeak, modifiedTimeWeak)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IClassifier getStereotypes() { |
| if (stereotypes != null && stereotypes.eIsProxy()) { |
| InternalEObject oldStereotypes = (InternalEObject)stereotypes; |
| stereotypes = (IClassifier)eResolveProxy(oldStereotypes); |
| if (stereotypes != oldStereotypes) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLRpyPackage.ICONSTRAINT__STEREOTYPES, oldStereotypes, stereotypes)); |
| } |
| } |
| return stereotypes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IClassifier basicGetStereotypes() { |
| return stereotypes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setStereotypes(IClassifier newStereotypes) { |
| IClassifier oldStereotypes = stereotypes; |
| stereotypes = newStereotypes; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__STEREOTYPES, oldStereotypes, stereotypes)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IPropertyContainer getProperties() { |
| if (properties != null && properties.eIsProxy()) { |
| InternalEObject oldProperties = (InternalEObject)properties; |
| properties = (IPropertyContainer)eResolveProxy(oldProperties); |
| if (properties != oldProperties) { |
| InternalEObject newProperties = (InternalEObject)properties; |
| NotificationChain msgs = oldProperties.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__PROPERTIES, null, null); |
| if (newProperties.eInternalContainer() == null) { |
| msgs = newProperties.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__PROPERTIES, null, msgs); |
| } |
| if (msgs != null) msgs.dispatch(); |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLRpyPackage.ICONSTRAINT__PROPERTIES, oldProperties, properties)); |
| } |
| } |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IPropertyContainer basicGetProperties() { |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetProperties(IPropertyContainer newProperties, NotificationChain msgs) { |
| IPropertyContainer oldProperties = properties; |
| properties = newProperties; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__PROPERTIES, oldProperties, newProperties); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setProperties(IPropertyContainer newProperties) { |
| if (newProperties != properties) { |
| NotificationChain msgs = null; |
| if (properties != null) |
| msgs = ((InternalEObject)properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__PROPERTIES, null, msgs); |
| if (newProperties != null) |
| msgs = ((InternalEObject)newProperties).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__PROPERTIES, null, msgs); |
| msgs = basicSetProperties(newProperties, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__PROPERTIES, newProperties, newProperties)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IAnchor getAnchors() { |
| if (anchors != null && anchors.eIsProxy()) { |
| InternalEObject oldAnchors = (InternalEObject)anchors; |
| anchors = (IAnchor)eResolveProxy(oldAnchors); |
| if (anchors != oldAnchors) { |
| InternalEObject newAnchors = (InternalEObject)anchors; |
| NotificationChain msgs = oldAnchors.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__ANCHORS, null, null); |
| if (newAnchors.eInternalContainer() == null) { |
| msgs = newAnchors.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__ANCHORS, null, msgs); |
| } |
| if (msgs != null) msgs.dispatch(); |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLRpyPackage.ICONSTRAINT__ANCHORS, oldAnchors, anchors)); |
| } |
| } |
| return anchors; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IAnchor basicGetAnchors() { |
| return anchors; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAnchors(IAnchor newAnchors, NotificationChain msgs) { |
| IAnchor oldAnchors = anchors; |
| anchors = newAnchors; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__ANCHORS, oldAnchors, newAnchors); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAnchors(IAnchor newAnchors) { |
| if (newAnchors != anchors) { |
| NotificationChain msgs = null; |
| if (anchors != null) |
| msgs = ((InternalEObject)anchors).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__ANCHORS, null, msgs); |
| if (newAnchors != null) |
| msgs = ((InternalEObject)newAnchors).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UMLRpyPackage.ICONSTRAINT__ANCHORS, null, msgs); |
| msgs = basicSetAnchors(newAnchors, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLRpyPackage.ICONSTRAINT__ANCHORS, newAnchors, newAnchors)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case UMLRpyPackage.ICONSTRAINT__PROPERTIES: |
| return basicSetProperties(null, msgs); |
| case UMLRpyPackage.ICONSTRAINT__ANCHORS: |
| return basicSetAnchors(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 UMLRpyPackage.ICONSTRAINT__ID: |
| return getId(); |
| case UMLRpyPackage.ICONSTRAINT__MY_STATE: |
| return getMyState(); |
| case UMLRpyPackage.ICONSTRAINT__NAME: |
| return getName(); |
| case UMLRpyPackage.ICONSTRAINT__MODIFIED_TIME_WEAK: |
| return getModifiedTimeWeak(); |
| case UMLRpyPackage.ICONSTRAINT__STEREOTYPES: |
| if (resolve) return getStereotypes(); |
| return basicGetStereotypes(); |
| case UMLRpyPackage.ICONSTRAINT__PROPERTIES: |
| if (resolve) return getProperties(); |
| return basicGetProperties(); |
| case UMLRpyPackage.ICONSTRAINT__ANCHORS: |
| if (resolve) return getAnchors(); |
| return basicGetAnchors(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case UMLRpyPackage.ICONSTRAINT__ID: |
| setId((String)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__MY_STATE: |
| setMyState((String)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__NAME: |
| setName((String)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__MODIFIED_TIME_WEAK: |
| setModifiedTimeWeak((String)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__STEREOTYPES: |
| setStereotypes((IClassifier)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__PROPERTIES: |
| setProperties((IPropertyContainer)newValue); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__ANCHORS: |
| setAnchors((IAnchor)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UMLRpyPackage.ICONSTRAINT__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__MY_STATE: |
| setMyState(MY_STATE_EDEFAULT); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__MODIFIED_TIME_WEAK: |
| setModifiedTimeWeak(MODIFIED_TIME_WEAK_EDEFAULT); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__STEREOTYPES: |
| setStereotypes((IClassifier)null); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__PROPERTIES: |
| setProperties((IPropertyContainer)null); |
| return; |
| case UMLRpyPackage.ICONSTRAINT__ANCHORS: |
| setAnchors((IAnchor)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UMLRpyPackage.ICONSTRAINT__ID: |
| return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
| case UMLRpyPackage.ICONSTRAINT__MY_STATE: |
| return MY_STATE_EDEFAULT == null ? myState != null : !MY_STATE_EDEFAULT.equals(myState); |
| case UMLRpyPackage.ICONSTRAINT__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case UMLRpyPackage.ICONSTRAINT__MODIFIED_TIME_WEAK: |
| return MODIFIED_TIME_WEAK_EDEFAULT == null ? modifiedTimeWeak != null : !MODIFIED_TIME_WEAK_EDEFAULT.equals(modifiedTimeWeak); |
| case UMLRpyPackage.ICONSTRAINT__STEREOTYPES: |
| return stereotypes != null; |
| case UMLRpyPackage.ICONSTRAINT__PROPERTIES: |
| return properties != null; |
| case UMLRpyPackage.ICONSTRAINT__ANCHORS: |
| return anchors != 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(" (id: "); //$NON-NLS-1$ |
| result.append(id); |
| result.append(", myState: "); //$NON-NLS-1$ |
| result.append(myState); |
| result.append(", name: "); //$NON-NLS-1$ |
| result.append(name); |
| result.append(", modifiedTimeWeak: "); //$NON-NLS-1$ |
| result.append(modifiedTimeWeak); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //IConstraintImpl |