/org.eclipse.xtext.example.fj/src-gen/org/eclipse/xtext/example/fj/impl/TypedElementImpl.java

https://bitbucket.org/gcubar/fj-eclipse · Java · 268 lines · 138 code · 22 blank · 108 comment · 24 complexity · b7167ee14b48e5ddf195b22084c0a7cc MD5 · raw file

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