/org.eclipse.xtext.example.fj/src-gen/org/eclipse/xtext/example/fj/impl/TypedElementImpl.java
Java | 268 lines | 138 code | 22 blank | 108 comment | 24 complexity | b7167ee14b48e5ddf195b22084c0a7cc MD5 | raw file
1/**
2 * <copyright>
3 * </copyright>
4 *
5 */
6package org.eclipse.xtext.example.fj.impl;
7
8import org.eclipse.emf.common.notify.Notification;
9import org.eclipse.emf.common.notify.NotificationChain;
10
11import org.eclipse.emf.ecore.EClass;
12import org.eclipse.emf.ecore.InternalEObject;
13
14import org.eclipse.emf.ecore.impl.ENotificationImpl;
15import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
16
17import org.eclipse.xtext.example.fj.FjPackage;
18import org.eclipse.xtext.example.fj.Type;
19import org.eclipse.xtext.example.fj.TypedElement;
20
21/**
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Typed Element</b></em>'.
24 * <!-- end-user-doc -->
25 * <p>
26 * The following features are implemented:
27 * <ul>
28 * <li>{@link org.eclipse.xtext.example.fj.impl.TypedElementImpl#getType <em>Type</em>}</li>
29 * <li>{@link org.eclipse.xtext.example.fj.impl.TypedElementImpl#getName <em>Name</em>}</li>
30 * </ul>
31 * </p>
32 *
33 * @generated
34 */
35public class TypedElementImpl extends MinimalEObjectImpl.Container implements TypedElement
36{
37 /**
38 * The cached value of the '{@link #getType() <em>Type</em>}' containment reference.
39 * <!-- begin-user-doc -->
40 * <!-- end-user-doc -->
41 * @see #getType()
42 * @generated
43 * @ordered
44 */
45 protected Type type;
46
47 /**
48 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
49 * <!-- begin-user-doc -->
50 * <!-- end-user-doc -->
51 * @see #getName()
52 * @generated
53 * @ordered
54 */
55 protected static final String NAME_EDEFAULT = null;
56
57 /**
58 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
59 * <!-- begin-user-doc -->
60 * <!-- end-user-doc -->
61 * @see #getName()
62 * @generated
63 * @ordered
64 */
65 protected String name = NAME_EDEFAULT;
66
67 /**
68 * <!-- begin-user-doc -->
69 * <!-- end-user-doc -->
70 * @generated
71 */
72 protected TypedElementImpl()
73 {
74 super();
75 }
76
77 /**
78 * <!-- begin-user-doc -->
79 * <!-- end-user-doc -->
80 * @generated
81 */
82 @Override
83 protected EClass eStaticClass()
84 {
85 return FjPackage.Literals.TYPED_ELEMENT;
86 }
87
88 /**
89 * <!-- begin-user-doc -->
90 * <!-- end-user-doc -->
91 * @generated
92 */
93 public Type getType()
94 {
95 return type;
96 }
97
98 /**
99 * <!-- begin-user-doc -->
100 * <!-- end-user-doc -->
101 * @generated
102 */
103 public NotificationChain basicSetType(Type newType, NotificationChain msgs)
104 {
105 Type oldType = type;
106 type = newType;
107 if (eNotificationRequired())
108 {
109 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FjPackage.TYPED_ELEMENT__TYPE, oldType, newType);
110 if (msgs == null) msgs = notification; else msgs.add(notification);
111 }
112 return msgs;
113 }
114
115 /**
116 * <!-- begin-user-doc -->
117 * <!-- end-user-doc -->
118 * @generated
119 */
120 public void setType(Type newType)
121 {
122 if (newType != type)
123 {
124 NotificationChain msgs = null;
125 if (type != null)
126 msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FjPackage.TYPED_ELEMENT__TYPE, null, msgs);
127 if (newType != null)
128 msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FjPackage.TYPED_ELEMENT__TYPE, null, msgs);
129 msgs = basicSetType(newType, msgs);
130 if (msgs != null) msgs.dispatch();
131 }
132 else if (eNotificationRequired())
133 eNotify(new ENotificationImpl(this, Notification.SET, FjPackage.TYPED_ELEMENT__TYPE, newType, newType));
134 }
135
136 /**
137 * <!-- begin-user-doc -->
138 * <!-- end-user-doc -->
139 * @generated
140 */
141 public String getName()
142 {
143 return name;
144 }
145
146 /**
147 * <!-- begin-user-doc -->
148 * <!-- end-user-doc -->
149 * @generated
150 */
151 public void setName(String newName)
152 {
153 String oldName = name;
154 name = newName;
155 if (eNotificationRequired())
156 eNotify(new ENotificationImpl(this, Notification.SET, FjPackage.TYPED_ELEMENT__NAME, oldName, name));
157 }
158
159 /**
160 * <!-- begin-user-doc -->
161 * <!-- end-user-doc -->
162 * @generated
163 */
164 @Override
165 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
166 {
167 switch (featureID)
168 {
169 case FjPackage.TYPED_ELEMENT__TYPE:
170 return basicSetType(null, msgs);
171 }
172 return super.eInverseRemove(otherEnd, featureID, msgs);
173 }
174
175 /**
176 * <!-- begin-user-doc -->
177 * <!-- end-user-doc -->
178 * @generated
179 */
180 @Override
181 public Object eGet(int featureID, boolean resolve, boolean coreType)
182 {
183 switch (featureID)
184 {
185 case FjPackage.TYPED_ELEMENT__TYPE:
186 return getType();
187 case FjPackage.TYPED_ELEMENT__NAME:
188 return getName();
189 }
190 return super.eGet(featureID, resolve, coreType);
191 }
192
193 /**
194 * <!-- begin-user-doc -->
195 * <!-- end-user-doc -->
196 * @generated
197 */
198 @Override
199 public void eSet(int featureID, Object newValue)
200 {
201 switch (featureID)
202 {
203 case FjPackage.TYPED_ELEMENT__TYPE:
204 setType((Type)newValue);
205 return;
206 case FjPackage.TYPED_ELEMENT__NAME:
207 setName((String)newValue);
208 return;
209 }
210 super.eSet(featureID, newValue);
211 }
212
213 /**
214 * <!-- begin-user-doc -->
215 * <!-- end-user-doc -->
216 * @generated
217 */
218 @Override
219 public void eUnset(int featureID)
220 {
221 switch (featureID)
222 {
223 case FjPackage.TYPED_ELEMENT__TYPE:
224 setType((Type)null);
225 return;
226 case FjPackage.TYPED_ELEMENT__NAME:
227 setName(NAME_EDEFAULT);
228 return;
229 }
230 super.eUnset(featureID);
231 }
232
233 /**
234 * <!-- begin-user-doc -->
235 * <!-- end-user-doc -->
236 * @generated
237 */
238 @Override
239 public boolean eIsSet(int featureID)
240 {
241 switch (featureID)
242 {
243 case FjPackage.TYPED_ELEMENT__TYPE:
244 return type != null;
245 case FjPackage.TYPED_ELEMENT__NAME:
246 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
247 }
248 return super.eIsSet(featureID);
249 }
250
251 /**
252 * <!-- begin-user-doc -->
253 * <!-- end-user-doc -->
254 * @generated
255 */
256 @Override
257 public String toString()
258 {
259 if (eIsProxy()) return super.toString();
260
261 StringBuffer result = new StringBuffer(super.toString());
262 result.append(" (name: ");
263 result.append(name);
264 result.append(')');
265 return result.toString();
266 }
267
268} //TypedElementImpl