| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTRelation.impl; |
| 8 | |
| 9 | import QVTBase.impl.PatternImpl; |
| 10 | |
| 11 | import QVTRelation.DomainPattern; |
| 12 | import QVTRelation.QVTRelationPackage; |
| 13 | |
| 14 | import QVTTemplate.TemplateExp; |
| 15 | |
| 16 | import org.eclipse.emf.common.notify.Notification; |
| 17 | import org.eclipse.emf.common.notify.NotificationChain; |
| 18 | |
| 19 | import org.eclipse.emf.ecore.EClass; |
| 20 | import org.eclipse.emf.ecore.InternalEObject; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 23 | |
| 24 | /** |
| 25 | * <!-- begin-user-doc --> |
| 26 | * An implementation of the model object '<em><b>Domain Pattern</b></em>'. |
| 27 | * <!-- end-user-doc --> |
| 28 | * <p> |
| 29 | * The following features are implemented: |
| 30 | * <ul> |
| 31 | * <li>{@link QVTRelation.impl.DomainPatternImpl#getTemplateExpression <em>Template Expression</em>}</li> |
| 32 | * </ul> |
| 33 | * </p> |
| 34 | * |
| 35 | * @generated |
| 36 | */ |
| 37 | public class DomainPatternImpl extends PatternImpl implements DomainPattern { |
| 38 | /** |
| 39 | * The cached value of the '{@link #getTemplateExpression() <em>Template Expression</em>}' containment reference. |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @see #getTemplateExpression() |
| 43 | * @generated |
| 44 | * @ordered |
| 45 | */ |
| 46 | protected TemplateExp templateExpression; |
| 47 | |
| 48 | /** |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | protected DomainPatternImpl() { |
| 54 | super(); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | @Override |
| 63 | protected EClass eStaticClass() { |
| 64 | return QVTRelationPackage.Literals.DOMAIN_PATTERN; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * <!-- begin-user-doc --> |
| 69 | * <!-- end-user-doc --> |
| 70 | * @generated |
| 71 | */ |
| 72 | public TemplateExp getTemplateExpression() { |
| 73 | return templateExpression; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @generated |
| 80 | */ |
| 81 | public NotificationChain basicSetTemplateExpression(TemplateExp newTemplateExpression, NotificationChain msgs) { |
| 82 | TemplateExp oldTemplateExpression = templateExpression; |
| 83 | templateExpression = newTemplateExpression; |
| 84 | if (eNotificationRequired()) { |
| 85 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, oldTemplateExpression, newTemplateExpression); |
| 86 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 87 | } |
| 88 | return msgs; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @generated |
| 95 | */ |
| 96 | public void setTemplateExpression(TemplateExp newTemplateExpression) { |
| 97 | if (newTemplateExpression != templateExpression) { |
| 98 | NotificationChain msgs = null; |
| 99 | if (templateExpression != null) |
| 100 | msgs = ((InternalEObject)templateExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, null, msgs); |
| 101 | if (newTemplateExpression != null) |
| 102 | msgs = ((InternalEObject)newTemplateExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, null, msgs); |
| 103 | msgs = basicSetTemplateExpression(newTemplateExpression, msgs); |
| 104 | if (msgs != null) msgs.dispatch(); |
| 105 | } |
| 106 | else if (eNotificationRequired()) |
| 107 | eNotify(new ENotificationImpl(this, Notification.SET, QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION, newTemplateExpression, newTemplateExpression)); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | @Override |
| 116 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 117 | switch (featureID) { |
| 118 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 119 | return basicSetTemplateExpression(null, msgs); |
| 120 | } |
| 121 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @generated |
| 128 | */ |
| 129 | @Override |
| 130 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 131 | switch (featureID) { |
| 132 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 133 | return getTemplateExpression(); |
| 134 | } |
| 135 | return super.eGet(featureID, resolve, coreType); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * <!-- begin-user-doc --> |
| 140 | * <!-- end-user-doc --> |
| 141 | * @generated |
| 142 | */ |
| 143 | @Override |
| 144 | public void eSet(int featureID, Object newValue) { |
| 145 | switch (featureID) { |
| 146 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 147 | setTemplateExpression((TemplateExp)newValue); |
| 148 | return; |
| 149 | } |
| 150 | super.eSet(featureID, newValue); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | @Override |
| 159 | public void eUnset(int featureID) { |
| 160 | switch (featureID) { |
| 161 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 162 | setTemplateExpression((TemplateExp)null); |
| 163 | return; |
| 164 | } |
| 165 | super.eUnset(featureID); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * <!-- begin-user-doc --> |
| 170 | * <!-- end-user-doc --> |
| 171 | * @generated |
| 172 | */ |
| 173 | @Override |
| 174 | public boolean eIsSet(int featureID) { |
| 175 | switch (featureID) { |
| 176 | case QVTRelationPackage.DOMAIN_PATTERN__TEMPLATE_EXPRESSION: |
| 177 | return templateExpression != null; |
| 178 | } |
| 179 | return super.eIsSet(featureID); |
| 180 | } |
| 181 | |
| 182 | } //DomainPatternImpl |