1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.impl; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Dimension; |
10 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.DimensionType; |
11 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.QMLContractTypePackage; |
12 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Unit; |
13 | |
14 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
17 | import org.eclipse.emf.common.notify.NotificationChain; |
18 | |
19 | import org.eclipse.emf.ecore.EClass; |
20 | import org.eclipse.emf.ecore.InternalEObject; |
21 | |
22 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
23 | |
24 | /** |
25 | * <!-- begin-user-doc --> |
26 | * An implementation of the model object '<em><b>Dimension</b></em>'. |
27 | * <!-- end-user-doc --> |
28 | * <p> |
29 | * The following features are implemented: |
30 | * <ul> |
31 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.impl.DimensionImpl#getType <em>Type</em>}</li> |
32 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.impl.DimensionImpl#getUnit <em>Unit</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public class DimensionImpl extends EntityImpl implements Dimension { |
39 | /** |
40 | * The cached value of the '{@link #getType() <em>Type</em>}' containment reference. |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @see #getType() |
44 | * @generated |
45 | * @ordered |
46 | */ |
47 | protected DimensionType type; |
48 | |
49 | /** |
50 | * The cached value of the '{@link #getUnit() <em>Unit</em>}' containment reference. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getUnit() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected Unit unit; |
58 | |
59 | /** |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | protected DimensionImpl() { |
65 | super(); |
66 | } |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | @Override |
74 | protected EClass eStaticClass() { |
75 | return QMLContractTypePackage.Literals.DIMENSION; |
76 | } |
77 | |
78 | /** |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | public DimensionType getType() { |
84 | return type; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public NotificationChain basicSetType(DimensionType newType, NotificationChain msgs) { |
93 | DimensionType oldType = type; |
94 | type = newType; |
95 | if (eNotificationRequired()) { |
96 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QMLContractTypePackage.DIMENSION__TYPE, oldType, newType); |
97 | if (msgs == null) msgs = notification; else msgs.add(notification); |
98 | } |
99 | return msgs; |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public void setType(DimensionType newType) { |
108 | if (newType != type) { |
109 | NotificationChain msgs = null; |
110 | if (type != null) |
111 | msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QMLContractTypePackage.DIMENSION__TYPE, null, msgs); |
112 | if (newType != null) |
113 | msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QMLContractTypePackage.DIMENSION__TYPE, null, msgs); |
114 | msgs = basicSetType(newType, msgs); |
115 | if (msgs != null) msgs.dispatch(); |
116 | } |
117 | else if (eNotificationRequired()) |
118 | eNotify(new ENotificationImpl(this, Notification.SET, QMLContractTypePackage.DIMENSION__TYPE, newType, newType)); |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | public Unit getUnit() { |
127 | return unit; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public NotificationChain basicSetUnit(Unit newUnit, NotificationChain msgs) { |
136 | Unit oldUnit = unit; |
137 | unit = newUnit; |
138 | if (eNotificationRequired()) { |
139 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QMLContractTypePackage.DIMENSION__UNIT, oldUnit, newUnit); |
140 | if (msgs == null) msgs = notification; else msgs.add(notification); |
141 | } |
142 | return msgs; |
143 | } |
144 | |
145 | /** |
146 | * <!-- begin-user-doc --> |
147 | * <!-- end-user-doc --> |
148 | * @generated |
149 | */ |
150 | public void setUnit(Unit newUnit) { |
151 | if (newUnit != unit) { |
152 | NotificationChain msgs = null; |
153 | if (unit != null) |
154 | msgs = ((InternalEObject)unit).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QMLContractTypePackage.DIMENSION__UNIT, null, msgs); |
155 | if (newUnit != null) |
156 | msgs = ((InternalEObject)newUnit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QMLContractTypePackage.DIMENSION__UNIT, null, msgs); |
157 | msgs = basicSetUnit(newUnit, msgs); |
158 | if (msgs != null) msgs.dispatch(); |
159 | } |
160 | else if (eNotificationRequired()) |
161 | eNotify(new ENotificationImpl(this, Notification.SET, QMLContractTypePackage.DIMENSION__UNIT, newUnit, newUnit)); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | @Override |
170 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
171 | switch (featureID) { |
172 | case QMLContractTypePackage.DIMENSION__TYPE: |
173 | return basicSetType(null, msgs); |
174 | case QMLContractTypePackage.DIMENSION__UNIT: |
175 | return basicSetUnit(null, msgs); |
176 | } |
177 | return super.eInverseRemove(otherEnd, featureID, msgs); |
178 | } |
179 | |
180 | /** |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
187 | switch (featureID) { |
188 | case QMLContractTypePackage.DIMENSION__TYPE: |
189 | return getType(); |
190 | case QMLContractTypePackage.DIMENSION__UNIT: |
191 | return getUnit(); |
192 | } |
193 | return super.eGet(featureID, resolve, coreType); |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | @Override |
202 | public void eSet(int featureID, Object newValue) { |
203 | switch (featureID) { |
204 | case QMLContractTypePackage.DIMENSION__TYPE: |
205 | setType((DimensionType)newValue); |
206 | return; |
207 | case QMLContractTypePackage.DIMENSION__UNIT: |
208 | setUnit((Unit)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 QMLContractTypePackage.DIMENSION__TYPE: |
223 | setType((DimensionType)null); |
224 | return; |
225 | case QMLContractTypePackage.DIMENSION__UNIT: |
226 | setUnit((Unit)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 QMLContractTypePackage.DIMENSION__TYPE: |
241 | return type != null; |
242 | case QMLContractTypePackage.DIMENSION__UNIT: |
243 | return unit != null; |
244 | } |
245 | return super.eIsSet(featureID); |
246 | } |
247 | |
248 | } //DimensionImpl |