| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.fzi.se.quality.qualityannotation.impl; |
| 8 | |
| 9 | import de.fzi.se.quality.qualityannotation.QualityAnnotation; |
| 10 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
| 11 | import de.fzi.se.quality.qualityannotation.ServiceSpecification; |
| 12 | |
| 13 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
| 14 | |
| 15 | import org.eclipse.emf.common.notify.Notification; |
| 16 | import org.eclipse.emf.common.notify.NotificationChain; |
| 17 | |
| 18 | import org.eclipse.emf.ecore.EClass; |
| 19 | import org.eclipse.emf.ecore.InternalEObject; |
| 20 | |
| 21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 24 | |
| 25 | /** |
| 26 | * <!-- begin-user-doc --> |
| 27 | * An implementation of the model object '<em><b>Service Specification</b></em>'. |
| 28 | * <!-- end-user-doc --> |
| 29 | * <p> |
| 30 | * The following features are implemented: |
| 31 | * <ul> |
| 32 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.ServiceSpecificationImpl#getChecksum <em>Checksum</em>}</li> |
| 33 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.ServiceSpecificationImpl#getQualityAnnotation <em>Quality Annotation</em>}</li> |
| 34 | * </ul> |
| 35 | * </p> |
| 36 | * |
| 37 | * @generated |
| 38 | */ |
| 39 | public abstract class ServiceSpecificationImpl extends IdentifierImpl implements ServiceSpecification { |
| 40 | /** |
| 41 | * The default value of the '{@link #getChecksum() <em>Checksum</em>}' attribute. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @see #getChecksum() |
| 45 | * @generated |
| 46 | * @ordered |
| 47 | */ |
| 48 | protected static final long CHECKSUM_EDEFAULT = 0L; |
| 49 | |
| 50 | /** |
| 51 | * The cached value of the '{@link #getChecksum() <em>Checksum</em>}' attribute. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @see #getChecksum() |
| 55 | * @generated |
| 56 | * @ordered |
| 57 | */ |
| 58 | protected long checksum = CHECKSUM_EDEFAULT; |
| 59 | |
| 60 | /** |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @generated |
| 64 | */ |
| 65 | protected ServiceSpecificationImpl() { |
| 66 | super(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @generated |
| 73 | */ |
| 74 | @Override |
| 75 | protected EClass eStaticClass() { |
| 76 | return QualityAnnotationPackage.Literals.SERVICE_SPECIFICATION; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | public long getChecksum() { |
| 85 | return checksum; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | public void setChecksum(long newChecksum) { |
| 94 | long oldChecksum = checksum; |
| 95 | checksum = newChecksum; |
| 96 | if (eNotificationRequired()) |
| 97 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.SERVICE_SPECIFICATION__CHECKSUM, oldChecksum, checksum)); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | public QualityAnnotation getQualityAnnotation() { |
| 106 | if (eContainerFeatureID() != QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION) return null; |
| 107 | return (QualityAnnotation)eContainer(); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | public NotificationChain basicSetQualityAnnotation(QualityAnnotation newQualityAnnotation, NotificationChain msgs) { |
| 116 | msgs = eBasicSetContainer((InternalEObject)newQualityAnnotation, QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION, msgs); |
| 117 | return msgs; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * <!-- begin-user-doc --> |
| 122 | * <!-- end-user-doc --> |
| 123 | * @generated |
| 124 | */ |
| 125 | public void setQualityAnnotation(QualityAnnotation newQualityAnnotation) { |
| 126 | if (newQualityAnnotation != eInternalContainer() || (eContainerFeatureID() != QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION && newQualityAnnotation != null)) { |
| 127 | if (EcoreUtil.isAncestor(this, newQualityAnnotation)) |
| 128 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 129 | NotificationChain msgs = null; |
| 130 | if (eInternalContainer() != null) |
| 131 | msgs = eBasicRemoveFromContainer(msgs); |
| 132 | if (newQualityAnnotation != null) |
| 133 | msgs = ((InternalEObject)newQualityAnnotation).eInverseAdd(this, QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, QualityAnnotation.class, msgs); |
| 134 | msgs = basicSetQualityAnnotation(newQualityAnnotation, msgs); |
| 135 | if (msgs != null) msgs.dispatch(); |
| 136 | } |
| 137 | else if (eNotificationRequired()) |
| 138 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION, newQualityAnnotation, newQualityAnnotation)); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | @Override |
| 147 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 148 | switch (featureID) { |
| 149 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 150 | if (eInternalContainer() != null) |
| 151 | msgs = eBasicRemoveFromContainer(msgs); |
| 152 | return basicSetQualityAnnotation((QualityAnnotation)otherEnd, msgs); |
| 153 | } |
| 154 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * <!-- begin-user-doc --> |
| 159 | * <!-- end-user-doc --> |
| 160 | * @generated |
| 161 | */ |
| 162 | @Override |
| 163 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 164 | switch (featureID) { |
| 165 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 166 | return basicSetQualityAnnotation(null, msgs); |
| 167 | } |
| 168 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * <!-- begin-user-doc --> |
| 173 | * <!-- end-user-doc --> |
| 174 | * @generated |
| 175 | */ |
| 176 | @Override |
| 177 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 178 | switch (eContainerFeatureID()) { |
| 179 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 180 | return eInternalContainer().eInverseRemove(this, QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, QualityAnnotation.class, msgs); |
| 181 | } |
| 182 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * <!-- begin-user-doc --> |
| 187 | * <!-- end-user-doc --> |
| 188 | * @generated |
| 189 | */ |
| 190 | @Override |
| 191 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 192 | switch (featureID) { |
| 193 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__CHECKSUM: |
| 194 | return getChecksum(); |
| 195 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 196 | return getQualityAnnotation(); |
| 197 | } |
| 198 | return super.eGet(featureID, resolve, coreType); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * <!-- begin-user-doc --> |
| 203 | * <!-- end-user-doc --> |
| 204 | * @generated |
| 205 | */ |
| 206 | @Override |
| 207 | public void eSet(int featureID, Object newValue) { |
| 208 | switch (featureID) { |
| 209 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__CHECKSUM: |
| 210 | setChecksum((Long)newValue); |
| 211 | return; |
| 212 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 213 | setQualityAnnotation((QualityAnnotation)newValue); |
| 214 | return; |
| 215 | } |
| 216 | super.eSet(featureID, newValue); |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * <!-- begin-user-doc --> |
| 221 | * <!-- end-user-doc --> |
| 222 | * @generated |
| 223 | */ |
| 224 | @Override |
| 225 | public void eUnset(int featureID) { |
| 226 | switch (featureID) { |
| 227 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__CHECKSUM: |
| 228 | setChecksum(CHECKSUM_EDEFAULT); |
| 229 | return; |
| 230 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 231 | setQualityAnnotation((QualityAnnotation)null); |
| 232 | return; |
| 233 | } |
| 234 | super.eUnset(featureID); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * <!-- begin-user-doc --> |
| 239 | * <!-- end-user-doc --> |
| 240 | * @generated |
| 241 | */ |
| 242 | @Override |
| 243 | public boolean eIsSet(int featureID) { |
| 244 | switch (featureID) { |
| 245 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__CHECKSUM: |
| 246 | return checksum != CHECKSUM_EDEFAULT; |
| 247 | case QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION: |
| 248 | return getQualityAnnotation() != null; |
| 249 | } |
| 250 | return super.eIsSet(featureID); |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * <!-- begin-user-doc --> |
| 255 | * <!-- end-user-doc --> |
| 256 | * @generated |
| 257 | */ |
| 258 | @Override |
| 259 | public String toString() { |
| 260 | if (eIsProxy()) return super.toString(); |
| 261 | |
| 262 | StringBuffer result = new StringBuffer(super.toString()); |
| 263 | result.append(" (checksum: "); |
| 264 | result.append(checksum); |
| 265 | result.append(')'); |
| 266 | return result.toString(); |
| 267 | } |
| 268 | |
| 269 | } //ServiceSpecificationImpl |