PortAdaptationImpl.java 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /**
  2. */
  3. package ua.ansymo.hintco.impl;
  4. import java.lang.reflect.InvocationTargetException;
  5. import org.eclipse.emf.common.notify.Notification;
  6. import org.eclipse.emf.common.notify.NotificationChain;
  7. import org.eclipse.emf.common.util.EList;
  8. import org.eclipse.emf.ecore.EClass;
  9. import org.eclipse.emf.ecore.InternalEObject;
  10. import org.eclipse.emf.ecore.impl.ENotificationImpl;
  11. import org.eclipse.emf.ecore.util.EcoreUtil;
  12. import ua.ansymo.hintco.DecompositionPortAdaptation;
  13. import ua.ansymo.hintco.HintcoPackage;
  14. import ua.ansymo.hintco.PortAdaptation;
  15. import ua.ansymo.hintco.PortInstance;
  16. /**
  17. * <!-- begin-user-doc -->
  18. * An implementation of the model object '<em><b>Port Adaptation</b></em>'.
  19. * <!-- end-user-doc -->
  20. * <p>
  21. * The following features are implemented:
  22. * </p>
  23. * <ul>
  24. * <li>{@link ua.ansymo.hintco.impl.PortAdaptationImpl#getPort <em>Port</em>}</li>
  25. * <li>{@link ua.ansymo.hintco.impl.PortAdaptationImpl#getParent <em>Parent</em>}</li>
  26. * </ul>
  27. *
  28. * @generated
  29. */
  30. public abstract class PortAdaptationImpl extends AdaptationImpl implements PortAdaptation {
  31. /**
  32. * <!-- begin-user-doc -->
  33. * <!-- end-user-doc -->
  34. * @generated
  35. */
  36. protected PortAdaptationImpl() {
  37. super();
  38. }
  39. /**
  40. * <!-- begin-user-doc -->
  41. * <!-- end-user-doc -->
  42. * @generated
  43. */
  44. @Override
  45. protected EClass eStaticClass() {
  46. return HintcoPackage.Literals.PORT_ADAPTATION;
  47. }
  48. /**
  49. * <!-- begin-user-doc -->
  50. * <!-- end-user-doc -->
  51. * @generated
  52. */
  53. public PortInstance getPort() {
  54. if (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PORT) return null;
  55. return (PortInstance)eContainer();
  56. }
  57. /**
  58. * <!-- begin-user-doc -->
  59. * <!-- end-user-doc -->
  60. * @generated
  61. */
  62. public PortInstance basicGetPort() {
  63. if (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PORT) return null;
  64. return (PortInstance)eInternalContainer();
  65. }
  66. /**
  67. * <!-- begin-user-doc -->
  68. * <!-- end-user-doc -->
  69. * @generated
  70. */
  71. public NotificationChain basicSetPort(PortInstance newPort, NotificationChain msgs) {
  72. msgs = eBasicSetContainer((InternalEObject)newPort, HintcoPackage.PORT_ADAPTATION__PORT, msgs);
  73. return msgs;
  74. }
  75. /**
  76. * <!-- begin-user-doc -->
  77. * <!-- end-user-doc -->
  78. * @generated
  79. */
  80. public void setPort(PortInstance newPort) {
  81. if (newPort != eInternalContainer() || (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PORT && newPort != null)) {
  82. if (EcoreUtil.isAncestor(this, newPort))
  83. throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
  84. NotificationChain msgs = null;
  85. if (eInternalContainer() != null)
  86. msgs = eBasicRemoveFromContainer(msgs);
  87. if (newPort != null)
  88. msgs = ((InternalEObject)newPort).eInverseAdd(this, HintcoPackage.PORT_INSTANCE__ADAPTATION, PortInstance.class, msgs);
  89. msgs = basicSetPort(newPort, msgs);
  90. if (msgs != null) msgs.dispatch();
  91. }
  92. else if (eNotificationRequired())
  93. eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_ADAPTATION__PORT, newPort, newPort));
  94. }
  95. /**
  96. * <!-- begin-user-doc -->
  97. * <!-- end-user-doc -->
  98. * @generated
  99. */
  100. public DecompositionPortAdaptation getParent() {
  101. if (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PARENT) return null;
  102. return (DecompositionPortAdaptation)eContainer();
  103. }
  104. /**
  105. * <!-- begin-user-doc -->
  106. * <!-- end-user-doc -->
  107. * @generated
  108. */
  109. public DecompositionPortAdaptation basicGetParent() {
  110. if (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PARENT) return null;
  111. return (DecompositionPortAdaptation)eInternalContainer();
  112. }
  113. /**
  114. * <!-- begin-user-doc -->
  115. * <!-- end-user-doc -->
  116. * @generated
  117. */
  118. public NotificationChain basicSetParent(DecompositionPortAdaptation newParent, NotificationChain msgs) {
  119. msgs = eBasicSetContainer((InternalEObject)newParent, HintcoPackage.PORT_ADAPTATION__PARENT, msgs);
  120. return msgs;
  121. }
  122. /**
  123. * <!-- begin-user-doc -->
  124. * <!-- end-user-doc -->
  125. * @generated
  126. */
  127. public void setParent(DecompositionPortAdaptation newParent) {
  128. if (newParent != eInternalContainer() || (eContainerFeatureID() != HintcoPackage.PORT_ADAPTATION__PARENT && newParent != null)) {
  129. if (EcoreUtil.isAncestor(this, newParent))
  130. throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
  131. NotificationChain msgs = null;
  132. if (eInternalContainer() != null)
  133. msgs = eBasicRemoveFromContainer(msgs);
  134. if (newParent != null)
  135. msgs = ((InternalEObject)newParent).eInverseAdd(this, HintcoPackage.DECOMPOSITION_PORT_ADAPTATION__CHILDREN, DecompositionPortAdaptation.class, msgs);
  136. msgs = basicSetParent(newParent, msgs);
  137. if (msgs != null) msgs.dispatch();
  138. }
  139. else if (eNotificationRequired())
  140. eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_ADAPTATION__PARENT, newParent, newParent));
  141. }
  142. /**
  143. * <!-- begin-user-doc -->
  144. * <!-- end-user-doc -->
  145. * @generated
  146. */
  147. public PortInstance adapted() {
  148. PortInstance _port = this.getPort();
  149. boolean _tripleNotEquals = (_port != null);
  150. if (_tripleNotEquals) {
  151. return this.getPort();
  152. }
  153. DecompositionPortAdaptation _parent = this.getParent();
  154. boolean _tripleEquals = (_parent == null);
  155. if (_tripleEquals) {
  156. return null;
  157. }
  158. return this.getParent().adapted();
  159. }
  160. /**
  161. * <!-- begin-user-doc -->
  162. * <!-- end-user-doc -->
  163. * @generated
  164. */
  165. @Override
  166. public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
  167. switch (featureID) {
  168. case HintcoPackage.PORT_ADAPTATION__PORT:
  169. if (eInternalContainer() != null)
  170. msgs = eBasicRemoveFromContainer(msgs);
  171. return basicSetPort((PortInstance)otherEnd, msgs);
  172. case HintcoPackage.PORT_ADAPTATION__PARENT:
  173. if (eInternalContainer() != null)
  174. msgs = eBasicRemoveFromContainer(msgs);
  175. return basicSetParent((DecompositionPortAdaptation)otherEnd, msgs);
  176. }
  177. return super.eInverseAdd(otherEnd, featureID, msgs);
  178. }
  179. /**
  180. * <!-- begin-user-doc -->
  181. * <!-- end-user-doc -->
  182. * @generated
  183. */
  184. @Override
  185. public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
  186. switch (featureID) {
  187. case HintcoPackage.PORT_ADAPTATION__PORT:
  188. return basicSetPort(null, msgs);
  189. case HintcoPackage.PORT_ADAPTATION__PARENT:
  190. return basicSetParent(null, msgs);
  191. }
  192. return super.eInverseRemove(otherEnd, featureID, msgs);
  193. }
  194. /**
  195. * <!-- begin-user-doc -->
  196. * <!-- end-user-doc -->
  197. * @generated
  198. */
  199. @Override
  200. public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
  201. switch (eContainerFeatureID()) {
  202. case HintcoPackage.PORT_ADAPTATION__PORT:
  203. return eInternalContainer().eInverseRemove(this, HintcoPackage.PORT_INSTANCE__ADAPTATION, PortInstance.class, msgs);
  204. case HintcoPackage.PORT_ADAPTATION__PARENT:
  205. return eInternalContainer().eInverseRemove(this, HintcoPackage.DECOMPOSITION_PORT_ADAPTATION__CHILDREN, DecompositionPortAdaptation.class, msgs);
  206. }
  207. return super.eBasicRemoveFromContainerFeature(msgs);
  208. }
  209. /**
  210. * <!-- begin-user-doc -->
  211. * <!-- end-user-doc -->
  212. * @generated
  213. */
  214. @Override
  215. public Object eGet(int featureID, boolean resolve, boolean coreType) {
  216. switch (featureID) {
  217. case HintcoPackage.PORT_ADAPTATION__PORT:
  218. if (resolve) return getPort();
  219. return basicGetPort();
  220. case HintcoPackage.PORT_ADAPTATION__PARENT:
  221. if (resolve) return getParent();
  222. return basicGetParent();
  223. }
  224. return super.eGet(featureID, resolve, coreType);
  225. }
  226. /**
  227. * <!-- begin-user-doc -->
  228. * <!-- end-user-doc -->
  229. * @generated
  230. */
  231. @Override
  232. public void eSet(int featureID, Object newValue) {
  233. switch (featureID) {
  234. case HintcoPackage.PORT_ADAPTATION__PORT:
  235. setPort((PortInstance)newValue);
  236. return;
  237. case HintcoPackage.PORT_ADAPTATION__PARENT:
  238. setParent((DecompositionPortAdaptation)newValue);
  239. return;
  240. }
  241. super.eSet(featureID, newValue);
  242. }
  243. /**
  244. * <!-- begin-user-doc -->
  245. * <!-- end-user-doc -->
  246. * @generated
  247. */
  248. @Override
  249. public void eUnset(int featureID) {
  250. switch (featureID) {
  251. case HintcoPackage.PORT_ADAPTATION__PORT:
  252. setPort((PortInstance)null);
  253. return;
  254. case HintcoPackage.PORT_ADAPTATION__PARENT:
  255. setParent((DecompositionPortAdaptation)null);
  256. return;
  257. }
  258. super.eUnset(featureID);
  259. }
  260. /**
  261. * <!-- begin-user-doc -->
  262. * <!-- end-user-doc -->
  263. * @generated
  264. */
  265. @Override
  266. public boolean eIsSet(int featureID) {
  267. switch (featureID) {
  268. case HintcoPackage.PORT_ADAPTATION__PORT:
  269. return basicGetPort() != null;
  270. case HintcoPackage.PORT_ADAPTATION__PARENT:
  271. return basicGetParent() != null;
  272. }
  273. return super.eIsSet(featureID);
  274. }
  275. /**
  276. * <!-- begin-user-doc -->
  277. * <!-- end-user-doc -->
  278. * @generated
  279. */
  280. @Override
  281. public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
  282. switch (operationID) {
  283. case HintcoPackage.PORT_ADAPTATION___ADAPTED:
  284. return adapted();
  285. }
  286. return super.eInvoke(operationID, arguments);
  287. }
  288. } //PortAdaptationImpl