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