1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package LqnCore.impl; |
8 | |
9 | import LqnCore.FirstPlotType; |
10 | import LqnCore.LqnCorePackage; |
11 | import LqnCore.PlotControlType; |
12 | import LqnCore.PlotType; |
13 | |
14 | import java.util.Collection; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
17 | import org.eclipse.emf.common.notify.NotificationChain; |
18 | |
19 | import org.eclipse.emf.common.util.EList; |
20 | |
21 | import org.eclipse.emf.ecore.EClass; |
22 | import org.eclipse.emf.ecore.InternalEObject; |
23 | |
24 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
25 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
26 | |
27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
28 | import org.eclipse.emf.ecore.util.InternalEList; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Plot Control Type</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * The following features are implemented: |
36 | * <ul> |
37 | * <li>{@link LqnCore.impl.PlotControlTypeImpl#getFirstPlot <em>First Plot</em>}</li> |
38 | * <li>{@link LqnCore.impl.PlotControlTypeImpl#getPlot <em>Plot</em>}</li> |
39 | * </ul> |
40 | * </p> |
41 | * |
42 | * @generated |
43 | */ |
44 | public class PlotControlTypeImpl extends EObjectImpl implements PlotControlType { |
45 | /** |
46 | * The cached value of the '{@link #getFirstPlot() <em>First Plot</em>}' containment reference. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getFirstPlot() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected FirstPlotType firstPlot; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getPlot() <em>Plot</em>}' containment reference list. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getPlot() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected EList<PlotType> plot; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected PlotControlTypeImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return LqnCorePackage.Literals.PLOT_CONTROL_TYPE; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public FirstPlotType getFirstPlot() { |
90 | return firstPlot; |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | public NotificationChain basicSetFirstPlot(FirstPlotType newFirstPlot, NotificationChain msgs) { |
99 | FirstPlotType oldFirstPlot = firstPlot; |
100 | firstPlot = newFirstPlot; |
101 | if (eNotificationRequired()) { |
102 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT, oldFirstPlot, newFirstPlot); |
103 | if (msgs == null) msgs = notification; else msgs.add(notification); |
104 | } |
105 | return msgs; |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public void setFirstPlot(FirstPlotType newFirstPlot) { |
114 | if (newFirstPlot != firstPlot) { |
115 | NotificationChain msgs = null; |
116 | if (firstPlot != null) |
117 | msgs = ((InternalEObject)firstPlot).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT, null, msgs); |
118 | if (newFirstPlot != null) |
119 | msgs = ((InternalEObject)newFirstPlot).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT, null, msgs); |
120 | msgs = basicSetFirstPlot(newFirstPlot, msgs); |
121 | if (msgs != null) msgs.dispatch(); |
122 | } |
123 | else if (eNotificationRequired()) |
124 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT, newFirstPlot, newFirstPlot)); |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public EList<PlotType> getPlot() { |
133 | if (plot == null) { |
134 | plot = new EObjectContainmentEList<PlotType>(PlotType.class, this, LqnCorePackage.PLOT_CONTROL_TYPE__PLOT); |
135 | } |
136 | return plot; |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
146 | switch (featureID) { |
147 | case LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT: |
148 | return basicSetFirstPlot(null, msgs); |
149 | case LqnCorePackage.PLOT_CONTROL_TYPE__PLOT: |
150 | return ((InternalEList<?>)getPlot()).basicRemove(otherEnd, msgs); |
151 | } |
152 | return super.eInverseRemove(otherEnd, featureID, msgs); |
153 | } |
154 | |
155 | /** |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
162 | switch (featureID) { |
163 | case LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT: |
164 | return getFirstPlot(); |
165 | case LqnCorePackage.PLOT_CONTROL_TYPE__PLOT: |
166 | return getPlot(); |
167 | } |
168 | return super.eGet(featureID, resolve, coreType); |
169 | } |
170 | |
171 | /** |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | @SuppressWarnings("unchecked") |
177 | @Override |
178 | public void eSet(int featureID, Object newValue) { |
179 | switch (featureID) { |
180 | case LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT: |
181 | setFirstPlot((FirstPlotType)newValue); |
182 | return; |
183 | case LqnCorePackage.PLOT_CONTROL_TYPE__PLOT: |
184 | getPlot().clear(); |
185 | getPlot().addAll((Collection<? extends PlotType>)newValue); |
186 | return; |
187 | } |
188 | super.eSet(featureID, newValue); |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public void eUnset(int featureID) { |
198 | switch (featureID) { |
199 | case LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT: |
200 | setFirstPlot((FirstPlotType)null); |
201 | return; |
202 | case LqnCorePackage.PLOT_CONTROL_TYPE__PLOT: |
203 | getPlot().clear(); |
204 | return; |
205 | } |
206 | super.eUnset(featureID); |
207 | } |
208 | |
209 | /** |
210 | * <!-- begin-user-doc --> |
211 | * <!-- end-user-doc --> |
212 | * @generated |
213 | */ |
214 | @Override |
215 | public boolean eIsSet(int featureID) { |
216 | switch (featureID) { |
217 | case LqnCorePackage.PLOT_CONTROL_TYPE__FIRST_PLOT: |
218 | return firstPlot != null; |
219 | case LqnCorePackage.PLOT_CONTROL_TYPE__PLOT: |
220 | return plot != null && !plot.isEmpty(); |
221 | } |
222 | return super.eIsSet(featureID); |
223 | } |
224 | |
225 | } //PlotControlTypeImpl |