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