1 | /** |
2 | * Copyright 2008, sdq.ipd.uka.de, U KA |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.simucomframework.simucomstatus.impl; |
7 | |
8 | import de.uka.ipd.sdq.simucomframework.simucomstatus.ActiveResouce; |
9 | import de.uka.ipd.sdq.simucomframework.simucomstatus.PassiveResource; |
10 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimucomstatusPackage; |
11 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimulatedResources; |
12 | |
13 | import java.util.Collection; |
14 | |
15 | import org.eclipse.emf.common.notify.NotificationChain; |
16 | |
17 | import org.eclipse.emf.common.util.EList; |
18 | |
19 | import org.eclipse.emf.ecore.EClass; |
20 | import org.eclipse.emf.ecore.InternalEObject; |
21 | |
22 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
23 | |
24 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
25 | import org.eclipse.emf.ecore.util.InternalEList; |
26 | |
27 | /** |
28 | * <!-- begin-user-doc --> |
29 | * An implementation of the model object '<em><b>Simulated Resources</b></em>'. |
30 | * <!-- end-user-doc --> |
31 | * <p> |
32 | * The following features are implemented: |
33 | * <ul> |
34 | * <li>{@link de.uka.ipd.sdq.simucomframework.simucomstatus.impl.SimulatedResourcesImpl#getActiveResources <em>Active Resources</em>}</li> |
35 | * <li>{@link de.uka.ipd.sdq.simucomframework.simucomstatus.impl.SimulatedResourcesImpl#getPassiveResources <em>Passive Resources</em>}</li> |
36 | * </ul> |
37 | * </p> |
38 | * |
39 | * @generated |
40 | */ |
41 | public class SimulatedResourcesImpl extends EObjectImpl implements SimulatedResources { |
42 | /** |
43 | * The cached value of the '{@link #getActiveResources() <em>Active Resources</em>}' containment reference list. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getActiveResources() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected EList<ActiveResouce> activeResources; |
51 | |
52 | /** |
53 | * The cached value of the '{@link #getPassiveResources() <em>Passive Resources</em>}' containment reference list. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getPassiveResources() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected EList<PassiveResource> passiveResources; |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | protected SimulatedResourcesImpl() { |
68 | super(); |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | @Override |
77 | protected EClass eStaticClass() { |
78 | return SimucomstatusPackage.Literals.SIMULATED_RESOURCES; |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public EList<ActiveResouce> getActiveResources() { |
87 | if (activeResources == null) { |
88 | activeResources = new EObjectContainmentEList<ActiveResouce>(ActiveResouce.class, this, SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES); |
89 | } |
90 | return activeResources; |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | public EList<PassiveResource> getPassiveResources() { |
99 | if (passiveResources == null) { |
100 | passiveResources = new EObjectContainmentEList<PassiveResource>(PassiveResource.class, this, SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES); |
101 | } |
102 | return passiveResources; |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
112 | switch (featureID) { |
113 | case SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES: |
114 | return ((InternalEList<?>)getActiveResources()).basicRemove(otherEnd, msgs); |
115 | case SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES: |
116 | return ((InternalEList<?>)getPassiveResources()).basicRemove(otherEnd, msgs); |
117 | } |
118 | return super.eInverseRemove(otherEnd, featureID, msgs); |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | @Override |
127 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
128 | switch (featureID) { |
129 | case SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES: |
130 | return getActiveResources(); |
131 | case SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES: |
132 | return getPassiveResources(); |
133 | } |
134 | return super.eGet(featureID, resolve, coreType); |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @SuppressWarnings("unchecked") |
143 | @Override |
144 | public void eSet(int featureID, Object newValue) { |
145 | switch (featureID) { |
146 | case SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES: |
147 | getActiveResources().clear(); |
148 | getActiveResources().addAll((Collection<? extends ActiveResouce>)newValue); |
149 | return; |
150 | case SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES: |
151 | getPassiveResources().clear(); |
152 | getPassiveResources().addAll((Collection<? extends PassiveResource>)newValue); |
153 | return; |
154 | } |
155 | super.eSet(featureID, newValue); |
156 | } |
157 | |
158 | /** |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | @Override |
164 | public void eUnset(int featureID) { |
165 | switch (featureID) { |
166 | case SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES: |
167 | getActiveResources().clear(); |
168 | return; |
169 | case SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES: |
170 | getPassiveResources().clear(); |
171 | return; |
172 | } |
173 | super.eUnset(featureID); |
174 | } |
175 | |
176 | /** |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | @Override |
182 | public boolean eIsSet(int featureID) { |
183 | switch (featureID) { |
184 | case SimucomstatusPackage.SIMULATED_RESOURCES__ACTIVE_RESOURCES: |
185 | return activeResources != null && !activeResources.isEmpty(); |
186 | case SimucomstatusPackage.SIMULATED_RESOURCES__PASSIVE_RESOURCES: |
187 | return passiveResources != null && !passiveResources.isEmpty(); |
188 | } |
189 | return super.eIsSet(featureID); |
190 | } |
191 | |
192 | } //SimulatedResourcesImpl |