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