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.ParameterInstance; |
12 | import de.fzi.se.quality.parameters.ParametersPackage; |
13 | |
14 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
15 | |
16 | import java.util.Collection; |
17 | |
18 | import org.eclipse.emf.common.notify.NotificationChain; |
19 | |
20 | import org.eclipse.emf.common.util.EList; |
21 | |
22 | import org.eclipse.emf.ecore.EClass; |
23 | import org.eclipse.emf.ecore.InternalEObject; |
24 | |
25 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
26 | import org.eclipse.emf.ecore.util.InternalEList; |
27 | |
28 | /** |
29 | * <!-- begin-user-doc --> |
30 | * An implementation of the model object '<em><b>Component Instance</b></em>'. |
31 | * <!-- end-user-doc --> |
32 | * <p> |
33 | * The following features are implemented: |
34 | * <ul> |
35 | * <li>{@link de.fzi.se.quality.parameters.impl.ComponentInstanceImpl#getComponentReference <em>Component Reference</em>}</li> |
36 | * <li>{@link de.fzi.se.quality.parameters.impl.ComponentInstanceImpl#getParameterInstances <em>Parameter Instances</em>}</li> |
37 | * </ul> |
38 | * </p> |
39 | * |
40 | * @generated |
41 | */ |
42 | public class ComponentInstanceImpl extends IdentifierImpl implements ComponentInstance { |
43 | /** |
44 | * The cached value of the '{@link #getComponentReference() <em>Component Reference</em>}' containment reference list. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getComponentReference() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected EList<ComponentReference> componentReference; |
52 | |
53 | /** |
54 | * The cached value of the '{@link #getParameterInstances() <em>Parameter Instances</em>}' containment reference list. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @see #getParameterInstances() |
58 | * @generated |
59 | * @ordered |
60 | */ |
61 | protected EList<ParameterInstance> parameterInstances; |
62 | |
63 | /** |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | protected ComponentInstanceImpl() { |
69 | super(); |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | @Override |
78 | protected EClass eStaticClass() { |
79 | return ParametersPackage.Literals.COMPONENT_INSTANCE; |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public EList<ComponentReference> getComponentReference() { |
88 | if (componentReference == null) { |
89 | componentReference = new EObjectContainmentWithInverseEList<ComponentReference>(ComponentReference.class, this, ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE, ParametersPackage.COMPONENT_REFERENCE__COMPONENT_INSTANCE); |
90 | } |
91 | return componentReference; |
92 | } |
93 | |
94 | /** |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | public EList<ParameterInstance> getParameterInstances() { |
100 | if (parameterInstances == null) { |
101 | parameterInstances = new EObjectContainmentWithInverseEList<ParameterInstance>(ParameterInstance.class, this, ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES, ParametersPackage.PARAMETER_INSTANCE__COMPONENT_INSTANCE); |
102 | } |
103 | return parameterInstances; |
104 | } |
105 | |
106 | /** |
107 | * <!-- begin-user-doc --> |
108 | * <!-- end-user-doc --> |
109 | * @generated |
110 | */ |
111 | @SuppressWarnings("unchecked") |
112 | @Override |
113 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
114 | switch (featureID) { |
115 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
116 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getComponentReference()).basicAdd(otherEnd, msgs); |
117 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
118 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getParameterInstances()).basicAdd(otherEnd, msgs); |
119 | } |
120 | return super.eInverseAdd(otherEnd, featureID, msgs); |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | @Override |
129 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
130 | switch (featureID) { |
131 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
132 | return ((InternalEList<?>)getComponentReference()).basicRemove(otherEnd, msgs); |
133 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
134 | return ((InternalEList<?>)getParameterInstances()).basicRemove(otherEnd, msgs); |
135 | } |
136 | return super.eInverseRemove(otherEnd, featureID, msgs); |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
146 | switch (featureID) { |
147 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
148 | return getComponentReference(); |
149 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
150 | return getParameterInstances(); |
151 | } |
152 | return super.eGet(featureID, resolve, coreType); |
153 | } |
154 | |
155 | /** |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @SuppressWarnings("unchecked") |
161 | @Override |
162 | public void eSet(int featureID, Object newValue) { |
163 | switch (featureID) { |
164 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
165 | getComponentReference().clear(); |
166 | getComponentReference().addAll((Collection<? extends ComponentReference>)newValue); |
167 | return; |
168 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
169 | getParameterInstances().clear(); |
170 | getParameterInstances().addAll((Collection<? extends ParameterInstance>)newValue); |
171 | return; |
172 | } |
173 | super.eSet(featureID, newValue); |
174 | } |
175 | |
176 | /** |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | @Override |
182 | public void eUnset(int featureID) { |
183 | switch (featureID) { |
184 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
185 | getComponentReference().clear(); |
186 | return; |
187 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
188 | getParameterInstances().clear(); |
189 | return; |
190 | } |
191 | super.eUnset(featureID); |
192 | } |
193 | |
194 | /** |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | @Override |
200 | public boolean eIsSet(int featureID) { |
201 | switch (featureID) { |
202 | case ParametersPackage.COMPONENT_INSTANCE__COMPONENT_REFERENCE: |
203 | return componentReference != null && !componentReference.isEmpty(); |
204 | case ParametersPackage.COMPONENT_INSTANCE__PARAMETER_INSTANCES: |
205 | return parameterInstances != null && !parameterInstances.isEmpty(); |
206 | } |
207 | return super.eIsSet(featureID); |
208 | } |
209 | |
210 | } //ComponentInstanceImpl |