| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package QVTBase.impl; |
| 8 | |
| 9 | import EMOF.impl.NamedElementImpl; |
| 10 | |
| 11 | import QVTBase.Domain; |
| 12 | import QVTBase.QVTBasePackage; |
| 13 | import QVTBase.Rule; |
| 14 | import QVTBase.TypedModel; |
| 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 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 25 | |
| 26 | /** |
| 27 | * <!-- begin-user-doc --> |
| 28 | * An implementation of the model object '<em><b>Domain</b></em>'. |
| 29 | * <!-- end-user-doc --> |
| 30 | * <p> |
| 31 | * The following features are implemented: |
| 32 | * <ul> |
| 33 | * <li>{@link QVTBase.impl.DomainImpl#getIsCheckable <em>Is Checkable</em>}</li> |
| 34 | * <li>{@link QVTBase.impl.DomainImpl#getIsEnforceable <em>Is Enforceable</em>}</li> |
| 35 | * <li>{@link QVTBase.impl.DomainImpl#getRule <em>Rule</em>}</li> |
| 36 | * <li>{@link QVTBase.impl.DomainImpl#getTypedModel <em>Typed Model</em>}</li> |
| 37 | * </ul> |
| 38 | * </p> |
| 39 | * |
| 40 | * @generated |
| 41 | */ |
| 42 | public abstract class DomainImpl extends NamedElementImpl implements Domain { |
| 43 | /** |
| 44 | * The default value of the '{@link #getIsCheckable() <em>Is Checkable</em>}' attribute. |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @see #getIsCheckable() |
| 48 | * @generated |
| 49 | * @ordered |
| 50 | */ |
| 51 | protected static final Boolean IS_CHECKABLE_EDEFAULT = null; |
| 52 | |
| 53 | /** |
| 54 | * The cached value of the '{@link #getIsCheckable() <em>Is Checkable</em>}' attribute. |
| 55 | * <!-- begin-user-doc --> |
| 56 | * <!-- end-user-doc --> |
| 57 | * @see #getIsCheckable() |
| 58 | * @generated |
| 59 | * @ordered |
| 60 | */ |
| 61 | protected Boolean isCheckable = IS_CHECKABLE_EDEFAULT; |
| 62 | |
| 63 | /** |
| 64 | * The default value of the '{@link #getIsEnforceable() <em>Is Enforceable</em>}' attribute. |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @see #getIsEnforceable() |
| 68 | * @generated |
| 69 | * @ordered |
| 70 | */ |
| 71 | protected static final Boolean IS_ENFORCEABLE_EDEFAULT = null; |
| 72 | |
| 73 | /** |
| 74 | * The cached value of the '{@link #getIsEnforceable() <em>Is Enforceable</em>}' attribute. |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @see #getIsEnforceable() |
| 78 | * @generated |
| 79 | * @ordered |
| 80 | */ |
| 81 | protected Boolean isEnforceable = IS_ENFORCEABLE_EDEFAULT; |
| 82 | |
| 83 | /** |
| 84 | * The cached value of the '{@link #getTypedModel() <em>Typed Model</em>}' reference. |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @see #getTypedModel() |
| 88 | * @generated |
| 89 | * @ordered |
| 90 | */ |
| 91 | protected TypedModel typedModel; |
| 92 | |
| 93 | /** |
| 94 | * <!-- begin-user-doc --> |
| 95 | * <!-- end-user-doc --> |
| 96 | * @generated |
| 97 | */ |
| 98 | protected DomainImpl() { |
| 99 | super(); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * <!-- begin-user-doc --> |
| 104 | * <!-- end-user-doc --> |
| 105 | * @generated |
| 106 | */ |
| 107 | @Override |
| 108 | protected EClass eStaticClass() { |
| 109 | return QVTBasePackage.Literals.DOMAIN; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * <!-- begin-user-doc --> |
| 114 | * <!-- end-user-doc --> |
| 115 | * @generated |
| 116 | */ |
| 117 | public Boolean getIsCheckable() { |
| 118 | return isCheckable; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * <!-- begin-user-doc --> |
| 123 | * <!-- end-user-doc --> |
| 124 | * @generated |
| 125 | */ |
| 126 | public void setIsCheckable(Boolean newIsCheckable) { |
| 127 | Boolean oldIsCheckable = isCheckable; |
| 128 | isCheckable = newIsCheckable; |
| 129 | if (eNotificationRequired()) |
| 130 | eNotify(new ENotificationImpl(this, Notification.SET, QVTBasePackage.DOMAIN__IS_CHECKABLE, oldIsCheckable, isCheckable)); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | public Boolean getIsEnforceable() { |
| 139 | return isEnforceable; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * <!-- begin-user-doc --> |
| 144 | * <!-- end-user-doc --> |
| 145 | * @generated |
| 146 | */ |
| 147 | public void setIsEnforceable(Boolean newIsEnforceable) { |
| 148 | Boolean oldIsEnforceable = isEnforceable; |
| 149 | isEnforceable = newIsEnforceable; |
| 150 | if (eNotificationRequired()) |
| 151 | eNotify(new ENotificationImpl(this, Notification.SET, QVTBasePackage.DOMAIN__IS_ENFORCEABLE, oldIsEnforceable, isEnforceable)); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | public Rule getRule() { |
| 160 | if (eContainerFeatureID() != QVTBasePackage.DOMAIN__RULE) return null; |
| 161 | return (Rule)eContainer(); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * <!-- begin-user-doc --> |
| 166 | * <!-- end-user-doc --> |
| 167 | * @generated |
| 168 | */ |
| 169 | public NotificationChain basicSetRule(Rule newRule, NotificationChain msgs) { |
| 170 | msgs = eBasicSetContainer((InternalEObject)newRule, QVTBasePackage.DOMAIN__RULE, msgs); |
| 171 | return msgs; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * <!-- begin-user-doc --> |
| 176 | * <!-- end-user-doc --> |
| 177 | * @generated |
| 178 | */ |
| 179 | public void setRule(Rule newRule) { |
| 180 | if (newRule != eInternalContainer() || (eContainerFeatureID() != QVTBasePackage.DOMAIN__RULE && newRule != null)) { |
| 181 | if (EcoreUtil.isAncestor(this, newRule)) |
| 182 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 183 | NotificationChain msgs = null; |
| 184 | if (eInternalContainer() != null) |
| 185 | msgs = eBasicRemoveFromContainer(msgs); |
| 186 | if (newRule != null) |
| 187 | msgs = ((InternalEObject)newRule).eInverseAdd(this, QVTBasePackage.RULE__DOMAIN, Rule.class, msgs); |
| 188 | msgs = basicSetRule(newRule, msgs); |
| 189 | if (msgs != null) msgs.dispatch(); |
| 190 | } |
| 191 | else if (eNotificationRequired()) |
| 192 | eNotify(new ENotificationImpl(this, Notification.SET, QVTBasePackage.DOMAIN__RULE, newRule, newRule)); |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * <!-- begin-user-doc --> |
| 197 | * <!-- end-user-doc --> |
| 198 | * @generated |
| 199 | */ |
| 200 | public TypedModel getTypedModel() { |
| 201 | if (typedModel != null && typedModel.eIsProxy()) { |
| 202 | InternalEObject oldTypedModel = (InternalEObject)typedModel; |
| 203 | typedModel = (TypedModel)eResolveProxy(oldTypedModel); |
| 204 | if (typedModel != oldTypedModel) { |
| 205 | if (eNotificationRequired()) |
| 206 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTBasePackage.DOMAIN__TYPED_MODEL, oldTypedModel, typedModel)); |
| 207 | } |
| 208 | } |
| 209 | return typedModel; |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * <!-- begin-user-doc --> |
| 214 | * <!-- end-user-doc --> |
| 215 | * @generated |
| 216 | */ |
| 217 | public TypedModel basicGetTypedModel() { |
| 218 | return typedModel; |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * <!-- begin-user-doc --> |
| 223 | * <!-- end-user-doc --> |
| 224 | * @generated |
| 225 | */ |
| 226 | public void setTypedModel(TypedModel newTypedModel) { |
| 227 | TypedModel oldTypedModel = typedModel; |
| 228 | typedModel = newTypedModel; |
| 229 | if (eNotificationRequired()) |
| 230 | eNotify(new ENotificationImpl(this, Notification.SET, QVTBasePackage.DOMAIN__TYPED_MODEL, oldTypedModel, typedModel)); |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * <!-- begin-user-doc --> |
| 235 | * <!-- end-user-doc --> |
| 236 | * @generated |
| 237 | */ |
| 238 | @Override |
| 239 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 240 | switch (featureID) { |
| 241 | case QVTBasePackage.DOMAIN__RULE: |
| 242 | if (eInternalContainer() != null) |
| 243 | msgs = eBasicRemoveFromContainer(msgs); |
| 244 | return basicSetRule((Rule)otherEnd, msgs); |
| 245 | } |
| 246 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * <!-- begin-user-doc --> |
| 251 | * <!-- end-user-doc --> |
| 252 | * @generated |
| 253 | */ |
| 254 | @Override |
| 255 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 256 | switch (featureID) { |
| 257 | case QVTBasePackage.DOMAIN__RULE: |
| 258 | return basicSetRule(null, msgs); |
| 259 | } |
| 260 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * <!-- begin-user-doc --> |
| 265 | * <!-- end-user-doc --> |
| 266 | * @generated |
| 267 | */ |
| 268 | @Override |
| 269 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 270 | switch (eContainerFeatureID()) { |
| 271 | case QVTBasePackage.DOMAIN__RULE: |
| 272 | return eInternalContainer().eInverseRemove(this, QVTBasePackage.RULE__DOMAIN, Rule.class, msgs); |
| 273 | } |
| 274 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * <!-- begin-user-doc --> |
| 279 | * <!-- end-user-doc --> |
| 280 | * @generated |
| 281 | */ |
| 282 | @Override |
| 283 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 284 | switch (featureID) { |
| 285 | case QVTBasePackage.DOMAIN__IS_CHECKABLE: |
| 286 | return getIsCheckable(); |
| 287 | case QVTBasePackage.DOMAIN__IS_ENFORCEABLE: |
| 288 | return getIsEnforceable(); |
| 289 | case QVTBasePackage.DOMAIN__RULE: |
| 290 | return getRule(); |
| 291 | case QVTBasePackage.DOMAIN__TYPED_MODEL: |
| 292 | if (resolve) return getTypedModel(); |
| 293 | return basicGetTypedModel(); |
| 294 | } |
| 295 | return super.eGet(featureID, resolve, coreType); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * <!-- begin-user-doc --> |
| 300 | * <!-- end-user-doc --> |
| 301 | * @generated |
| 302 | */ |
| 303 | @Override |
| 304 | public void eSet(int featureID, Object newValue) { |
| 305 | switch (featureID) { |
| 306 | case QVTBasePackage.DOMAIN__IS_CHECKABLE: |
| 307 | setIsCheckable((Boolean)newValue); |
| 308 | return; |
| 309 | case QVTBasePackage.DOMAIN__IS_ENFORCEABLE: |
| 310 | setIsEnforceable((Boolean)newValue); |
| 311 | return; |
| 312 | case QVTBasePackage.DOMAIN__RULE: |
| 313 | setRule((Rule)newValue); |
| 314 | return; |
| 315 | case QVTBasePackage.DOMAIN__TYPED_MODEL: |
| 316 | setTypedModel((TypedModel)newValue); |
| 317 | return; |
| 318 | } |
| 319 | super.eSet(featureID, newValue); |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * <!-- begin-user-doc --> |
| 324 | * <!-- end-user-doc --> |
| 325 | * @generated |
| 326 | */ |
| 327 | @Override |
| 328 | public void eUnset(int featureID) { |
| 329 | switch (featureID) { |
| 330 | case QVTBasePackage.DOMAIN__IS_CHECKABLE: |
| 331 | setIsCheckable(IS_CHECKABLE_EDEFAULT); |
| 332 | return; |
| 333 | case QVTBasePackage.DOMAIN__IS_ENFORCEABLE: |
| 334 | setIsEnforceable(IS_ENFORCEABLE_EDEFAULT); |
| 335 | return; |
| 336 | case QVTBasePackage.DOMAIN__RULE: |
| 337 | setRule((Rule)null); |
| 338 | return; |
| 339 | case QVTBasePackage.DOMAIN__TYPED_MODEL: |
| 340 | setTypedModel((TypedModel)null); |
| 341 | return; |
| 342 | } |
| 343 | super.eUnset(featureID); |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * <!-- begin-user-doc --> |
| 348 | * <!-- end-user-doc --> |
| 349 | * @generated |
| 350 | */ |
| 351 | @Override |
| 352 | public boolean eIsSet(int featureID) { |
| 353 | switch (featureID) { |
| 354 | case QVTBasePackage.DOMAIN__IS_CHECKABLE: |
| 355 | return IS_CHECKABLE_EDEFAULT == null ? isCheckable != null : !IS_CHECKABLE_EDEFAULT.equals(isCheckable); |
| 356 | case QVTBasePackage.DOMAIN__IS_ENFORCEABLE: |
| 357 | return IS_ENFORCEABLE_EDEFAULT == null ? isEnforceable != null : !IS_ENFORCEABLE_EDEFAULT.equals(isEnforceable); |
| 358 | case QVTBasePackage.DOMAIN__RULE: |
| 359 | return getRule() != null; |
| 360 | case QVTBasePackage.DOMAIN__TYPED_MODEL: |
| 361 | return typedModel != null; |
| 362 | } |
| 363 | return super.eIsSet(featureID); |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * <!-- begin-user-doc --> |
| 368 | * <!-- end-user-doc --> |
| 369 | * @generated |
| 370 | */ |
| 371 | @Override |
| 372 | public String toString() { |
| 373 | if (eIsProxy()) return super.toString(); |
| 374 | |
| 375 | StringBuffer result = new StringBuffer(super.toString()); |
| 376 | result.append(" (isCheckable: "); |
| 377 | result.append(isCheckable); |
| 378 | result.append(", isEnforceable: "); |
| 379 | result.append(isEnforceable); |
| 380 | result.append(')'); |
| 381 | return result.toString(); |
| 382 | } |
| 383 | |
| 384 | } //DomainImpl |