| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.repository.impl; |
| 7 | |
| 8 | import java.util.Collection; |
| 9 | |
| 10 | import org.eclipse.emf.common.notify.Notification; |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.common.util.EList; |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 16 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 17 | import org.eclipse.emf.ecore.util.InternalEList; |
| 18 | |
| 19 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
| 20 | import de.uka.ipd.sdq.pcm.reliability.FailureType; |
| 21 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
| 22 | import de.uka.ipd.sdq.pcm.repository.DataType; |
| 23 | import de.uka.ipd.sdq.pcm.repository.Interface; |
| 24 | import de.uka.ipd.sdq.pcm.repository.Repository; |
| 25 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
| 26 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
| 27 | |
| 28 | /** |
| 29 | * <!-- begin-user-doc --> |
| 30 | * An implementation of the model object '<em><b>Repository</b></em>'. |
| 31 | * <!-- end-user-doc --> |
| 32 | * <p> |
| 33 | * The following features are implemented: |
| 34 | * <ul> |
| 35 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RepositoryImpl#getRepositoryDescription <em>Repository Description</em>}</li> |
| 36 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RepositoryImpl#getComponents__Repository <em>Components Repository</em>}</li> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RepositoryImpl#getInterfaces__Repository <em>Interfaces Repository</em>}</li> |
| 38 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RepositoryImpl#getFailureTypes__Repository <em>Failure Types Repository</em>}</li> |
| 39 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.RepositoryImpl#getDataTypes__Repository <em>Data Types Repository</em>}</li> |
| 40 | * </ul> |
| 41 | * </p> |
| 42 | * |
| 43 | * @generated |
| 44 | */ |
| 45 | public class RepositoryImpl extends EntityImpl implements Repository { |
| 46 | /** |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @generated |
| 50 | */ |
| 51 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 52 | |
| 53 | /** |
| 54 | * The default value of the '{@link #getRepositoryDescription() <em>Repository Description</em>}' attribute. |
| 55 | * <!-- begin-user-doc --> |
| 56 | * <!-- end-user-doc --> |
| 57 | * @see #getRepositoryDescription() |
| 58 | * @generated |
| 59 | * @ordered |
| 60 | */ |
| 61 | protected static final String REPOSITORY_DESCRIPTION_EDEFAULT = null; |
| 62 | |
| 63 | /** |
| 64 | * The cached value of the '{@link #getRepositoryDescription() <em>Repository Description</em>}' attribute. |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @see #getRepositoryDescription() |
| 68 | * @generated |
| 69 | * @ordered |
| 70 | */ |
| 71 | protected String repositoryDescription = REPOSITORY_DESCRIPTION_EDEFAULT; |
| 72 | |
| 73 | /** |
| 74 | * The cached value of the '{@link #getComponents__Repository() <em>Components Repository</em>}' containment reference list. |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @see #getComponents__Repository() |
| 78 | * @generated |
| 79 | * @ordered |
| 80 | */ |
| 81 | protected EList<RepositoryComponent> components__Repository; |
| 82 | |
| 83 | /** |
| 84 | * The cached value of the '{@link #getInterfaces__Repository() <em>Interfaces Repository</em>}' containment reference list. |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @see #getInterfaces__Repository() |
| 88 | * @generated |
| 89 | * @ordered |
| 90 | */ |
| 91 | protected EList<Interface> interfaces__Repository; |
| 92 | |
| 93 | /** |
| 94 | * The cached value of the '{@link #getFailureTypes__Repository() <em>Failure Types Repository</em>}' containment reference list. |
| 95 | * <!-- begin-user-doc --> |
| 96 | * <!-- end-user-doc --> |
| 97 | * @see #getFailureTypes__Repository() |
| 98 | * @generated |
| 99 | * @ordered |
| 100 | */ |
| 101 | protected EList<FailureType> failureTypes__Repository; |
| 102 | |
| 103 | /** |
| 104 | * The cached value of the '{@link #getDataTypes__Repository() <em>Data Types Repository</em>}' containment reference list. |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @see #getDataTypes__Repository() |
| 108 | * @generated |
| 109 | * @ordered |
| 110 | */ |
| 111 | protected EList<DataType> dataTypes__Repository; |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | protected RepositoryImpl() { |
| 119 | super(); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | @Override |
| 128 | protected EClass eStaticClass() { |
| 129 | return RepositoryPackage.Literals.REPOSITORY; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * <!-- begin-user-doc --> |
| 134 | * <!-- end-user-doc --> |
| 135 | * @generated |
| 136 | */ |
| 137 | public String getRepositoryDescription() { |
| 138 | return repositoryDescription; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | public void setRepositoryDescription(String newRepositoryDescription) { |
| 147 | String oldRepositoryDescription = repositoryDescription; |
| 148 | repositoryDescription = newRepositoryDescription; |
| 149 | if (eNotificationRequired()) |
| 150 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.REPOSITORY__REPOSITORY_DESCRIPTION, oldRepositoryDescription, repositoryDescription)); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | public EList<RepositoryComponent> getComponents__Repository() { |
| 159 | if (components__Repository == null) { |
| 160 | components__Repository = new EObjectContainmentWithInverseEList<RepositoryComponent>(RepositoryComponent.class, this, RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY, RepositoryPackage.REPOSITORY_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT); |
| 161 | } |
| 162 | return components__Repository; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * <!-- begin-user-doc --> |
| 167 | * <!-- end-user-doc --> |
| 168 | * @generated |
| 169 | */ |
| 170 | public EList<FailureType> getFailureTypes__Repository() { |
| 171 | if (failureTypes__Repository == null) { |
| 172 | failureTypes__Repository = new EObjectContainmentWithInverseEList<FailureType>(FailureType.class, this, RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY, ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE); |
| 173 | } |
| 174 | return failureTypes__Repository; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | public EList<DataType> getDataTypes__Repository() { |
| 183 | if (dataTypes__Repository == null) { |
| 184 | dataTypes__Repository = new EObjectContainmentWithInverseEList<DataType>(DataType.class, this, RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY, RepositoryPackage.DATA_TYPE__REPOSITORY_DATA_TYPE); |
| 185 | } |
| 186 | return dataTypes__Repository; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * <!-- begin-user-doc --> |
| 191 | * <!-- end-user-doc --> |
| 192 | * @generated |
| 193 | */ |
| 194 | public EList<Interface> getInterfaces__Repository() { |
| 195 | if (interfaces__Repository == null) { |
| 196 | interfaces__Repository = new EObjectContainmentWithInverseEList<Interface>(Interface.class, this, RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY, RepositoryPackage.INTERFACE__REPOSITORY_INTERFACE); |
| 197 | } |
| 198 | return interfaces__Repository; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * <!-- begin-user-doc --> |
| 203 | * <!-- end-user-doc --> |
| 204 | * @generated |
| 205 | */ |
| 206 | @SuppressWarnings("unchecked") |
| 207 | @Override |
| 208 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 209 | switch (featureID) { |
| 210 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 211 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getComponents__Repository()).basicAdd(otherEnd, msgs); |
| 212 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 213 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getInterfaces__Repository()).basicAdd(otherEnd, msgs); |
| 214 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 215 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getFailureTypes__Repository()).basicAdd(otherEnd, msgs); |
| 216 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 217 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getDataTypes__Repository()).basicAdd(otherEnd, msgs); |
| 218 | } |
| 219 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * <!-- begin-user-doc --> |
| 224 | * <!-- end-user-doc --> |
| 225 | * @generated |
| 226 | */ |
| 227 | @Override |
| 228 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 229 | switch (featureID) { |
| 230 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 231 | return ((InternalEList<?>)getComponents__Repository()).basicRemove(otherEnd, msgs); |
| 232 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 233 | return ((InternalEList<?>)getInterfaces__Repository()).basicRemove(otherEnd, msgs); |
| 234 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 235 | return ((InternalEList<?>)getFailureTypes__Repository()).basicRemove(otherEnd, msgs); |
| 236 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 237 | return ((InternalEList<?>)getDataTypes__Repository()).basicRemove(otherEnd, msgs); |
| 238 | } |
| 239 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * <!-- begin-user-doc --> |
| 244 | * <!-- end-user-doc --> |
| 245 | * @generated |
| 246 | */ |
| 247 | @Override |
| 248 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 249 | switch (featureID) { |
| 250 | case RepositoryPackage.REPOSITORY__REPOSITORY_DESCRIPTION: |
| 251 | return getRepositoryDescription(); |
| 252 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 253 | return getComponents__Repository(); |
| 254 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 255 | return getInterfaces__Repository(); |
| 256 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 257 | return getFailureTypes__Repository(); |
| 258 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 259 | return getDataTypes__Repository(); |
| 260 | } |
| 261 | return super.eGet(featureID, resolve, coreType); |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * <!-- begin-user-doc --> |
| 266 | * <!-- end-user-doc --> |
| 267 | * @generated |
| 268 | */ |
| 269 | @SuppressWarnings("unchecked") |
| 270 | @Override |
| 271 | public void eSet(int featureID, Object newValue) { |
| 272 | switch (featureID) { |
| 273 | case RepositoryPackage.REPOSITORY__REPOSITORY_DESCRIPTION: |
| 274 | setRepositoryDescription((String)newValue); |
| 275 | return; |
| 276 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 277 | getComponents__Repository().clear(); |
| 278 | getComponents__Repository().addAll((Collection<? extends RepositoryComponent>)newValue); |
| 279 | return; |
| 280 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 281 | getInterfaces__Repository().clear(); |
| 282 | getInterfaces__Repository().addAll((Collection<? extends Interface>)newValue); |
| 283 | return; |
| 284 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 285 | getFailureTypes__Repository().clear(); |
| 286 | getFailureTypes__Repository().addAll((Collection<? extends FailureType>)newValue); |
| 287 | return; |
| 288 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 289 | getDataTypes__Repository().clear(); |
| 290 | getDataTypes__Repository().addAll((Collection<? extends DataType>)newValue); |
| 291 | return; |
| 292 | } |
| 293 | super.eSet(featureID, newValue); |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * <!-- begin-user-doc --> |
| 298 | * <!-- end-user-doc --> |
| 299 | * @generated |
| 300 | */ |
| 301 | @Override |
| 302 | public void eUnset(int featureID) { |
| 303 | switch (featureID) { |
| 304 | case RepositoryPackage.REPOSITORY__REPOSITORY_DESCRIPTION: |
| 305 | setRepositoryDescription(REPOSITORY_DESCRIPTION_EDEFAULT); |
| 306 | return; |
| 307 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 308 | getComponents__Repository().clear(); |
| 309 | return; |
| 310 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 311 | getInterfaces__Repository().clear(); |
| 312 | return; |
| 313 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 314 | getFailureTypes__Repository().clear(); |
| 315 | return; |
| 316 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 317 | getDataTypes__Repository().clear(); |
| 318 | return; |
| 319 | } |
| 320 | super.eUnset(featureID); |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * <!-- begin-user-doc --> |
| 325 | * <!-- end-user-doc --> |
| 326 | * @generated |
| 327 | */ |
| 328 | @Override |
| 329 | public boolean eIsSet(int featureID) { |
| 330 | switch (featureID) { |
| 331 | case RepositoryPackage.REPOSITORY__REPOSITORY_DESCRIPTION: |
| 332 | return REPOSITORY_DESCRIPTION_EDEFAULT == null ? repositoryDescription != null : !REPOSITORY_DESCRIPTION_EDEFAULT.equals(repositoryDescription); |
| 333 | case RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY: |
| 334 | return components__Repository != null && !components__Repository.isEmpty(); |
| 335 | case RepositoryPackage.REPOSITORY__INTERFACES_REPOSITORY: |
| 336 | return interfaces__Repository != null && !interfaces__Repository.isEmpty(); |
| 337 | case RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY: |
| 338 | return failureTypes__Repository != null && !failureTypes__Repository.isEmpty(); |
| 339 | case RepositoryPackage.REPOSITORY__DATA_TYPES_REPOSITORY: |
| 340 | return dataTypes__Repository != null && !dataTypes__Repository.isEmpty(); |
| 341 | } |
| 342 | return super.eIsSet(featureID); |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * <!-- begin-user-doc --> |
| 347 | * <!-- end-user-doc --> |
| 348 | * @generated |
| 349 | */ |
| 350 | @Override |
| 351 | public String toString() { |
| 352 | if (eIsProxy()) return super.toString(); |
| 353 | |
| 354 | StringBuffer result = new StringBuffer(super.toString()); |
| 355 | result.append(" (repositoryDescription: "); |
| 356 | result.append(repositoryDescription); |
| 357 | result.append(')'); |
| 358 | return result.toString(); |
| 359 | } |
| 360 | |
| 361 | } //RepositoryImpl |