1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package scheduler.configuration.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | import org.eclipse.emf.common.notify.NotificationChain; |
11 | |
12 | import org.eclipse.emf.ecore.EClass; |
13 | import org.eclipse.emf.ecore.InternalEObject; |
14 | |
15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
16 | |
17 | import scheduler.configuration.ConfigurationPackage; |
18 | import scheduler.configuration.LoadBalancing; |
19 | import scheduler.configuration.MultipleQueueConfiguration; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Multiple Queue Configuration</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link scheduler.configuration.impl.MultipleQueueConfigurationImpl#getLoadBalancing <em>Load Balancing</em>}</li> |
29 | * <li>{@link scheduler.configuration.impl.MultipleQueueConfigurationImpl#isInFrontWhenBalancing <em>In Front When Balancing</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class MultipleQueueConfigurationImpl extends QueueingConfigurationImpl implements MultipleQueueConfiguration { |
36 | /** |
37 | * The cached value of the '{@link #getLoadBalancing() <em>Load Balancing</em>}' containment reference. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @see #getLoadBalancing() |
41 | * @generated |
42 | * @ordered |
43 | */ |
44 | protected LoadBalancing loadBalancing; |
45 | |
46 | /** |
47 | * The default value of the '{@link #isInFrontWhenBalancing() <em>In Front When Balancing</em>}' attribute. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @see #isInFrontWhenBalancing() |
51 | * @generated |
52 | * @ordered |
53 | */ |
54 | protected static final boolean IN_FRONT_WHEN_BALANCING_EDEFAULT = true; |
55 | |
56 | /** |
57 | * The cached value of the '{@link #isInFrontWhenBalancing() <em>In Front When Balancing</em>}' attribute. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @see #isInFrontWhenBalancing() |
61 | * @generated |
62 | * @ordered |
63 | */ |
64 | protected boolean inFrontWhenBalancing = IN_FRONT_WHEN_BALANCING_EDEFAULT; |
65 | |
66 | /** |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | protected MultipleQueueConfigurationImpl() { |
72 | super(); |
73 | } |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | @Override |
81 | protected EClass eStaticClass() { |
82 | return ConfigurationPackage.Literals.MULTIPLE_QUEUE_CONFIGURATION; |
83 | } |
84 | |
85 | /** |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | public LoadBalancing getLoadBalancing() { |
91 | return loadBalancing; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | public NotificationChain basicSetLoadBalancing(LoadBalancing newLoadBalancing, NotificationChain msgs) { |
100 | LoadBalancing oldLoadBalancing = loadBalancing; |
101 | loadBalancing = newLoadBalancing; |
102 | if (eNotificationRequired()) { |
103 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING, oldLoadBalancing, newLoadBalancing); |
104 | if (msgs == null) msgs = notification; else msgs.add(notification); |
105 | } |
106 | return msgs; |
107 | } |
108 | |
109 | /** |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | public void setLoadBalancing(LoadBalancing newLoadBalancing) { |
115 | if (newLoadBalancing != loadBalancing) { |
116 | NotificationChain msgs = null; |
117 | if (loadBalancing != null) |
118 | msgs = ((InternalEObject)loadBalancing).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING, null, msgs); |
119 | if (newLoadBalancing != null) |
120 | msgs = ((InternalEObject)newLoadBalancing).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING, null, msgs); |
121 | msgs = basicSetLoadBalancing(newLoadBalancing, msgs); |
122 | if (msgs != null) msgs.dispatch(); |
123 | } |
124 | else if (eNotificationRequired()) |
125 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING, newLoadBalancing, newLoadBalancing)); |
126 | } |
127 | |
128 | /** |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | public boolean isInFrontWhenBalancing() { |
134 | return inFrontWhenBalancing; |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | public void setInFrontWhenBalancing(boolean newInFrontWhenBalancing) { |
143 | boolean oldInFrontWhenBalancing = inFrontWhenBalancing; |
144 | inFrontWhenBalancing = newInFrontWhenBalancing; |
145 | if (eNotificationRequired()) |
146 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__IN_FRONT_WHEN_BALANCING, oldInFrontWhenBalancing, inFrontWhenBalancing)); |
147 | } |
148 | |
149 | /** |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
156 | switch (featureID) { |
157 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING: |
158 | return basicSetLoadBalancing(null, msgs); |
159 | } |
160 | return super.eInverseRemove(otherEnd, featureID, msgs); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
170 | switch (featureID) { |
171 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING: |
172 | return getLoadBalancing(); |
173 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__IN_FRONT_WHEN_BALANCING: |
174 | return isInFrontWhenBalancing(); |
175 | } |
176 | return super.eGet(featureID, resolve, coreType); |
177 | } |
178 | |
179 | /** |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public void eSet(int featureID, Object newValue) { |
186 | switch (featureID) { |
187 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING: |
188 | setLoadBalancing((LoadBalancing)newValue); |
189 | return; |
190 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__IN_FRONT_WHEN_BALANCING: |
191 | setInFrontWhenBalancing((Boolean)newValue); |
192 | return; |
193 | } |
194 | super.eSet(featureID, newValue); |
195 | } |
196 | |
197 | /** |
198 | * <!-- begin-user-doc --> |
199 | * <!-- end-user-doc --> |
200 | * @generated |
201 | */ |
202 | @Override |
203 | public void eUnset(int featureID) { |
204 | switch (featureID) { |
205 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING: |
206 | setLoadBalancing((LoadBalancing)null); |
207 | return; |
208 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__IN_FRONT_WHEN_BALANCING: |
209 | setInFrontWhenBalancing(IN_FRONT_WHEN_BALANCING_EDEFAULT); |
210 | return; |
211 | } |
212 | super.eUnset(featureID); |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @Override |
221 | public boolean eIsSet(int featureID) { |
222 | switch (featureID) { |
223 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__LOAD_BALANCING: |
224 | return loadBalancing != null; |
225 | case ConfigurationPackage.MULTIPLE_QUEUE_CONFIGURATION__IN_FRONT_WHEN_BALANCING: |
226 | return inFrontWhenBalancing != IN_FRONT_WHEN_BALANCING_EDEFAULT; |
227 | } |
228 | return super.eIsSet(featureID); |
229 | } |
230 | |
231 | /** |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | @Override |
237 | public String toString() { |
238 | if (eIsProxy()) return super.toString(); |
239 | |
240 | StringBuffer result = new StringBuffer(super.toString()); |
241 | result.append(" (InFrontWhenBalancing: "); |
242 | result.append(inFrontWhenBalancing); |
243 | result.append(')'); |
244 | return result.toString(); |
245 | } |
246 | |
247 | } //MultipleQueueConfigurationImpl |