1
2
3
4
5
6 package org.mod4j.crossx.mm.crossx.impl;
7
8 import java.util.Collection;
9
10 import org.eclipse.emf.common.notify.Notification;
11 import org.eclipse.emf.common.notify.NotificationChain;
12
13 import org.eclipse.emf.common.util.EList;
14
15 import org.eclipse.emf.ecore.EClass;
16 import org.eclipse.emf.ecore.InternalEObject;
17
18 import org.eclipse.emf.ecore.impl.ENotificationImpl;
19 import org.eclipse.emf.ecore.impl.EObjectImpl;
20
21 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
22 import org.eclipse.emf.ecore.util.InternalEList;
23
24 import org.mod4j.crossx.mm.crossx.CrossxPackage;
25 import org.mod4j.crossx.mm.crossx.SymbolProperty;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 public class SymbolPropertyImpl extends EObjectImpl implements SymbolProperty {
42
43
44
45
46
47
48
49
50 protected static final String NAME_EDEFAULT = null;
51
52
53
54
55
56
57
58
59
60 protected String name = NAME_EDEFAULT;
61
62
63
64
65
66
67
68
69
70 protected EList<SymbolProperty> subProperties;
71
72
73
74
75
76
77 protected SymbolPropertyImpl() {
78 super();
79 }
80
81
82
83
84
85
86 @Override
87 protected EClass eStaticClass() {
88 return CrossxPackage.Literals.SYMBOL_PROPERTY;
89 }
90
91
92
93
94
95
96 public String getName() {
97 return name;
98 }
99
100
101
102
103
104
105 public void setName(String newName) {
106 String oldName = name;
107 name = newName;
108 if (eNotificationRequired())
109 eNotify(new ENotificationImpl(this, Notification.SET, CrossxPackage.SYMBOL_PROPERTY__NAME, oldName, name));
110 }
111
112
113
114
115
116
117 public EList<SymbolProperty> getSubProperties() {
118 if (subProperties == null) {
119 subProperties = new EObjectContainmentEList<SymbolProperty>(SymbolProperty.class, this, CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES);
120 }
121 return subProperties;
122 }
123
124
125
126
127
128
129 @Override
130 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
131 switch (featureID) {
132 case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
133 return ((InternalEList<?>)getSubProperties()).basicRemove(otherEnd, msgs);
134 }
135 return super.eInverseRemove(otherEnd, featureID, msgs);
136 }
137
138
139
140
141
142
143 @Override
144 public Object eGet(int featureID, boolean resolve, boolean coreType) {
145 switch (featureID) {
146 case CrossxPackage.SYMBOL_PROPERTY__NAME:
147 return getName();
148 case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
149 return getSubProperties();
150 }
151 return super.eGet(featureID, resolve, coreType);
152 }
153
154
155
156
157
158
159 @SuppressWarnings("unchecked")
160 @Override
161 public void eSet(int featureID, Object newValue) {
162 switch (featureID) {
163 case CrossxPackage.SYMBOL_PROPERTY__NAME:
164 setName((String)newValue);
165 return;
166 case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
167 getSubProperties().clear();
168 getSubProperties().addAll((Collection<? extends SymbolProperty>)newValue);
169 return;
170 }
171 super.eSet(featureID, newValue);
172 }
173
174
175
176
177
178
179 @Override
180 public void eUnset(int featureID) {
181 switch (featureID) {
182 case CrossxPackage.SYMBOL_PROPERTY__NAME:
183 setName(NAME_EDEFAULT);
184 return;
185 case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
186 getSubProperties().clear();
187 return;
188 }
189 super.eUnset(featureID);
190 }
191
192
193
194
195
196
197 @Override
198 public boolean eIsSet(int featureID) {
199 switch (featureID) {
200 case CrossxPackage.SYMBOL_PROPERTY__NAME:
201 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
202 case CrossxPackage.SYMBOL_PROPERTY__SUB_PROPERTIES:
203 return subProperties != null && !subProperties.isEmpty();
204 }
205 return super.eIsSet(featureID);
206 }
207
208
209
210
211
212
213 @Override
214 public String toString() {
215 if (eIsProxy()) return super.toString();
216
217 StringBuffer result = new StringBuffer(super.toString());
218 result.append(" (name: ");
219 result.append(name);
220 result.append(')');
221 return result.toString();
222 }
223
224 }