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.NamedElement; |
14 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
15 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
16 | |
17 | /** |
18 | * <!-- begin-user-doc --> |
19 | * An implementation of the model object '<em><b>Named Element</b></em>'. |
20 | * <!-- end-user-doc --> |
21 | * <p> |
22 | * The following features are implemented: |
23 | * <ul> |
24 | * <li>{@link de.uka.ipd.sdq.featuremodel.impl.NamedElementImpl#getName <em>Name</em>}</li> |
25 | * </ul> |
26 | * </p> |
27 | * |
28 | * @generated |
29 | */ |
30 | public abstract class NamedElementImpl extends IdentifierImpl implements NamedElement { |
31 | /** |
32 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @see #getName() |
36 | * @generated |
37 | * @ordered |
38 | */ |
39 | protected static final String NAME_EDEFAULT = null; |
40 | |
41 | /** |
42 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @see #getName() |
46 | * @generated |
47 | * @ordered |
48 | */ |
49 | protected String name = NAME_EDEFAULT; |
50 | |
51 | /** |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | protected NamedElementImpl() { |
57 | super(); |
58 | } |
59 | |
60 | /** |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | protected EClass eStaticClass() { |
67 | return featuremodelPackage.Literals.NAMED_ELEMENT; |
68 | } |
69 | |
70 | /** |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | public String getName() { |
76 | return name; |
77 | } |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | public void setName(String newName) { |
85 | String oldName = name; |
86 | name = newName; |
87 | if (eNotificationRequired()) |
88 | eNotify(new ENotificationImpl(this, Notification.SET, featuremodelPackage.NAMED_ELEMENT__NAME, oldName, name)); |
89 | } |
90 | |
91 | /** |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
98 | switch (featureID) { |
99 | case featuremodelPackage.NAMED_ELEMENT__NAME: |
100 | return getName(); |
101 | } |
102 | return super.eGet(featureID, resolve, coreType); |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public void eSet(int featureID, Object newValue) { |
112 | switch (featureID) { |
113 | case featuremodelPackage.NAMED_ELEMENT__NAME: |
114 | setName((String)newValue); |
115 | return; |
116 | } |
117 | super.eSet(featureID, newValue); |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public void eUnset(int featureID) { |
127 | switch (featureID) { |
128 | case featuremodelPackage.NAMED_ELEMENT__NAME: |
129 | setName(NAME_EDEFAULT); |
130 | return; |
131 | } |
132 | super.eUnset(featureID); |
133 | } |
134 | |
135 | /** |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public boolean eIsSet(int featureID) { |
142 | switch (featureID) { |
143 | case featuremodelPackage.NAMED_ELEMENT__NAME: |
144 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
145 | } |
146 | return super.eIsSet(featureID); |
147 | } |
148 | |
149 | /** |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public String toString() { |
156 | if (eIsProxy()) return super.toString(); |
157 | |
158 | StringBuffer result = new StringBuffer(super.toString()); |
159 | result.append(" (name: "); |
160 | result.append(name); |
161 | result.append(')'); |
162 | return result.toString(); |
163 | } |
164 | |
165 | } //NamedElementImpl |