1
2
3
4
5
6
7 package BusinessDomainDsl.impl;
8
9 import BusinessDomainDsl.BusinessDomainDslPackage;
10 import BusinessDomainDsl.IntegerProperty;
11
12 import org.eclipse.emf.common.notify.Notification;
13
14 import org.eclipse.emf.ecore.EClass;
15
16 import org.eclipse.emf.ecore.impl.ENotificationImpl;
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 public class IntegerPropertyImpl extends PropertyImpl implements IntegerProperty {
34
35
36
37
38
39
40
41
42 protected static final int MIN_VALUE_EDEFAULT = -2147483648;
43
44
45
46
47
48
49
50
51
52 protected int minValue = MIN_VALUE_EDEFAULT;
53
54
55
56
57
58
59
60
61
62 protected static final int MAX_VALUE_EDEFAULT = 2147483647;
63
64
65
66
67
68
69
70
71
72 protected int maxValue = MAX_VALUE_EDEFAULT;
73
74
75
76
77
78
79
80
81
82 protected static final int DEFAULT_VALUE_EDEFAULT = 0;
83
84
85
86
87
88
89
90
91
92 protected int defaultValue = DEFAULT_VALUE_EDEFAULT;
93
94
95
96
97
98
99 protected IntegerPropertyImpl() {
100 super();
101 }
102
103
104
105
106
107
108 @Override
109 protected EClass eStaticClass() {
110 return BusinessDomainDslPackage.Literals.INTEGER_PROPERTY;
111 }
112
113
114
115
116
117
118 public int getMinValue() {
119 return minValue;
120 }
121
122
123
124
125
126
127 public void setMinValue(int newMinValue) {
128 int oldMinValue = minValue;
129 minValue = newMinValue;
130 if (eNotificationRequired())
131 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.INTEGER_PROPERTY__MIN_VALUE, oldMinValue, minValue));
132 }
133
134
135
136
137
138
139 public int getMaxValue() {
140 return maxValue;
141 }
142
143
144
145
146
147
148 public void setMaxValue(int newMaxValue) {
149 int oldMaxValue = maxValue;
150 maxValue = newMaxValue;
151 if (eNotificationRequired())
152 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.INTEGER_PROPERTY__MAX_VALUE, oldMaxValue, maxValue));
153 }
154
155
156
157
158
159
160 public int getDefaultValue() {
161 return defaultValue;
162 }
163
164
165
166
167
168
169 public void setDefaultValue(int newDefaultValue) {
170 int oldDefaultValue = defaultValue;
171 defaultValue = newDefaultValue;
172 if (eNotificationRequired())
173 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.INTEGER_PROPERTY__DEFAULT_VALUE, oldDefaultValue, defaultValue));
174 }
175
176
177
178
179
180
181 @Override
182 public Object eGet(int featureID, boolean resolve, boolean coreType) {
183 switch (featureID) {
184 case BusinessDomainDslPackage.INTEGER_PROPERTY__MIN_VALUE:
185 return getMinValue();
186 case BusinessDomainDslPackage.INTEGER_PROPERTY__MAX_VALUE:
187 return getMaxValue();
188 case BusinessDomainDslPackage.INTEGER_PROPERTY__DEFAULT_VALUE:
189 return getDefaultValue();
190 }
191 return super.eGet(featureID, resolve, coreType);
192 }
193
194
195
196
197
198
199 @Override
200 public void eSet(int featureID, Object newValue) {
201 switch (featureID) {
202 case BusinessDomainDslPackage.INTEGER_PROPERTY__MIN_VALUE:
203 setMinValue((Integer)newValue);
204 return;
205 case BusinessDomainDslPackage.INTEGER_PROPERTY__MAX_VALUE:
206 setMaxValue((Integer)newValue);
207 return;
208 case BusinessDomainDslPackage.INTEGER_PROPERTY__DEFAULT_VALUE:
209 setDefaultValue((Integer)newValue);
210 return;
211 }
212 super.eSet(featureID, newValue);
213 }
214
215
216
217
218
219
220 @Override
221 public void eUnset(int featureID) {
222 switch (featureID) {
223 case BusinessDomainDslPackage.INTEGER_PROPERTY__MIN_VALUE:
224 setMinValue(MIN_VALUE_EDEFAULT);
225 return;
226 case BusinessDomainDslPackage.INTEGER_PROPERTY__MAX_VALUE:
227 setMaxValue(MAX_VALUE_EDEFAULT);
228 return;
229 case BusinessDomainDslPackage.INTEGER_PROPERTY__DEFAULT_VALUE:
230 setDefaultValue(DEFAULT_VALUE_EDEFAULT);
231 return;
232 }
233 super.eUnset(featureID);
234 }
235
236
237
238
239
240
241 @Override
242 public boolean eIsSet(int featureID) {
243 switch (featureID) {
244 case BusinessDomainDslPackage.INTEGER_PROPERTY__MIN_VALUE:
245 return minValue != MIN_VALUE_EDEFAULT;
246 case BusinessDomainDslPackage.INTEGER_PROPERTY__MAX_VALUE:
247 return maxValue != MAX_VALUE_EDEFAULT;
248 case BusinessDomainDslPackage.INTEGER_PROPERTY__DEFAULT_VALUE:
249 return defaultValue != DEFAULT_VALUE_EDEFAULT;
250 }
251 return super.eIsSet(featureID);
252 }
253
254
255
256
257
258
259 @Override
260 public String toString() {
261 if (eIsProxy()) return super.toString();
262
263 StringBuffer result = new StringBuffer(super.toString());
264 result.append(" (minValue: ");
265 result.append(minValue);
266 result.append(", maxValue: ");
267 result.append(maxValue);
268 result.append(", defaultValue: ");
269 result.append(defaultValue);
270 result.append(')');
271 return result.toString();
272 }
273
274 }