1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
12 | |
13 | import de.uka.ipd.sdq.featuremodel.IntegerIntervalRange; |
14 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * An implementation of the model object '<em><b>Integer Interval Range</b></em>'. |
19 | * <!-- end-user-doc --> |
20 | * <p> |
21 | * The following features are implemented: |
22 | * <ul> |
23 | * <li>{@link de.uka.ipd.sdq.featuremodel.impl.IntegerIntervalRangeImpl#getTo <em>To</em>}</li> |
24 | * <li>{@link de.uka.ipd.sdq.featuremodel.impl.IntegerIntervalRangeImpl#getFrom <em>From</em>}</li> |
25 | * </ul> |
26 | * </p> |
27 | * |
28 | * @generated |
29 | */ |
30 | public class IntegerIntervalRangeImpl extends IntervalRangeImpl implements IntegerIntervalRange { |
31 | /** |
32 | * The default value of the '{@link #getTo() <em>To</em>}' attribute. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @see #getTo() |
36 | * @generated |
37 | * @ordered |
38 | */ |
39 | protected static final int TO_EDEFAULT = 0; |
40 | |
41 | /** |
42 | * The cached value of the '{@link #getTo() <em>To</em>}' attribute. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @see #getTo() |
46 | * @generated |
47 | * @ordered |
48 | */ |
49 | protected int to = TO_EDEFAULT; |
50 | |
51 | /** |
52 | * The default value of the '{@link #getFrom() <em>From</em>}' attribute. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getFrom() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected static final int FROM_EDEFAULT = 0; |
60 | |
61 | /** |
62 | * The cached value of the '{@link #getFrom() <em>From</em>}' attribute. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @see #getFrom() |
66 | * @generated |
67 | * @ordered |
68 | */ |
69 | protected int from = FROM_EDEFAULT; |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | protected IntegerIntervalRangeImpl() { |
77 | super(); |
78 | } |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | @Override |
86 | protected EClass eStaticClass() { |
87 | return featuremodelPackage.Literals.INTEGER_INTERVAL_RANGE; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | public int getTo() { |
96 | return to; |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | public void setTo(int newTo) { |
105 | int oldTo = to; |
106 | to = newTo; |
107 | if (eNotificationRequired()) |
108 | eNotify(new ENotificationImpl(this, Notification.SET, featuremodelPackage.INTEGER_INTERVAL_RANGE__TO, oldTo, to)); |
109 | } |
110 | |
111 | /** |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | public int getFrom() { |
117 | return from; |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | public void setFrom(int newFrom) { |
126 | int oldFrom = from; |
127 | from = newFrom; |
128 | if (eNotificationRequired()) |
129 | eNotify(new ENotificationImpl(this, Notification.SET, featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM, oldFrom, from)); |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
139 | switch (featureID) { |
140 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__TO: |
141 | return getTo(); |
142 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM: |
143 | return getFrom(); |
144 | } |
145 | return super.eGet(featureID, resolve, coreType); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public void eSet(int featureID, Object newValue) { |
155 | switch (featureID) { |
156 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__TO: |
157 | setTo((Integer)newValue); |
158 | return; |
159 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM: |
160 | setFrom((Integer)newValue); |
161 | return; |
162 | } |
163 | super.eSet(featureID, newValue); |
164 | } |
165 | |
166 | /** |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | @Override |
172 | public void eUnset(int featureID) { |
173 | switch (featureID) { |
174 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__TO: |
175 | setTo(TO_EDEFAULT); |
176 | return; |
177 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM: |
178 | setFrom(FROM_EDEFAULT); |
179 | return; |
180 | } |
181 | super.eUnset(featureID); |
182 | } |
183 | |
184 | /** |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | @Override |
190 | public boolean eIsSet(int featureID) { |
191 | switch (featureID) { |
192 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__TO: |
193 | return to != TO_EDEFAULT; |
194 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM: |
195 | return from != FROM_EDEFAULT; |
196 | } |
197 | return super.eIsSet(featureID); |
198 | } |
199 | |
200 | /** |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | @Override |
206 | public String toString() { |
207 | if (eIsProxy()) return super.toString(); |
208 | |
209 | StringBuffer result = new StringBuffer(super.toString()); |
210 | result.append(" (to: "); |
211 | result.append(to); |
212 | result.append(", from: "); |
213 | result.append(from); |
214 | result.append(')'); |
215 | return result.toString(); |
216 | } |
217 | |
218 | } //IntegerIntervalRangeImpl |