1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.impl; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.QMLProfilePackage; |
10 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.Requirement; |
11 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.SimpleQMLProfile; |
12 | |
13 | import de.uka.ipd.sdq.pcm.usagemodel.UsageModel; |
14 | |
15 | import java.util.Collection; |
16 | |
17 | import org.eclipse.emf.common.notify.Notification; |
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.impl.ENotificationImpl; |
26 | |
27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
28 | import org.eclipse.emf.ecore.util.InternalEList; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Simple QML Profile</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * The following features are implemented: |
36 | * <ul> |
37 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.impl.SimpleQMLProfileImpl#getUsageModel <em>Usage Model</em>}</li> |
38 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.impl.SimpleQMLProfileImpl#getRequirements <em>Requirements</em>}</li> |
39 | * </ul> |
40 | * </p> |
41 | * |
42 | * @generated |
43 | */ |
44 | public class SimpleQMLProfileImpl extends GenericQMLProfileImpl implements SimpleQMLProfile { |
45 | /** |
46 | * The cached value of the '{@link #getUsageModel() <em>Usage Model</em>}' reference. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getUsageModel() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected UsageModel usageModel; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getRequirements() <em>Requirements</em>}' containment reference list. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getRequirements() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected EList<Requirement> requirements; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected SimpleQMLProfileImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return QMLProfilePackage.Literals.SIMPLE_QML_PROFILE; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public UsageModel getUsageModel() { |
90 | if (usageModel != null && usageModel.eIsProxy()) { |
91 | InternalEObject oldUsageModel = (InternalEObject)usageModel; |
92 | usageModel = (UsageModel)eResolveProxy(oldUsageModel); |
93 | if (usageModel != oldUsageModel) { |
94 | if (eNotificationRequired()) |
95 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL, oldUsageModel, usageModel)); |
96 | } |
97 | } |
98 | return usageModel; |
99 | } |
100 | |
101 | /** |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | public UsageModel basicGetUsageModel() { |
107 | return usageModel; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public void setUsageModel(UsageModel newUsageModel) { |
116 | UsageModel oldUsageModel = usageModel; |
117 | usageModel = newUsageModel; |
118 | if (eNotificationRequired()) |
119 | eNotify(new ENotificationImpl(this, Notification.SET, QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL, oldUsageModel, usageModel)); |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public EList<Requirement> getRequirements() { |
128 | if (requirements == null) { |
129 | requirements = new EObjectContainmentEList<Requirement>(Requirement.class, this, QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS); |
130 | } |
131 | return requirements; |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
141 | switch (featureID) { |
142 | case QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS: |
143 | return ((InternalEList<?>)getRequirements()).basicRemove(otherEnd, msgs); |
144 | } |
145 | return super.eInverseRemove(otherEnd, featureID, msgs); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
155 | switch (featureID) { |
156 | case QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL: |
157 | if (resolve) return getUsageModel(); |
158 | return basicGetUsageModel(); |
159 | case QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS: |
160 | return getRequirements(); |
161 | } |
162 | return super.eGet(featureID, resolve, coreType); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @SuppressWarnings("unchecked") |
171 | @Override |
172 | public void eSet(int featureID, Object newValue) { |
173 | switch (featureID) { |
174 | case QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL: |
175 | setUsageModel((UsageModel)newValue); |
176 | return; |
177 | case QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS: |
178 | getRequirements().clear(); |
179 | getRequirements().addAll((Collection<? extends Requirement>)newValue); |
180 | return; |
181 | } |
182 | super.eSet(featureID, newValue); |
183 | } |
184 | |
185 | /** |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | @Override |
191 | public void eUnset(int featureID) { |
192 | switch (featureID) { |
193 | case QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL: |
194 | setUsageModel((UsageModel)null); |
195 | return; |
196 | case QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS: |
197 | getRequirements().clear(); |
198 | return; |
199 | } |
200 | super.eUnset(featureID); |
201 | } |
202 | |
203 | /** |
204 | * <!-- begin-user-doc --> |
205 | * <!-- end-user-doc --> |
206 | * @generated |
207 | */ |
208 | @Override |
209 | public boolean eIsSet(int featureID) { |
210 | switch (featureID) { |
211 | case QMLProfilePackage.SIMPLE_QML_PROFILE__USAGE_MODEL: |
212 | return usageModel != null; |
213 | case QMLProfilePackage.SIMPLE_QML_PROFILE__REQUIREMENTS: |
214 | return requirements != null && !requirements.isEmpty(); |
215 | } |
216 | return super.eIsSet(featureID); |
217 | } |
218 | |
219 | } //SimpleQMLProfileImpl |