001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.impl;
007:
008: import java.util.Collection;
009:
010: import newprocess.Element;
011: import newprocess.EnvEntry;
012: import newprocess.NewprocessPackage;
013:
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.common.notify.NotificationChain;
016:
017: import org.eclipse.emf.common.util.EList;
018:
019: import org.eclipse.emf.ecore.EClass;
020: import org.eclipse.emf.ecore.InternalEObject;
021:
022: import org.eclipse.emf.ecore.impl.ENotificationImpl;
023: import org.eclipse.emf.ecore.impl.EObjectImpl;
024:
025: import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
026: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
027: import org.eclipse.emf.ecore.util.InternalEList;
028:
029: /**
030: * <!-- begin-user-doc -->
031: * An implementation of the model object '<em><b>Element</b></em>'.
032: * <!-- end-user-doc -->
033: * <p>
034: * The following features are implemented:
035: * <ul>
036: * <li>{@link newprocess.impl.ElementImpl#getName <em>Name</em>}</li>
037: * <li>{@link newprocess.impl.ElementImpl#getDescription <em>Description</em>}</li>
038: * <li>{@link newprocess.impl.ElementImpl#getImplementation <em>Implementation</em>}</li>
039: * <li>{@link newprocess.impl.ElementImpl#getUrl <em>Url</em>}</li>
040: * <li>{@link newprocess.impl.ElementImpl#getId <em>Id</em>}</li>
041: * <li>{@link newprocess.impl.ElementImpl#getHasEnvEntries <em>Has Env Entries</em>}</li>
042: * </ul>
043: * </p>
044: *
045: * @generated
046: */
047: public class ElementImpl extends EObjectImpl implements Element {
048: /**
049: * The default value of the '{@link #getName() <em>Name</em>}' attribute.
050: * <!-- begin-user-doc -->
051: * <!-- end-user-doc -->
052: * @see #getName()
053: * @generated
054: * @ordered
055: */
056: protected static final String NAME_EDEFAULT = null;
057:
058: /**
059: * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
060: * <!-- begin-user-doc -->
061: * <!-- end-user-doc -->
062: * @see #getName()
063: * @generated
064: * @ordered
065: */
066: protected String name = NAME_EDEFAULT;
067:
068: /**
069: * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
070: * <!-- begin-user-doc -->
071: * <!-- end-user-doc -->
072: * @see #getDescription()
073: * @generated
074: * @ordered
075: */
076: protected static final String DESCRIPTION_EDEFAULT = null;
077:
078: /**
079: * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
080: * <!-- begin-user-doc -->
081: * <!-- end-user-doc -->
082: * @see #getDescription()
083: * @generated
084: * @ordered
085: */
086: protected String description = DESCRIPTION_EDEFAULT;
087:
088: /**
089: * The default value of the '{@link #getImplementation() <em>Implementation</em>}' attribute.
090: * <!-- begin-user-doc -->
091: * <!-- end-user-doc -->
092: * @see #getImplementation()
093: * @generated
094: * @ordered
095: */
096: protected static final String IMPLEMENTATION_EDEFAULT = null;
097:
098: /**
099: * The cached value of the '{@link #getImplementation() <em>Implementation</em>}' attribute.
100: * <!-- begin-user-doc -->
101: * <!-- end-user-doc -->
102: * @see #getImplementation()
103: * @generated
104: * @ordered
105: */
106: protected String implementation = IMPLEMENTATION_EDEFAULT;
107:
108: /**
109: * The cached value of the '{@link #getUrl() <em>Url</em>}' attribute list.
110: * <!-- begin-user-doc -->
111: * <!-- end-user-doc -->
112: * @see #getUrl()
113: * @generated
114: * @ordered
115: */
116: protected EList<String> url = null;
117:
118: /**
119: * The default value of the '{@link #getId() <em>Id</em>}' attribute.
120: * <!-- begin-user-doc -->
121: * <!-- end-user-doc -->
122: * @see #getId()
123: * @generated
124: * @ordered
125: */
126: protected static final String ID_EDEFAULT = null;
127:
128: /**
129: * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
130: * <!-- begin-user-doc -->
131: * <!-- end-user-doc -->
132: * @see #getId()
133: * @generated
134: * @ordered
135: */
136: protected String id = ID_EDEFAULT;
137:
138: /**
139: * The cached value of the '{@link #getHasEnvEntries() <em>Has Env Entries</em>}' containment reference list.
140: * <!-- begin-user-doc -->
141: * <!-- end-user-doc -->
142: * @see #getHasEnvEntries()
143: * @generated
144: * @ordered
145: */
146: protected EList<EnvEntry> hasEnvEntries = null;
147:
148: /**
149: * <!-- begin-user-doc -->
150: * <!-- end-user-doc -->
151: * @generated
152: */
153: protected ElementImpl() {
154: super ();
155: }
156:
157: /**
158: * <!-- begin-user-doc -->
159: * <!-- end-user-doc -->
160: * @generated
161: */
162: @Override
163: protected EClass eStaticClass() {
164: return NewprocessPackage.Literals.ELEMENT;
165: }
166:
167: /**
168: * <!-- begin-user-doc -->
169: * <!-- end-user-doc -->
170: * @generated
171: */
172: public String getName() {
173: return name;
174: }
175:
176: /**
177: * <!-- begin-user-doc -->
178: * <!-- end-user-doc -->
179: * @generated
180: */
181: public void setName(String newName) {
182: String oldName = name;
183: name = newName;
184: if (eNotificationRequired())
185: eNotify(new ENotificationImpl(this , Notification.SET,
186: NewprocessPackage.ELEMENT__NAME, oldName, name));
187: }
188:
189: /**
190: * <!-- begin-user-doc -->
191: * <!-- end-user-doc -->
192: * @generated
193: */
194: public String getDescription() {
195: return description;
196: }
197:
198: /**
199: * <!-- begin-user-doc -->
200: * <!-- end-user-doc -->
201: * @generated
202: */
203: public void setDescription(String newDescription) {
204: String oldDescription = description;
205: description = newDescription;
206: if (eNotificationRequired())
207: eNotify(new ENotificationImpl(this , Notification.SET,
208: NewprocessPackage.ELEMENT__DESCRIPTION,
209: oldDescription, description));
210: }
211:
212: /**
213: * <!-- begin-user-doc -->
214: * <!-- end-user-doc -->
215: * @generated
216: */
217: public String getImplementation() {
218: return implementation;
219: }
220:
221: /**
222: * <!-- begin-user-doc -->
223: * <!-- end-user-doc -->
224: * @generated
225: */
226: public void setImplementation(String newImplementation) {
227: String oldImplementation = implementation;
228: implementation = newImplementation;
229: if (eNotificationRequired())
230: eNotify(new ENotificationImpl(this , Notification.SET,
231: NewprocessPackage.ELEMENT__IMPLEMENTATION,
232: oldImplementation, implementation));
233: }
234:
235: /**
236: * <!-- begin-user-doc -->
237: * <!-- end-user-doc -->
238: * @generated
239: */
240: public EList<String> getUrl() {
241: if (url == null) {
242: url = new EDataTypeUniqueEList<String>(String.class, this ,
243: NewprocessPackage.ELEMENT__URL);
244: }
245: return url;
246: }
247:
248: /**
249: * <!-- begin-user-doc -->
250: * <!-- end-user-doc -->
251: * @generated
252: */
253: public String getId() {
254: return id;
255: }
256:
257: /**
258: * <!-- begin-user-doc -->
259: * <!-- end-user-doc -->
260: * @generated
261: */
262: public void setId(String newId) {
263: String oldId = id;
264: id = newId;
265: if (eNotificationRequired())
266: eNotify(new ENotificationImpl(this , Notification.SET,
267: NewprocessPackage.ELEMENT__ID, oldId, id));
268: }
269:
270: /**
271: * <!-- begin-user-doc -->
272: * <!-- end-user-doc -->
273: * @generated
274: */
275: public EList<EnvEntry> getHasEnvEntries() {
276: if (hasEnvEntries == null) {
277: hasEnvEntries = new EObjectContainmentEList<EnvEntry>(
278: EnvEntry.class, this ,
279: NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES);
280: }
281: return hasEnvEntries;
282: }
283:
284: /**
285: * <!-- begin-user-doc -->
286: * <!-- end-user-doc -->
287: * @generated
288: */
289: @Override
290: public NotificationChain eInverseRemove(InternalEObject otherEnd,
291: int featureID, NotificationChain msgs) {
292: switch (featureID) {
293: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
294: return ((InternalEList<?>) getHasEnvEntries()).basicRemove(
295: otherEnd, msgs);
296: }
297: return super .eInverseRemove(otherEnd, featureID, msgs);
298: }
299:
300: /**
301: * <!-- begin-user-doc -->
302: * <!-- end-user-doc -->
303: * @generated
304: */
305: @Override
306: public Object eGet(int featureID, boolean resolve, boolean coreType) {
307: switch (featureID) {
308: case NewprocessPackage.ELEMENT__NAME:
309: return getName();
310: case NewprocessPackage.ELEMENT__DESCRIPTION:
311: return getDescription();
312: case NewprocessPackage.ELEMENT__IMPLEMENTATION:
313: return getImplementation();
314: case NewprocessPackage.ELEMENT__URL:
315: return getUrl();
316: case NewprocessPackage.ELEMENT__ID:
317: return getId();
318: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
319: return getHasEnvEntries();
320: }
321: return super .eGet(featureID, resolve, coreType);
322: }
323:
324: /**
325: * <!-- begin-user-doc -->
326: * <!-- end-user-doc -->
327: * @generated
328: */
329: @SuppressWarnings("unchecked")
330: @Override
331: public void eSet(int featureID, Object newValue) {
332: switch (featureID) {
333: case NewprocessPackage.ELEMENT__NAME:
334: setName((String) newValue);
335: return;
336: case NewprocessPackage.ELEMENT__DESCRIPTION:
337: setDescription((String) newValue);
338: return;
339: case NewprocessPackage.ELEMENT__IMPLEMENTATION:
340: setImplementation((String) newValue);
341: return;
342: case NewprocessPackage.ELEMENT__URL:
343: getUrl().clear();
344: getUrl().addAll((Collection<? extends String>) newValue);
345: return;
346: case NewprocessPackage.ELEMENT__ID:
347: setId((String) newValue);
348: return;
349: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
350: getHasEnvEntries().clear();
351: getHasEnvEntries().addAll(
352: (Collection<? extends EnvEntry>) newValue);
353: return;
354: }
355: super .eSet(featureID, newValue);
356: }
357:
358: /**
359: * <!-- begin-user-doc -->
360: * <!-- end-user-doc -->
361: * @generated
362: */
363: @Override
364: public void eUnset(int featureID) {
365: switch (featureID) {
366: case NewprocessPackage.ELEMENT__NAME:
367: setName(NAME_EDEFAULT);
368: return;
369: case NewprocessPackage.ELEMENT__DESCRIPTION:
370: setDescription(DESCRIPTION_EDEFAULT);
371: return;
372: case NewprocessPackage.ELEMENT__IMPLEMENTATION:
373: setImplementation(IMPLEMENTATION_EDEFAULT);
374: return;
375: case NewprocessPackage.ELEMENT__URL:
376: getUrl().clear();
377: return;
378: case NewprocessPackage.ELEMENT__ID:
379: setId(ID_EDEFAULT);
380: return;
381: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
382: getHasEnvEntries().clear();
383: return;
384: }
385: super .eUnset(featureID);
386: }
387:
388: /**
389: * <!-- begin-user-doc -->
390: * <!-- end-user-doc -->
391: * @generated
392: */
393: @Override
394: public boolean eIsSet(int featureID) {
395: switch (featureID) {
396: case NewprocessPackage.ELEMENT__NAME:
397: return NAME_EDEFAULT == null ? name != null
398: : !NAME_EDEFAULT.equals(name);
399: case NewprocessPackage.ELEMENT__DESCRIPTION:
400: return DESCRIPTION_EDEFAULT == null ? description != null
401: : !DESCRIPTION_EDEFAULT.equals(description);
402: case NewprocessPackage.ELEMENT__IMPLEMENTATION:
403: return IMPLEMENTATION_EDEFAULT == null ? implementation != null
404: : !IMPLEMENTATION_EDEFAULT.equals(implementation);
405: case NewprocessPackage.ELEMENT__URL:
406: return url != null && !url.isEmpty();
407: case NewprocessPackage.ELEMENT__ID:
408: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT
409: .equals(id);
410: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
411: return hasEnvEntries != null && !hasEnvEntries.isEmpty();
412: }
413: return super .eIsSet(featureID);
414: }
415:
416: /**
417: * <!-- begin-user-doc -->
418: * <!-- end-user-doc -->
419: * @generated
420: */
421: @Override
422: public String toString() {
423: if (eIsProxy())
424: return super .toString();
425:
426: StringBuffer result = new StringBuffer(super .toString());
427: result.append(" (name: ");
428: result.append(name);
429: result.append(", description: ");
430: result.append(description);
431: result.append(", implementation: ");
432: result.append(implementation);
433: result.append(", url: ");
434: result.append(url);
435: result.append(", id: ");
436: result.append(id);
437: result.append(')');
438: return result.toString();
439: }
440:
441: } //ElementImpl
|