1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.resourcetype.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.resourcetype.ResourceInterface; |
19 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository; |
20 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceType; |
21 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Resource Repository</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.pcm.resourcetype.impl.ResourceRepositoryImpl#getResourceInterfaces__ResourceRepository <em>Resource Interfaces Resource Repository</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.pcm.resourcetype.impl.ResourceRepositoryImpl#getAvailableResourceTypes_ResourceRepository <em>Available Resource Types Resource Repository</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public class ResourceRepositoryImpl extends EObjectImpl implements ResourceRepository { |
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 #getResourceInterfaces__ResourceRepository() <em>Resource Interfaces Resource Repository</em>}' containment reference list. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getResourceInterfaces__ResourceRepository() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected EList<ResourceInterface> resourceInterfaces__ResourceRepository; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getAvailableResourceTypes_ResourceRepository() <em>Available Resource Types Resource Repository</em>}' containment reference list. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getAvailableResourceTypes_ResourceRepository() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected EList<ResourceType> availableResourceTypes_ResourceRepository; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected ResourceRepositoryImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return ResourcetypePackage.Literals.RESOURCE_REPOSITORY; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public EList<ResourceInterface> getResourceInterfaces__ResourceRepository() { |
90 | if (resourceInterfaces__ResourceRepository == null) { |
91 | resourceInterfaces__ResourceRepository = new EObjectContainmentWithInverseEList<ResourceInterface>(ResourceInterface.class, this, ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY, ResourcetypePackage.RESOURCE_INTERFACE__RESOURCE_REPOSITORY_RESOURCE_INTERFACE); |
92 | } |
93 | return resourceInterfaces__ResourceRepository; |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | public EList<ResourceType> getAvailableResourceTypes_ResourceRepository() { |
102 | if (availableResourceTypes_ResourceRepository == null) { |
103 | availableResourceTypes_ResourceRepository = new EObjectContainmentWithInverseEList<ResourceType>(ResourceType.class, this, ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY, ResourcetypePackage.RESOURCE_TYPE__RESOURCE_REPOSITORY_RESOURCE_TYPE); |
104 | } |
105 | return availableResourceTypes_ResourceRepository; |
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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
118 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getResourceInterfaces__ResourceRepository()).basicAdd(otherEnd, msgs); |
119 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
120 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getAvailableResourceTypes_ResourceRepository()).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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
134 | return ((InternalEList<?>)getResourceInterfaces__ResourceRepository()).basicRemove(otherEnd, msgs); |
135 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
136 | return ((InternalEList<?>)getAvailableResourceTypes_ResourceRepository()).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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
150 | return getResourceInterfaces__ResourceRepository(); |
151 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
152 | return getAvailableResourceTypes_ResourceRepository(); |
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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
167 | getResourceInterfaces__ResourceRepository().clear(); |
168 | getResourceInterfaces__ResourceRepository().addAll((Collection<? extends ResourceInterface>)newValue); |
169 | return; |
170 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
171 | getAvailableResourceTypes_ResourceRepository().clear(); |
172 | getAvailableResourceTypes_ResourceRepository().addAll((Collection<? extends ResourceType>)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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
187 | getResourceInterfaces__ResourceRepository().clear(); |
188 | return; |
189 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
190 | getAvailableResourceTypes_ResourceRepository().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 ResourcetypePackage.RESOURCE_REPOSITORY__RESOURCE_INTERFACES_RESOURCE_REPOSITORY: |
205 | return resourceInterfaces__ResourceRepository != null && !resourceInterfaces__ResourceRepository.isEmpty(); |
206 | case ResourcetypePackage.RESOURCE_REPOSITORY__AVAILABLE_RESOURCE_TYPES_RESOURCE_REPOSITORY: |
207 | return availableResourceTypes_ResourceRepository != null && !availableResourceTypes_ResourceRepository.isEmpty(); |
208 | } |
209 | return super.eIsSet(featureID); |
210 | } |
211 | |
212 | } //ResourceRepositoryImpl |