1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.usagemodel.impl; |
7 | |
8 | import java.util.Collection; |
9 | |
10 | import org.eclipse.emf.common.notify.NotificationChain; |
11 | import org.eclipse.emf.common.util.EList; |
12 | import org.eclipse.emf.ecore.EClass; |
13 | import org.eclipse.emf.ecore.InternalEObject; |
14 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
15 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
16 | import org.eclipse.emf.ecore.util.InternalEList; |
17 | |
18 | import de.uka.ipd.sdq.pcm.usagemodel.UsageModel; |
19 | import de.uka.ipd.sdq.pcm.usagemodel.UsageScenario; |
20 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
21 | import de.uka.ipd.sdq.pcm.usagemodel.UserData; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Usage Model</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.UsageModelImpl#getUsageScenario_UsageModel <em>Usage Scenario Usage Model</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.UsageModelImpl#getUserData_UsageModel <em>User Data Usage Model</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public class UsageModelImpl extends EObjectImpl implements UsageModel { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
44 | |
45 | /** |
46 | * The cached value of the '{@link #getUsageScenario_UsageModel() <em>Usage Scenario Usage Model</em>}' containment reference list. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getUsageScenario_UsageModel() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected EList<UsageScenario> usageScenario_UsageModel; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getUserData_UsageModel() <em>User Data Usage Model</em>}' containment reference list. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getUserData_UsageModel() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected EList<UserData> userData_UsageModel; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected UsageModelImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return UsagemodelPackage.Literals.USAGE_MODEL; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public EList<UserData> getUserData_UsageModel() { |
90 | if (userData_UsageModel == null) { |
91 | userData_UsageModel = new EObjectContainmentWithInverseEList<UserData>(UserData.class, this, UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL, UsagemodelPackage.USER_DATA__USAGE_MODEL_USER_DATA); |
92 | } |
93 | return userData_UsageModel; |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | public EList<UsageScenario> getUsageScenario_UsageModel() { |
102 | if (usageScenario_UsageModel == null) { |
103 | usageScenario_UsageModel = new EObjectContainmentWithInverseEList<UsageScenario>(UsageScenario.class, this, UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL, UsagemodelPackage.USAGE_SCENARIO__USAGE_MODEL_USAGE_SCENARIO); |
104 | } |
105 | return usageScenario_UsageModel; |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | @SuppressWarnings("unchecked") |
114 | @Override |
115 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
116 | switch (featureID) { |
117 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
118 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getUsageScenario_UsageModel()).basicAdd(otherEnd, msgs); |
119 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
120 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getUserData_UsageModel()).basicAdd(otherEnd, msgs); |
121 | } |
122 | return super.eInverseAdd(otherEnd, featureID, msgs); |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | @Override |
131 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
132 | switch (featureID) { |
133 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
134 | return ((InternalEList<?>)getUsageScenario_UsageModel()).basicRemove(otherEnd, msgs); |
135 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
136 | return ((InternalEList<?>)getUserData_UsageModel()).basicRemove(otherEnd, msgs); |
137 | } |
138 | return super.eInverseRemove(otherEnd, featureID, msgs); |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | @Override |
147 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
148 | switch (featureID) { |
149 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
150 | return getUsageScenario_UsageModel(); |
151 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
152 | return getUserData_UsageModel(); |
153 | } |
154 | return super.eGet(featureID, resolve, coreType); |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | @SuppressWarnings("unchecked") |
163 | @Override |
164 | public void eSet(int featureID, Object newValue) { |
165 | switch (featureID) { |
166 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
167 | getUsageScenario_UsageModel().clear(); |
168 | getUsageScenario_UsageModel().addAll((Collection<? extends UsageScenario>)newValue); |
169 | return; |
170 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
171 | getUserData_UsageModel().clear(); |
172 | getUserData_UsageModel().addAll((Collection<? extends UserData>)newValue); |
173 | return; |
174 | } |
175 | super.eSet(featureID, newValue); |
176 | } |
177 | |
178 | /** |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public void eUnset(int featureID) { |
185 | switch (featureID) { |
186 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
187 | getUsageScenario_UsageModel().clear(); |
188 | return; |
189 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
190 | getUserData_UsageModel().clear(); |
191 | return; |
192 | } |
193 | super.eUnset(featureID); |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | @Override |
202 | public boolean eIsSet(int featureID) { |
203 | switch (featureID) { |
204 | case UsagemodelPackage.USAGE_MODEL__USAGE_SCENARIO_USAGE_MODEL: |
205 | return usageScenario_UsageModel != null && !usageScenario_UsageModel.isEmpty(); |
206 | case UsagemodelPackage.USAGE_MODEL__USER_DATA_USAGE_MODEL: |
207 | return userData_UsageModel != null && !userData_UsageModel.isEmpty(); |
208 | } |
209 | return super.eIsSet(featureID); |
210 | } |
211 | |
212 | } //UsageModelImpl |