| 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.EcoreUtil; |
| 18 | import org.eclipse.emf.ecore.util.InternalEList; |
| 19 | |
| 20 | import de.uka.ipd.sdq.pcm.repository.InfrastructureInterface; |
| 21 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
| 22 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
| 23 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
| 24 | |
| 25 | /** |
| 26 | * <!-- begin-user-doc --> |
| 27 | * An implementation of the model object '<em><b>Infrastructure Signature</b></em>'. |
| 28 | * <!-- end-user-doc --> |
| 29 | * <p> |
| 30 | * The following features are implemented: |
| 31 | * <ul> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.InfrastructureSignatureImpl#getParameters__InfrastructureSignature <em>Parameters Infrastructure Signature</em>}</li> |
| 33 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.InfrastructureSignatureImpl#getInfrastructureInterface__InfrastructureSignature <em>Infrastructure Interface Infrastructure Signature</em>}</li> |
| 34 | * </ul> |
| 35 | * </p> |
| 36 | * |
| 37 | * @generated |
| 38 | */ |
| 39 | public class InfrastructureSignatureImpl extends SignatureImpl implements InfrastructureSignature { |
| 40 | /** |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @generated |
| 44 | */ |
| 45 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 46 | |
| 47 | /** |
| 48 | * The cached value of the '{@link #getParameters__InfrastructureSignature() <em>Parameters Infrastructure Signature</em>}' containment reference list. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @see #getParameters__InfrastructureSignature() |
| 52 | * @generated |
| 53 | * @ordered |
| 54 | */ |
| 55 | protected EList<Parameter> parameters__InfrastructureSignature; |
| 56 | |
| 57 | /** |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | protected InfrastructureSignatureImpl() { |
| 63 | super(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @generated |
| 70 | */ |
| 71 | @Override |
| 72 | protected EClass eStaticClass() { |
| 73 | return RepositoryPackage.Literals.INFRASTRUCTURE_SIGNATURE; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @generated |
| 80 | */ |
| 81 | public EList<Parameter> getParameters__InfrastructureSignature() { |
| 82 | if (parameters__InfrastructureSignature == null) { |
| 83 | parameters__InfrastructureSignature = new EObjectContainmentWithInverseEList<Parameter>(Parameter.class, this, RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE, RepositoryPackage.PARAMETER__INFRASTRUCTURE_SIGNATURE_PARAMETER); |
| 84 | } |
| 85 | return parameters__InfrastructureSignature; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | public InfrastructureInterface getInfrastructureInterface__InfrastructureSignature() { |
| 94 | if (eContainerFeatureID() != RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE) return null; |
| 95 | return (InfrastructureInterface)eContainer(); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * <!-- begin-user-doc --> |
| 100 | * <!-- end-user-doc --> |
| 101 | * @generated |
| 102 | */ |
| 103 | public NotificationChain basicSetInfrastructureInterface__InfrastructureSignature(InfrastructureInterface newInfrastructureInterface__InfrastructureSignature, NotificationChain msgs) { |
| 104 | msgs = eBasicSetContainer((InternalEObject)newInfrastructureInterface__InfrastructureSignature, RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE, msgs); |
| 105 | return msgs; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | public void setInfrastructureInterface__InfrastructureSignature(InfrastructureInterface newInfrastructureInterface__InfrastructureSignature) { |
| 114 | if (newInfrastructureInterface__InfrastructureSignature != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE && newInfrastructureInterface__InfrastructureSignature != null)) { |
| 115 | if (EcoreUtil.isAncestor(this, newInfrastructureInterface__InfrastructureSignature)) |
| 116 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 117 | NotificationChain msgs = null; |
| 118 | if (eInternalContainer() != null) |
| 119 | msgs = eBasicRemoveFromContainer(msgs); |
| 120 | if (newInfrastructureInterface__InfrastructureSignature != null) |
| 121 | msgs = ((InternalEObject)newInfrastructureInterface__InfrastructureSignature).eInverseAdd(this, RepositoryPackage.INFRASTRUCTURE_INTERFACE__INFRASTRUCTURE_SIGNATURES_INFRASTRUCTURE_INTERFACE, InfrastructureInterface.class, msgs); |
| 122 | msgs = basicSetInfrastructureInterface__InfrastructureSignature(newInfrastructureInterface__InfrastructureSignature, msgs); |
| 123 | if (msgs != null) msgs.dispatch(); |
| 124 | } |
| 125 | else if (eNotificationRequired()) |
| 126 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE, newInfrastructureInterface__InfrastructureSignature, newInfrastructureInterface__InfrastructureSignature)); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * <!-- begin-user-doc --> |
| 131 | * <!-- end-user-doc --> |
| 132 | * @generated |
| 133 | */ |
| 134 | @SuppressWarnings("unchecked") |
| 135 | @Override |
| 136 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 137 | switch (featureID) { |
| 138 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 139 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getParameters__InfrastructureSignature()).basicAdd(otherEnd, msgs); |
| 140 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 141 | if (eInternalContainer() != null) |
| 142 | msgs = eBasicRemoveFromContainer(msgs); |
| 143 | return basicSetInfrastructureInterface__InfrastructureSignature((InfrastructureInterface)otherEnd, msgs); |
| 144 | } |
| 145 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * <!-- begin-user-doc --> |
| 150 | * <!-- end-user-doc --> |
| 151 | * @generated |
| 152 | */ |
| 153 | @Override |
| 154 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 155 | switch (featureID) { |
| 156 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 157 | return ((InternalEList<?>)getParameters__InfrastructureSignature()).basicRemove(otherEnd, msgs); |
| 158 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 159 | return basicSetInfrastructureInterface__InfrastructureSignature(null, msgs); |
| 160 | } |
| 161 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * <!-- begin-user-doc --> |
| 166 | * <!-- end-user-doc --> |
| 167 | * @generated |
| 168 | */ |
| 169 | @Override |
| 170 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 171 | switch (eContainerFeatureID()) { |
| 172 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 173 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.INFRASTRUCTURE_INTERFACE__INFRASTRUCTURE_SIGNATURES_INFRASTRUCTURE_INTERFACE, InfrastructureInterface.class, msgs); |
| 174 | } |
| 175 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * <!-- begin-user-doc --> |
| 180 | * <!-- end-user-doc --> |
| 181 | * @generated |
| 182 | */ |
| 183 | @Override |
| 184 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 185 | switch (featureID) { |
| 186 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 187 | return getParameters__InfrastructureSignature(); |
| 188 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 189 | return getInfrastructureInterface__InfrastructureSignature(); |
| 190 | } |
| 191 | return super.eGet(featureID, resolve, coreType); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * <!-- begin-user-doc --> |
| 196 | * <!-- end-user-doc --> |
| 197 | * @generated |
| 198 | */ |
| 199 | @SuppressWarnings("unchecked") |
| 200 | @Override |
| 201 | public void eSet(int featureID, Object newValue) { |
| 202 | switch (featureID) { |
| 203 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 204 | getParameters__InfrastructureSignature().clear(); |
| 205 | getParameters__InfrastructureSignature().addAll((Collection<? extends Parameter>)newValue); |
| 206 | return; |
| 207 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 208 | setInfrastructureInterface__InfrastructureSignature((InfrastructureInterface)newValue); |
| 209 | return; |
| 210 | } |
| 211 | super.eSet(featureID, newValue); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * <!-- begin-user-doc --> |
| 216 | * <!-- end-user-doc --> |
| 217 | * @generated |
| 218 | */ |
| 219 | @Override |
| 220 | public void eUnset(int featureID) { |
| 221 | switch (featureID) { |
| 222 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 223 | getParameters__InfrastructureSignature().clear(); |
| 224 | return; |
| 225 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 226 | setInfrastructureInterface__InfrastructureSignature((InfrastructureInterface)null); |
| 227 | return; |
| 228 | } |
| 229 | super.eUnset(featureID); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * <!-- begin-user-doc --> |
| 234 | * <!-- end-user-doc --> |
| 235 | * @generated |
| 236 | */ |
| 237 | @Override |
| 238 | public boolean eIsSet(int featureID) { |
| 239 | switch (featureID) { |
| 240 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__PARAMETERS_INFRASTRUCTURE_SIGNATURE: |
| 241 | return parameters__InfrastructureSignature != null && !parameters__InfrastructureSignature.isEmpty(); |
| 242 | case RepositoryPackage.INFRASTRUCTURE_SIGNATURE__INFRASTRUCTURE_INTERFACE_INFRASTRUCTURE_SIGNATURE: |
| 243 | return getInfrastructureInterface__InfrastructureSignature() != null; |
| 244 | } |
| 245 | return super.eIsSet(featureID); |
| 246 | } |
| 247 | |
| 248 | } //InfrastructureSignatureImpl |