1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.subsystem.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.common.notify.NotificationChain; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.InternalEObject; |
12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
13 | import org.eclipse.emf.ecore.util.EcoreUtil; |
14 | |
15 | import de.uka.ipd.sdq.pcm.core.entity.impl.ComposedProvidingRequiringEntityImpl; |
16 | import de.uka.ipd.sdq.pcm.repository.Repository; |
17 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
18 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
19 | import de.uka.ipd.sdq.pcm.subsystem.SubSystem; |
20 | import de.uka.ipd.sdq.pcm.subsystem.SubsystemPackage; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Sub System</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link de.uka.ipd.sdq.pcm.subsystem.impl.SubSystemImpl#getRepository__RepositoryComponent <em>Repository Repository Component</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class SubSystemImpl extends ComposedProvidingRequiringEntityImpl implements SubSystem { |
36 | /** |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
42 | |
43 | /** |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | protected SubSystemImpl() { |
49 | super(); |
50 | } |
51 | |
52 | /** |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | @Override |
58 | protected EClass eStaticClass() { |
59 | return SubsystemPackage.Literals.SUB_SYSTEM; |
60 | } |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | public Repository getRepository__RepositoryComponent() { |
68 | if (eContainerFeatureID() != SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT) return null; |
69 | return (Repository)eContainer(); |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | public NotificationChain basicSetRepository__RepositoryComponent(Repository newRepository__RepositoryComponent, NotificationChain msgs) { |
78 | msgs = eBasicSetContainer((InternalEObject)newRepository__RepositoryComponent, SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT, msgs); |
79 | return msgs; |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public void setRepository__RepositoryComponent(Repository newRepository__RepositoryComponent) { |
88 | if (newRepository__RepositoryComponent != eInternalContainer() || (eContainerFeatureID() != SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT && newRepository__RepositoryComponent != null)) { |
89 | if (EcoreUtil.isAncestor(this, newRepository__RepositoryComponent)) |
90 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
91 | NotificationChain msgs = null; |
92 | if (eInternalContainer() != null) |
93 | msgs = eBasicRemoveFromContainer(msgs); |
94 | if (newRepository__RepositoryComponent != null) |
95 | msgs = ((InternalEObject)newRepository__RepositoryComponent).eInverseAdd(this, RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY, Repository.class, msgs); |
96 | msgs = basicSetRepository__RepositoryComponent(newRepository__RepositoryComponent, msgs); |
97 | if (msgs != null) msgs.dispatch(); |
98 | } |
99 | else if (eNotificationRequired()) |
100 | eNotify(new ENotificationImpl(this, Notification.SET, SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT, newRepository__RepositoryComponent, newRepository__RepositoryComponent)); |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | @Override |
109 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
110 | switch (featureID) { |
111 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
112 | if (eInternalContainer() != null) |
113 | msgs = eBasicRemoveFromContainer(msgs); |
114 | return basicSetRepository__RepositoryComponent((Repository)otherEnd, msgs); |
115 | } |
116 | return super.eInverseAdd(otherEnd, featureID, msgs); |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
126 | switch (featureID) { |
127 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
128 | return basicSetRepository__RepositoryComponent(null, msgs); |
129 | } |
130 | return super.eInverseRemove(otherEnd, featureID, msgs); |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
140 | switch (eContainerFeatureID()) { |
141 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
142 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY, Repository.class, msgs); |
143 | } |
144 | return super.eBasicRemoveFromContainerFeature(msgs); |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
154 | switch (featureID) { |
155 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
156 | return getRepository__RepositoryComponent(); |
157 | } |
158 | return super.eGet(featureID, resolve, coreType); |
159 | } |
160 | |
161 | /** |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | @Override |
167 | public void eSet(int featureID, Object newValue) { |
168 | switch (featureID) { |
169 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
170 | setRepository__RepositoryComponent((Repository)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 SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
185 | setRepository__RepositoryComponent((Repository)null); |
186 | return; |
187 | } |
188 | super.eUnset(featureID); |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public boolean eIsSet(int featureID) { |
198 | switch (featureID) { |
199 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: |
200 | return getRepository__RepositoryComponent() != null; |
201 | } |
202 | return super.eIsSet(featureID); |
203 | } |
204 | |
205 | /** |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | @Override |
211 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
212 | if (baseClass == RepositoryComponent.class) { |
213 | switch (derivedFeatureID) { |
214 | case SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT: return RepositoryPackage.REPOSITORY_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT; |
215 | default: return -1; |
216 | } |
217 | } |
218 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
219 | } |
220 | |
221 | /** |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @generated |
225 | */ |
226 | @Override |
227 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
228 | if (baseClass == RepositoryComponent.class) { |
229 | switch (baseFeatureID) { |
230 | case RepositoryPackage.REPOSITORY_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: return SubsystemPackage.SUB_SYSTEM__REPOSITORY_REPOSITORY_COMPONENT; |
231 | default: return -1; |
232 | } |
233 | } |
234 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
235 | } |
236 | |
237 | } //SubSystemImpl |