1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.parameters.impl; |
8 | |
9 | import de.fzi.se.quality.parameters.ComponentInstance; |
10 | import de.fzi.se.quality.parameters.ComponentReference; |
11 | import de.fzi.se.quality.parameters.ParametersPackage; |
12 | |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.common.notify.NotificationChain; |
15 | |
16 | import org.eclipse.emf.ecore.EClass; |
17 | import org.eclipse.emf.ecore.InternalEObject; |
18 | |
19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
20 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
21 | |
22 | import org.eclipse.emf.ecore.util.EcoreUtil; |
23 | |
24 | /** |
25 | * <!-- begin-user-doc --> |
26 | * An implementation of the model object '<em><b>Component Reference</b></em>'. |
27 | * <!-- end-user-doc --> |
28 | * <p> |
29 | * The following features are implemented: |
30 | * <ul> |
31 | * <li>{@link de.fzi.se.quality.parameters.impl.ComponentReferenceImpl#getComponentInstance <em>Component Instance</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public abstract class ComponentReferenceImpl extends EObjectImpl implements ComponentReference { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | protected ComponentReferenceImpl() { |
44 | super(); |
45 | } |
46 | |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | @Override |
53 | protected EClass eStaticClass() { |
54 | return ParametersPackage.Literals.COMPONENT_REFERENCE; |
55 | } |
56 | |
57 | /** |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | public ComponentInstance getComponentInstance() { |
63 | if (eContainerFeatureID() != ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE) return null; |
64 | return (ComponentInstance)eContainer(); |
65 | } |
66 | |
67 | /** |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | public NotificationChain basicSetComponentInstance(ComponentInstance newComponentInstance, NotificationChain msgs) { |
73 | msgs = eBasicSetContainer((InternalEObject)newComponentInstance, ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE, msgs); |
74 | return msgs; |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | public void setComponentInstance(ComponentInstance newComponentInstance) { |
83 | if (newComponentInstance != eInternalContainer() || (eContainerFeatureID() != ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE && newComponentInstance != null)) { |
84 | if (EcoreUtil.isAncestor(this, newComponentInstance)) |
85 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
86 | NotificationChain msgs = null; |
87 | if (eInternalContainer() != null) |
88 | msgs = eBasicRemoveFromContainer(msgs); |
89 | if (newComponentInstance != null) |
90 | msgs = ((InternalEObject)newComponentInstance).eInverseAdd(this, ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE, ComponentInstance.class, msgs); |
91 | msgs = basicSetComponentInstance(newComponentInstance, msgs); |
92 | if (msgs != null) msgs.dispatch(); |
93 | } |
94 | else if (eNotificationRequired()) |
95 | eNotify(new ENotificationImpl(this, Notification.SET, ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE, newComponentInstance, newComponentInstance)); |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | @Override |
104 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
105 | switch (featureID) { |
106 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
107 | if (eInternalContainer() != null) |
108 | msgs = eBasicRemoveFromContainer(msgs); |
109 | return basicSetComponentInstance((ComponentInstance)otherEnd, msgs); |
110 | } |
111 | return super.eInverseAdd(otherEnd, featureID, msgs); |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
121 | switch (featureID) { |
122 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
123 | return basicSetComponentInstance(null, msgs); |
124 | } |
125 | return super.eInverseRemove(otherEnd, featureID, msgs); |
126 | } |
127 | |
128 | /** |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
135 | switch (eContainerFeatureID()) { |
136 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
137 | return eInternalContainer().eInverseRemove(this, ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE, ComponentInstance.class, msgs); |
138 | } |
139 | return super.eBasicRemoveFromContainerFeature(msgs); |
140 | } |
141 | |
142 | /** |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | @Override |
148 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
149 | switch (featureID) { |
150 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
151 | return getComponentInstance(); |
152 | } |
153 | return super.eGet(featureID, resolve, coreType); |
154 | } |
155 | |
156 | /** |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | public void eSet(int featureID, Object newValue) { |
163 | switch (featureID) { |
164 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
165 | setComponentInstance((ComponentInstance)newValue); |
166 | return; |
167 | } |
168 | super.eSet(featureID, newValue); |
169 | } |
170 | |
171 | /** |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | @Override |
177 | public void eUnset(int featureID) { |
178 | switch (featureID) { |
179 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
180 | setComponentInstance((ComponentInstance)null); |
181 | return; |
182 | } |
183 | super.eUnset(featureID); |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | @Override |
192 | public boolean eIsSet(int featureID) { |
193 | switch (featureID) { |
194 | case ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE: |
195 | return getComponentInstance() != null; |
196 | } |
197 | return super.eIsSet(featureID); |
198 | } |
199 | |
200 | } //ComponentReferenceImpl |