| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package scheduler.configuration.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
| 10 | |
| 11 | import org.eclipse.emf.common.notify.Notification; |
| 12 | |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | |
| 16 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 17 | |
| 18 | import scheduler.configuration.ActiveResourceConfiguration; |
| 19 | import scheduler.configuration.ConfigurationPackage; |
| 20 | import scheduler.configuration.SchedulerConfiguration; |
| 21 | |
| 22 | /** |
| 23 | * <!-- begin-user-doc --> |
| 24 | * An implementation of the model object '<em><b>Active Resource Configuration</b></em>'. |
| 25 | * <!-- end-user-doc --> |
| 26 | * <p> |
| 27 | * The following features are implemented: |
| 28 | * <ul> |
| 29 | * <li>{@link scheduler.configuration.impl.ActiveResourceConfigurationImpl#getSchedulerConfiguration <em>Scheduler Configuration</em>}</li> |
| 30 | * <li>{@link scheduler.configuration.impl.ActiveResourceConfigurationImpl#getReplicas <em>Replicas</em>}</li> |
| 31 | * <li>{@link scheduler.configuration.impl.ActiveResourceConfigurationImpl#getName <em>Name</em>}</li> |
| 32 | * </ul> |
| 33 | * </p> |
| 34 | * |
| 35 | * @generated |
| 36 | */ |
| 37 | public class ActiveResourceConfigurationImpl extends IdentifierImpl implements ActiveResourceConfiguration { |
| 38 | /** |
| 39 | * The cached value of the '{@link #getSchedulerConfiguration() <em>Scheduler Configuration</em>}' reference. |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @see #getSchedulerConfiguration() |
| 43 | * @generated |
| 44 | * @ordered |
| 45 | */ |
| 46 | protected SchedulerConfiguration schedulerConfiguration; |
| 47 | |
| 48 | /** |
| 49 | * The default value of the '{@link #getReplicas() <em>Replicas</em>}' attribute. |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @see #getReplicas() |
| 53 | * @generated |
| 54 | * @ordered |
| 55 | */ |
| 56 | protected static final int REPLICAS_EDEFAULT = 1; |
| 57 | |
| 58 | /** |
| 59 | * The cached value of the '{@link #getReplicas() <em>Replicas</em>}' attribute. |
| 60 | * <!-- begin-user-doc --> |
| 61 | * <!-- end-user-doc --> |
| 62 | * @see #getReplicas() |
| 63 | * @generated |
| 64 | * @ordered |
| 65 | */ |
| 66 | protected int replicas = REPLICAS_EDEFAULT; |
| 67 | |
| 68 | /** |
| 69 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @see #getName() |
| 73 | * @generated |
| 74 | * @ordered |
| 75 | */ |
| 76 | protected static final String NAME_EDEFAULT = null; |
| 77 | |
| 78 | /** |
| 79 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @see #getName() |
| 83 | * @generated |
| 84 | * @ordered |
| 85 | */ |
| 86 | protected String name = NAME_EDEFAULT; |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | protected ActiveResourceConfigurationImpl() { |
| 94 | super(); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | protected EClass eStaticClass() { |
| 104 | return ConfigurationPackage.Literals.ACTIVE_RESOURCE_CONFIGURATION; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * <!-- begin-user-doc --> |
| 109 | * <!-- end-user-doc --> |
| 110 | * @generated |
| 111 | */ |
| 112 | public SchedulerConfiguration getSchedulerConfiguration() { |
| 113 | if (schedulerConfiguration != null && schedulerConfiguration.eIsProxy()) { |
| 114 | InternalEObject oldSchedulerConfiguration = (InternalEObject)schedulerConfiguration; |
| 115 | schedulerConfiguration = (SchedulerConfiguration)eResolveProxy(oldSchedulerConfiguration); |
| 116 | if (schedulerConfiguration != oldSchedulerConfiguration) { |
| 117 | if (eNotificationRequired()) |
| 118 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION, oldSchedulerConfiguration, schedulerConfiguration)); |
| 119 | } |
| 120 | } |
| 121 | return schedulerConfiguration; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @generated |
| 128 | */ |
| 129 | public SchedulerConfiguration basicGetSchedulerConfiguration() { |
| 130 | return schedulerConfiguration; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | public void setSchedulerConfiguration(SchedulerConfiguration newSchedulerConfiguration) { |
| 139 | SchedulerConfiguration oldSchedulerConfiguration = schedulerConfiguration; |
| 140 | schedulerConfiguration = newSchedulerConfiguration; |
| 141 | if (eNotificationRequired()) |
| 142 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION, oldSchedulerConfiguration, schedulerConfiguration)); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * <!-- begin-user-doc --> |
| 147 | * <!-- end-user-doc --> |
| 148 | * @generated |
| 149 | */ |
| 150 | public int getReplicas() { |
| 151 | return replicas; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | public void setReplicas(int newReplicas) { |
| 160 | int oldReplicas = replicas; |
| 161 | replicas = newReplicas; |
| 162 | if (eNotificationRequired()) |
| 163 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__REPLICAS, oldReplicas, replicas)); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * <!-- begin-user-doc --> |
| 168 | * <!-- end-user-doc --> |
| 169 | * @generated |
| 170 | */ |
| 171 | public String getName() { |
| 172 | return name; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | public void setName(String newName) { |
| 181 | String oldName = name; |
| 182 | name = newName; |
| 183 | if (eNotificationRequired()) |
| 184 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__NAME, oldName, name)); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * <!-- begin-user-doc --> |
| 189 | * <!-- end-user-doc --> |
| 190 | * @generated |
| 191 | */ |
| 192 | @Override |
| 193 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 194 | switch (featureID) { |
| 195 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION: |
| 196 | if (resolve) return getSchedulerConfiguration(); |
| 197 | return basicGetSchedulerConfiguration(); |
| 198 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__REPLICAS: |
| 199 | return getReplicas(); |
| 200 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__NAME: |
| 201 | return getName(); |
| 202 | } |
| 203 | return super.eGet(featureID, resolve, coreType); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * <!-- begin-user-doc --> |
| 208 | * <!-- end-user-doc --> |
| 209 | * @generated |
| 210 | */ |
| 211 | @Override |
| 212 | public void eSet(int featureID, Object newValue) { |
| 213 | switch (featureID) { |
| 214 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION: |
| 215 | setSchedulerConfiguration((SchedulerConfiguration)newValue); |
| 216 | return; |
| 217 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__REPLICAS: |
| 218 | setReplicas((Integer)newValue); |
| 219 | return; |
| 220 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__NAME: |
| 221 | setName((String)newValue); |
| 222 | return; |
| 223 | } |
| 224 | super.eSet(featureID, newValue); |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * <!-- begin-user-doc --> |
| 229 | * <!-- end-user-doc --> |
| 230 | * @generated |
| 231 | */ |
| 232 | @Override |
| 233 | public void eUnset(int featureID) { |
| 234 | switch (featureID) { |
| 235 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION: |
| 236 | setSchedulerConfiguration((SchedulerConfiguration)null); |
| 237 | return; |
| 238 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__REPLICAS: |
| 239 | setReplicas(REPLICAS_EDEFAULT); |
| 240 | return; |
| 241 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__NAME: |
| 242 | setName(NAME_EDEFAULT); |
| 243 | return; |
| 244 | } |
| 245 | super.eUnset(featureID); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * <!-- begin-user-doc --> |
| 250 | * <!-- end-user-doc --> |
| 251 | * @generated |
| 252 | */ |
| 253 | @Override |
| 254 | public boolean eIsSet(int featureID) { |
| 255 | switch (featureID) { |
| 256 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__SCHEDULER_CONFIGURATION: |
| 257 | return schedulerConfiguration != null; |
| 258 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__REPLICAS: |
| 259 | return replicas != REPLICAS_EDEFAULT; |
| 260 | case ConfigurationPackage.ACTIVE_RESOURCE_CONFIGURATION__NAME: |
| 261 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| 262 | } |
| 263 | return super.eIsSet(featureID); |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * <!-- begin-user-doc --> |
| 268 | * <!-- end-user-doc --> |
| 269 | * @generated |
| 270 | */ |
| 271 | @Override |
| 272 | public String toString() { |
| 273 | if (eIsProxy()) return super.toString(); |
| 274 | |
| 275 | StringBuffer result = new StringBuffer(super.toString()); |
| 276 | result.append(" (replicas: "); |
| 277 | result.append(replicas); |
| 278 | result.append(", name: "); |
| 279 | result.append(name); |
| 280 | result.append(')'); |
| 281 | return result.toString(); |
| 282 | } |
| 283 | |
| 284 | } //ActiveResourceConfigurationImpl |