| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.designdecision.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.allocation.AllocationContext; |
| 10 | |
| 11 | import de.uka.ipd.sdq.pcm.designdecision.ExchangeComponentRule; |
| 12 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
| 13 | |
| 14 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
| 15 | |
| 16 | import java.util.Collection; |
| 17 | |
| 18 | import org.eclipse.emf.common.notify.Notification; |
| 19 | |
| 20 | import org.eclipse.emf.common.util.EList; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.EClass; |
| 23 | import org.eclipse.emf.ecore.InternalEObject; |
| 24 | |
| 25 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 26 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 27 | |
| 28 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| 29 | |
| 30 | /** |
| 31 | * <!-- begin-user-doc --> |
| 32 | * An implementation of the model object '<em><b>Exchange Component Rule</b></em>'. |
| 33 | * <!-- end-user-doc --> |
| 34 | * <p> |
| 35 | * The following features are implemented: |
| 36 | * <ul> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.ExchangeComponentRuleImpl#getRepositoryComponent <em>Repository Component</em>}</li> |
| 38 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.ExchangeComponentRuleImpl#getAllocationContext <em>Allocation Context</em>}</li> |
| 39 | * </ul> |
| 40 | * </p> |
| 41 | * |
| 42 | * @generated |
| 43 | */ |
| 44 | public class ExchangeComponentRuleImpl extends EObjectImpl implements ExchangeComponentRule { |
| 45 | /** |
| 46 | * The cached value of the '{@link #getRepositoryComponent() <em>Repository Component</em>}' reference list. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @see #getRepositoryComponent() |
| 50 | * @generated |
| 51 | * @ordered |
| 52 | */ |
| 53 | protected EList<RepositoryComponent> repositoryComponent; |
| 54 | |
| 55 | /** |
| 56 | * The cached value of the '{@link #getAllocationContext() <em>Allocation Context</em>}' reference. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @see #getAllocationContext() |
| 60 | * @generated |
| 61 | * @ordered |
| 62 | */ |
| 63 | protected AllocationContext allocationContext; |
| 64 | |
| 65 | /** |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | protected ExchangeComponentRuleImpl() { |
| 71 | super(); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | @Override |
| 80 | protected EClass eStaticClass() { |
| 81 | return designdecisionPackage.Literals.EXCHANGE_COMPONENT_RULE; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | public EList<RepositoryComponent> getRepositoryComponent() { |
| 90 | if (repositoryComponent == null) { |
| 91 | repositoryComponent = new EObjectResolvingEList<RepositoryComponent>(RepositoryComponent.class, this, designdecisionPackage.EXCHANGE_COMPONENT_RULE__REPOSITORY_COMPONENT); |
| 92 | } |
| 93 | return repositoryComponent; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | public AllocationContext getAllocationContext() { |
| 102 | if (allocationContext != null && allocationContext.eIsProxy()) { |
| 103 | InternalEObject oldAllocationContext = (InternalEObject)allocationContext; |
| 104 | allocationContext = (AllocationContext)eResolveProxy(oldAllocationContext); |
| 105 | if (allocationContext != oldAllocationContext) { |
| 106 | if (eNotificationRequired()) |
| 107 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT, oldAllocationContext, allocationContext)); |
| 108 | } |
| 109 | } |
| 110 | return allocationContext; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | public AllocationContext basicGetAllocationContext() { |
| 119 | return allocationContext; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | public void setAllocationContext(AllocationContext newAllocationContext) { |
| 128 | AllocationContext oldAllocationContext = allocationContext; |
| 129 | allocationContext = newAllocationContext; |
| 130 | if (eNotificationRequired()) |
| 131 | eNotify(new ENotificationImpl(this, Notification.SET, designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT, oldAllocationContext, allocationContext)); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | @Override |
| 140 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 141 | switch (featureID) { |
| 142 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__REPOSITORY_COMPONENT: |
| 143 | return getRepositoryComponent(); |
| 144 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT: |
| 145 | if (resolve) return getAllocationContext(); |
| 146 | return basicGetAllocationContext(); |
| 147 | } |
| 148 | return super.eGet(featureID, resolve, coreType); |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * <!-- begin-user-doc --> |
| 153 | * <!-- end-user-doc --> |
| 154 | * @generated |
| 155 | */ |
| 156 | @SuppressWarnings("unchecked") |
| 157 | @Override |
| 158 | public void eSet(int featureID, Object newValue) { |
| 159 | switch (featureID) { |
| 160 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__REPOSITORY_COMPONENT: |
| 161 | getRepositoryComponent().clear(); |
| 162 | getRepositoryComponent().addAll((Collection<? extends RepositoryComponent>)newValue); |
| 163 | return; |
| 164 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT: |
| 165 | setAllocationContext((AllocationContext)newValue); |
| 166 | return; |
| 167 | } |
| 168 | super.eSet(featureID, newValue); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * <!-- begin-user-doc --> |
| 173 | * <!-- end-user-doc --> |
| 174 | * @generated |
| 175 | */ |
| 176 | @Override |
| 177 | public void eUnset(int featureID) { |
| 178 | switch (featureID) { |
| 179 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__REPOSITORY_COMPONENT: |
| 180 | getRepositoryComponent().clear(); |
| 181 | return; |
| 182 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT: |
| 183 | setAllocationContext((AllocationContext)null); |
| 184 | return; |
| 185 | } |
| 186 | super.eUnset(featureID); |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * <!-- begin-user-doc --> |
| 191 | * <!-- end-user-doc --> |
| 192 | * @generated |
| 193 | */ |
| 194 | @Override |
| 195 | public boolean eIsSet(int featureID) { |
| 196 | switch (featureID) { |
| 197 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__REPOSITORY_COMPONENT: |
| 198 | return repositoryComponent != null && !repositoryComponent.isEmpty(); |
| 199 | case designdecisionPackage.EXCHANGE_COMPONENT_RULE__ALLOCATION_CONTEXT: |
| 200 | return allocationContext != null; |
| 201 | } |
| 202 | return super.eIsSet(featureID); |
| 203 | } |
| 204 | |
| 205 | } //ExchangeComponentRuleImpl |