1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.impl; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EnumRangeValueType; |
10 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.QMLContractPackage; |
11 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.RangeValue; |
12 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.ValueLiteral; |
13 | |
14 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
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>Range Value</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.contract.QMLContract.impl.RangeValueImpl#getRangeLimitLiteral <em>Range Limit Literal</em>}</li> |
32 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.impl.RangeValueImpl#getType <em>Type</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public class RangeValueImpl extends IdentifierImpl implements RangeValue { |
39 | /** |
40 | * The cached value of the '{@link #getRangeLimitLiteral() <em>Range Limit Literal</em>}' containment reference. |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @see #getRangeLimitLiteral() |
44 | * @generated |
45 | * @ordered |
46 | */ |
47 | protected ValueLiteral rangeLimitLiteral; |
48 | |
49 | /** |
50 | * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getType() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected static final EnumRangeValueType TYPE_EDEFAULT = EnumRangeValueType.INCLUSIVE; |
58 | |
59 | /** |
60 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getType() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected EnumRangeValueType type = TYPE_EDEFAULT; |
68 | |
69 | /** |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | protected RangeValueImpl() { |
75 | super(); |
76 | } |
77 | |
78 | /** |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | @Override |
84 | protected EClass eStaticClass() { |
85 | return QMLContractPackage.Literals.RANGE_VALUE; |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | public ValueLiteral getRangeLimitLiteral() { |
94 | return rangeLimitLiteral; |
95 | } |
96 | |
97 | /** |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | public NotificationChain basicSetRangeLimitLiteral(ValueLiteral newRangeLimitLiteral, NotificationChain msgs) { |
103 | ValueLiteral oldRangeLimitLiteral = rangeLimitLiteral; |
104 | rangeLimitLiteral = newRangeLimitLiteral; |
105 | if (eNotificationRequired()) { |
106 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL, oldRangeLimitLiteral, newRangeLimitLiteral); |
107 | if (msgs == null) msgs = notification; else msgs.add(notification); |
108 | } |
109 | return msgs; |
110 | } |
111 | |
112 | /** |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | public void setRangeLimitLiteral(ValueLiteral newRangeLimitLiteral) { |
118 | if (newRangeLimitLiteral != rangeLimitLiteral) { |
119 | NotificationChain msgs = null; |
120 | if (rangeLimitLiteral != null) |
121 | msgs = ((InternalEObject)rangeLimitLiteral).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL, null, msgs); |
122 | if (newRangeLimitLiteral != null) |
123 | msgs = ((InternalEObject)newRangeLimitLiteral).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL, null, msgs); |
124 | msgs = basicSetRangeLimitLiteral(newRangeLimitLiteral, msgs); |
125 | if (msgs != null) msgs.dispatch(); |
126 | } |
127 | else if (eNotificationRequired()) |
128 | eNotify(new ENotificationImpl(this, Notification.SET, QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL, newRangeLimitLiteral, newRangeLimitLiteral)); |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | public EnumRangeValueType getType() { |
137 | return type; |
138 | } |
139 | |
140 | /** |
141 | * <!-- begin-user-doc --> |
142 | * <!-- end-user-doc --> |
143 | * @generated |
144 | */ |
145 | public void setType(EnumRangeValueType newType) { |
146 | EnumRangeValueType oldType = type; |
147 | type = newType == null ? TYPE_EDEFAULT : newType; |
148 | if (eNotificationRequired()) |
149 | eNotify(new ENotificationImpl(this, Notification.SET, QMLContractPackage.RANGE_VALUE__TYPE, oldType, type)); |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @Override |
158 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
159 | switch (featureID) { |
160 | case QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL: |
161 | return basicSetRangeLimitLiteral(null, msgs); |
162 | } |
163 | return super.eInverseRemove(otherEnd, featureID, msgs); |
164 | } |
165 | |
166 | /** |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | @Override |
172 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
173 | switch (featureID) { |
174 | case QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL: |
175 | return getRangeLimitLiteral(); |
176 | case QMLContractPackage.RANGE_VALUE__TYPE: |
177 | return getType(); |
178 | } |
179 | return super.eGet(featureID, resolve, coreType); |
180 | } |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | @Override |
188 | public void eSet(int featureID, Object newValue) { |
189 | switch (featureID) { |
190 | case QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL: |
191 | setRangeLimitLiteral((ValueLiteral)newValue); |
192 | return; |
193 | case QMLContractPackage.RANGE_VALUE__TYPE: |
194 | setType((EnumRangeValueType)newValue); |
195 | return; |
196 | } |
197 | super.eSet(featureID, newValue); |
198 | } |
199 | |
200 | /** |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | @Override |
206 | public void eUnset(int featureID) { |
207 | switch (featureID) { |
208 | case QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL: |
209 | setRangeLimitLiteral((ValueLiteral)null); |
210 | return; |
211 | case QMLContractPackage.RANGE_VALUE__TYPE: |
212 | setType(TYPE_EDEFAULT); |
213 | return; |
214 | } |
215 | super.eUnset(featureID); |
216 | } |
217 | |
218 | /** |
219 | * <!-- begin-user-doc --> |
220 | * <!-- end-user-doc --> |
221 | * @generated |
222 | */ |
223 | @Override |
224 | public boolean eIsSet(int featureID) { |
225 | switch (featureID) { |
226 | case QMLContractPackage.RANGE_VALUE__RANGE_LIMIT_LITERAL: |
227 | return rangeLimitLiteral != null; |
228 | case QMLContractPackage.RANGE_VALUE__TYPE: |
229 | return type != TYPE_EDEFAULT; |
230 | } |
231 | return super.eIsSet(featureID); |
232 | } |
233 | |
234 | /** |
235 | * <!-- begin-user-doc --> |
236 | * <!-- end-user-doc --> |
237 | * @generated |
238 | */ |
239 | @Override |
240 | public String toString() { |
241 | if (eIsProxy()) return super.toString(); |
242 | |
243 | StringBuffer result = new StringBuffer(super.toString()); |
244 | result.append(" (type: "); |
245 | result.append(type); |
246 | result.append(')'); |
247 | return result.toString(); |
248 | } |
249 | |
250 | } //RangeValueImpl |