001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.config.impl;
008
009 import org.eclipse.emf.common.notify.Notification;
010 import org.eclipse.emf.ecore.EClass;
011 import org.eclipse.emf.ecore.impl.ENotificationImpl;
012 import org.eclipse.emf.ecore.impl.EObjectImpl;
013
014 import com.hammurapi.config.ConfigPackage;
015 import com.hammurapi.config.Source;
016
017 /**
018 * <!-- begin-user-doc -->
019 * An implementation of the model object '<em><b>Source</b></em>'.
020 * <!-- end-user-doc -->
021 * <p>
022 * The following features are implemented:
023 * <ul>
024 * <li>{@link com.hammurapi.config.impl.SourceImpl#getType <em>Type</em>}</li>
025 * <li>{@link com.hammurapi.config.impl.SourceImpl#getPath <em>Path</em>}</li>
026 * <li>{@link com.hammurapi.config.impl.SourceImpl#getLine <em>Line</em>}</li>
027 * <li>{@link com.hammurapi.config.impl.SourceImpl#getCol <em>Col</em>}</li>
028 * <li>{@link com.hammurapi.config.impl.SourceImpl#getComment <em>Comment</em>}</li>
029 * </ul>
030 * </p>
031 *
032 * @generated
033 */
034 public class SourceImpl extends EObjectImpl implements Source {
035 /**
036 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
037 * <!-- begin-user-doc -->
038 * <!-- end-user-doc -->
039 * @see #getType()
040 * @generated
041 * @ordered
042 */
043 protected static final String TYPE_EDEFAULT = null;
044
045 /**
046 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
047 * <!-- begin-user-doc -->
048 * <!-- end-user-doc -->
049 * @see #getType()
050 * @generated
051 * @ordered
052 */
053 protected String type = TYPE_EDEFAULT;
054
055 /**
056 * The default value of the '{@link #getPath() <em>Path</em>}' attribute.
057 * <!-- begin-user-doc -->
058 * <!-- end-user-doc -->
059 * @see #getPath()
060 * @generated
061 * @ordered
062 */
063 protected static final String PATH_EDEFAULT = null;
064
065 /**
066 * The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
067 * <!-- begin-user-doc -->
068 * <!-- end-user-doc -->
069 * @see #getPath()
070 * @generated
071 * @ordered
072 */
073 protected String path = PATH_EDEFAULT;
074
075 /**
076 * The default value of the '{@link #getLine() <em>Line</em>}' attribute.
077 * <!-- begin-user-doc -->
078 * <!-- end-user-doc -->
079 * @see #getLine()
080 * @generated
081 * @ordered
082 */
083 protected static final int LINE_EDEFAULT = 0;
084
085 /**
086 * The cached value of the '{@link #getLine() <em>Line</em>}' attribute.
087 * <!-- begin-user-doc -->
088 * <!-- end-user-doc -->
089 * @see #getLine()
090 * @generated
091 * @ordered
092 */
093 protected int line = LINE_EDEFAULT;
094
095 /**
096 * The default value of the '{@link #getCol() <em>Col</em>}' attribute.
097 * <!-- begin-user-doc -->
098 * <!-- end-user-doc -->
099 * @see #getCol()
100 * @generated
101 * @ordered
102 */
103 protected static final int COL_EDEFAULT = 0;
104
105 /**
106 * The cached value of the '{@link #getCol() <em>Col</em>}' attribute.
107 * <!-- begin-user-doc -->
108 * <!-- end-user-doc -->
109 * @see #getCol()
110 * @generated
111 * @ordered
112 */
113 protected int col = COL_EDEFAULT;
114
115 /**
116 * The default value of the '{@link #getComment() <em>Comment</em>}' attribute.
117 * <!-- begin-user-doc -->
118 * <!-- end-user-doc -->
119 * @see #getComment()
120 * @generated
121 * @ordered
122 */
123 protected static final String COMMENT_EDEFAULT = null;
124
125 /**
126 * The cached value of the '{@link #getComment() <em>Comment</em>}' attribute.
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @see #getComment()
130 * @generated
131 * @ordered
132 */
133 protected String comment = COMMENT_EDEFAULT;
134
135 /**
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
138 * @generated
139 */
140 protected SourceImpl() {
141 super();
142 }
143
144 /**
145 * <!-- begin-user-doc -->
146 * <!-- end-user-doc -->
147 * @generated
148 */
149 @Override
150 protected EClass eStaticClass() {
151 return ConfigPackage.Literals.SOURCE;
152 }
153
154 /**
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @generated
158 */
159 public String getType() {
160 return type;
161 }
162
163 /**
164 * <!-- begin-user-doc -->
165 * <!-- end-user-doc -->
166 * @generated
167 */
168 public void setType(String newType) {
169 String oldType = type;
170 type = newType;
171 if (eNotificationRequired())
172 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.SOURCE__TYPE, oldType, type));
173 }
174
175 /**
176 * <!-- begin-user-doc -->
177 * <!-- end-user-doc -->
178 * @generated
179 */
180 public String getPath() {
181 return path;
182 }
183
184 /**
185 * <!-- begin-user-doc -->
186 * <!-- end-user-doc -->
187 * @generated
188 */
189 public void setPath(String newPath) {
190 String oldPath = path;
191 path = newPath;
192 if (eNotificationRequired())
193 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.SOURCE__PATH, oldPath, path));
194 }
195
196 /**
197 * <!-- begin-user-doc -->
198 * <!-- end-user-doc -->
199 * @generated
200 */
201 public int getLine() {
202 return line;
203 }
204
205 /**
206 * <!-- begin-user-doc -->
207 * <!-- end-user-doc -->
208 * @generated
209 */
210 public void setLine(int newLine) {
211 int oldLine = line;
212 line = newLine;
213 if (eNotificationRequired())
214 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.SOURCE__LINE, oldLine, line));
215 }
216
217 /**
218 * <!-- begin-user-doc -->
219 * <!-- end-user-doc -->
220 * @generated
221 */
222 public int getCol() {
223 return col;
224 }
225
226 /**
227 * <!-- begin-user-doc -->
228 * <!-- end-user-doc -->
229 * @generated
230 */
231 public void setCol(int newCol) {
232 int oldCol = col;
233 col = newCol;
234 if (eNotificationRequired())
235 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.SOURCE__COL, oldCol, col));
236 }
237
238 /**
239 * <!-- begin-user-doc -->
240 * <!-- end-user-doc -->
241 * @generated
242 */
243 public String getComment() {
244 return comment;
245 }
246
247 /**
248 * <!-- begin-user-doc -->
249 * <!-- end-user-doc -->
250 * @generated
251 */
252 public void setComment(String newComment) {
253 String oldComment = comment;
254 comment = newComment;
255 if (eNotificationRequired())
256 eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.SOURCE__COMMENT, oldComment, comment));
257 }
258
259 /**
260 * <!-- begin-user-doc -->
261 * <!-- end-user-doc -->
262 * @generated
263 */
264 @Override
265 public Object eGet(int featureID, boolean resolve, boolean coreType) {
266 switch (featureID) {
267 case ConfigPackage.SOURCE__TYPE:
268 return getType();
269 case ConfigPackage.SOURCE__PATH:
270 return getPath();
271 case ConfigPackage.SOURCE__LINE:
272 return getLine();
273 case ConfigPackage.SOURCE__COL:
274 return getCol();
275 case ConfigPackage.SOURCE__COMMENT:
276 return getComment();
277 }
278 return super.eGet(featureID, resolve, coreType);
279 }
280
281 /**
282 * <!-- begin-user-doc -->
283 * <!-- end-user-doc -->
284 * @generated
285 */
286 @Override
287 public void eSet(int featureID, Object newValue) {
288 switch (featureID) {
289 case ConfigPackage.SOURCE__TYPE:
290 setType((String)newValue);
291 return;
292 case ConfigPackage.SOURCE__PATH:
293 setPath((String)newValue);
294 return;
295 case ConfigPackage.SOURCE__LINE:
296 setLine((Integer)newValue);
297 return;
298 case ConfigPackage.SOURCE__COL:
299 setCol((Integer)newValue);
300 return;
301 case ConfigPackage.SOURCE__COMMENT:
302 setComment((String)newValue);
303 return;
304 }
305 super.eSet(featureID, newValue);
306 }
307
308 /**
309 * <!-- begin-user-doc -->
310 * <!-- end-user-doc -->
311 * @generated
312 */
313 @Override
314 public void eUnset(int featureID) {
315 switch (featureID) {
316 case ConfigPackage.SOURCE__TYPE:
317 setType(TYPE_EDEFAULT);
318 return;
319 case ConfigPackage.SOURCE__PATH:
320 setPath(PATH_EDEFAULT);
321 return;
322 case ConfigPackage.SOURCE__LINE:
323 setLine(LINE_EDEFAULT);
324 return;
325 case ConfigPackage.SOURCE__COL:
326 setCol(COL_EDEFAULT);
327 return;
328 case ConfigPackage.SOURCE__COMMENT:
329 setComment(COMMENT_EDEFAULT);
330 return;
331 }
332 super.eUnset(featureID);
333 }
334
335 /**
336 * <!-- begin-user-doc -->
337 * <!-- end-user-doc -->
338 * @generated
339 */
340 @Override
341 public boolean eIsSet(int featureID) {
342 switch (featureID) {
343 case ConfigPackage.SOURCE__TYPE:
344 return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
345 case ConfigPackage.SOURCE__PATH:
346 return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
347 case ConfigPackage.SOURCE__LINE:
348 return line != LINE_EDEFAULT;
349 case ConfigPackage.SOURCE__COL:
350 return col != COL_EDEFAULT;
351 case ConfigPackage.SOURCE__COMMENT:
352 return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment);
353 }
354 return super.eIsSet(featureID);
355 }
356
357 /**
358 * <!-- begin-user-doc -->
359 * <!-- end-user-doc -->
360 * @generated
361 */
362 @Override
363 public String toString() {
364 if (eIsProxy()) return super.toString();
365
366 StringBuffer result = new StringBuffer(super.toString());
367 result.append(" (type: ");
368 result.append(type);
369 result.append(", path: ");
370 result.append(path);
371 result.append(", line: ");
372 result.append(line);
373 result.append(", col: ");
374 result.append(col);
375 result.append(", comment: ");
376 result.append(comment);
377 result.append(')');
378 return result.toString();
379 }
380
381 } //SourceImpl