KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > impl > ComplexTypeConverterImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: ComplexTypeConverterImpl.java,v 1.3 2005/06/08 06:21:43 nickb Exp $
16  */

17 package org.eclipse.emf.mapping.impl;
18
19
20 import java.util.Collection JavaDoc;
21
22 import org.eclipse.emf.common.notify.Notification;
23 import org.eclipse.emf.common.notify.NotificationChain;
24 import org.eclipse.emf.ecore.EClass;
25 import org.eclipse.emf.ecore.EObject;
26 import org.eclipse.emf.ecore.EStructuralFeature;
27 import org.eclipse.emf.ecore.InternalEObject;
28 import org.eclipse.emf.ecore.impl.ENotificationImpl;
29 import org.eclipse.emf.ecore.util.InternalEList;
30 import org.eclipse.emf.mapping.ComplexTypeConverter;
31 import org.eclipse.emf.mapping.Mapping;
32 import org.eclipse.emf.mapping.MappingHelper;
33 import org.eclipse.emf.mapping.MappingPackage;
34
35
36 /**
37  * <!-- begin-user-doc -->
38  * An implementation of the model object '<em><b>Complex Type Converter</b></em>'.
39  * <!-- end-user-doc -->
40  * <p>
41  * The following features are implemented:
42  * <ul>
43  * <li>{@link org.eclipse.emf.mapping.impl.ComplexTypeConverterImpl#getIn2out <em>In2out</em>}</li>
44  * <li>{@link org.eclipse.emf.mapping.impl.ComplexTypeConverterImpl#getOut2in <em>Out2in</em>}</li>
45  * </ul>
46  * </p>
47  *
48  * @generated
49  */

50 public class ComplexTypeConverterImpl extends TypeConverterImpl implements ComplexTypeConverter
51 {
52   /**
53    * The cached value of the '{@link #getIn2out() <em>In2out</em>}' reference.
54    * <!-- begin-user-doc -->
55    * <!-- end-user-doc -->
56    * @see #getIn2out()
57    * @generated
58    * @ordered
59    */

60   protected Mapping in2out = null;
61
62   /**
63    * The cached value of the '{@link #getOut2in() <em>Out2in</em>}' reference.
64    * <!-- begin-user-doc -->
65    * <!-- end-user-doc -->
66    * @see #getOut2in()
67    * @generated
68    * @ordered
69    */

70   protected Mapping out2in = null;
71
72   /**
73    * <!-- begin-user-doc -->
74    * <!-- end-user-doc -->
75    * @generated
76    */

77   protected ComplexTypeConverterImpl()
78   {
79     super();
80   }
81
82   /**
83    * <!-- begin-user-doc -->
84    * <!-- end-user-doc -->
85    * @generated
86    */

87   protected EClass eStaticClass()
88   {
89     return MappingPackage.eINSTANCE.getComplexTypeConverter();
90   }
91
92   /**
93    * <!-- begin-user-doc -->
94    * <!-- end-user-doc -->
95    * @generated
96    */

97   public Mapping getIn2out()
98   {
99     if (in2out != null && in2out.eIsProxy())
100     {
101       Mapping oldIn2out = in2out;
102       in2out = (Mapping)eResolveProxy((InternalEObject)in2out);
103       if (in2out != oldIn2out)
104       {
105         if (eNotificationRequired())
106           eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT, oldIn2out, in2out));
107       }
108     }
109     return in2out;
110   }
111
112   /**
113    * <!-- begin-user-doc -->
114    * <!-- end-user-doc -->
115    * @generated
116    */

117   public Mapping basicGetIn2out()
118   {
119     return in2out;
120   }
121
122   /**
123    * <!-- begin-user-doc -->
124    * <!-- end-user-doc -->
125    * @generated
126    */

127   public void setIn2out(Mapping newIn2out)
128   {
129     Mapping oldIn2out = in2out;
130     in2out = newIn2out;
131     if (eNotificationRequired())
132       eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT, oldIn2out, in2out));
133   }
134
135   /**
136    * <!-- begin-user-doc -->
137    * <!-- end-user-doc -->
138    * @generated
139    */

140   public Mapping getOut2in()
141   {
142     if (out2in != null && out2in.eIsProxy())
143     {
144       Mapping oldOut2in = out2in;
145       out2in = (Mapping)eResolveProxy((InternalEObject)out2in);
146       if (out2in != oldOut2in)
147       {
148         if (eNotificationRequired())
149           eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN, oldOut2in, out2in));
150       }
151     }
152     return out2in;
153   }
154
155   /**
156    * <!-- begin-user-doc -->
157    * <!-- end-user-doc -->
158    * @generated
159    */

160   public Mapping basicGetOut2in()
161   {
162     return out2in;
163   }
164
165   /**
166    * <!-- begin-user-doc -->
167    * <!-- end-user-doc -->
168    * @generated
169    */

170   public void setOut2in(Mapping newOut2in)
171   {
172     Mapping oldOut2in = out2in;
173     out2in = newOut2in;
174     if (eNotificationRequired())
175       eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN, oldOut2in, out2in));
176   }
177
178   /**
179    * <!-- begin-user-doc -->
180    * <!-- end-user-doc -->
181    * @generated
182    */

183   public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
184   {
185     if (featureID >= 0)
186     {
187       switch (eDerivedStructuralFeatureID(featureID, baseClass))
188       {
189         case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
190           if (eContainer != null)
191             msgs = eBasicRemoveFromContainer(msgs);
192           return eBasicSetContainer(otherEnd, MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER, msgs);
193         case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
194           if (eContainer != null)
195             msgs = eBasicRemoveFromContainer(msgs);
196           return eBasicSetContainer(otherEnd, MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN, msgs);
197         case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
198           return ((InternalEList)getNested()).basicAdd(otherEnd, msgs);
199         default:
200           return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
201       }
202     }
203     if (eContainer != null)
204       msgs = eBasicRemoveFromContainer(msgs);
205     return eBasicSetContainer(otherEnd, featureID, msgs);
206   }
207
208   /**
209    * <!-- begin-user-doc -->
210    * <!-- end-user-doc -->
211    * @generated
212    */

213   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
214   {
215     if (featureID >= 0)
216     {
217       switch (eDerivedStructuralFeatureID(featureID, baseClass))
218       {
219         case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
220           return eBasicSetContainer(null, MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER, msgs);
221         case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
222           return eBasicSetContainer(null, MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN, msgs);
223         case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
224           return ((InternalEList)getNested()).basicRemove(otherEnd, msgs);
225         default:
226           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
227       }
228     }
229     return eBasicSetContainer(null, featureID, msgs);
230   }
231
232   /**
233    * <!-- begin-user-doc -->
234    * <!-- end-user-doc -->
235    * @generated
236    */

237   public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs)
238   {
239     if (eContainerFeatureID >= 0)
240     {
241       switch (eContainerFeatureID)
242       {
243         case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
244           return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs);
245         case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
246           return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
247         default:
248           return eDynamicBasicRemoveFromContainer(msgs);
249       }
250     }
251     return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
252   }
253
254   /**
255    * <!-- begin-user-doc -->
256    * <!-- end-user-doc -->
257    * @generated
258    */

259   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
260   {
261     switch (eDerivedStructuralFeatureID(eFeature))
262     {
263       case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
264         return getMapper();
265       case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT:
266         if (resolve) return getHelpedObject();
267         return basicGetHelpedObject();
268       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
269         return getNestedIn();
270       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
271         return getNested();
272       case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT:
273         if (resolve) return getIn2out();
274         return basicGetIn2out();
275       case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN:
276         if (resolve) return getOut2in();
277         return basicGetOut2in();
278     }
279     return eDynamicGet(eFeature, resolve);
280   }
281
282   /**
283    * <!-- begin-user-doc -->
284    * <!-- end-user-doc -->
285    * @generated
286    */

287   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
288   {
289     switch (eDerivedStructuralFeatureID(eFeature))
290     {
291       case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
292         setMapper((Mapping)newValue);
293         return;
294       case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT:
295         setHelpedObject((EObject)newValue);
296         return;
297       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
298         setNestedIn((MappingHelper)newValue);
299         return;
300       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
301         getNested().clear();
302         getNested().addAll((Collection JavaDoc)newValue);
303         return;
304       case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT:
305         setIn2out((Mapping)newValue);
306         return;
307       case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN:
308         setOut2in((Mapping)newValue);
309         return;
310     }
311     eDynamicSet(eFeature, newValue);
312   }
313
314   /**
315    * <!-- begin-user-doc -->
316    * <!-- end-user-doc -->
317    * @generated
318    */

319   public void eUnset(EStructuralFeature eFeature)
320   {
321     switch (eDerivedStructuralFeatureID(eFeature))
322     {
323       case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
324         setMapper((Mapping)null);
325         return;
326       case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT:
327         setHelpedObject((EObject)null);
328         return;
329       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
330         setNestedIn((MappingHelper)null);
331         return;
332       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
333         getNested().clear();
334         return;
335       case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT:
336         setIn2out((Mapping)null);
337         return;
338       case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN:
339         setOut2in((Mapping)null);
340         return;
341     }
342     eDynamicUnset(eFeature);
343   }
344
345   /**
346    * <!-- begin-user-doc -->
347    * <!-- end-user-doc -->
348    * @generated
349    */

350   public boolean eIsSet(EStructuralFeature eFeature)
351   {
352     switch (eDerivedStructuralFeatureID(eFeature))
353     {
354       case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER:
355         return getMapper() != null;
356       case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT:
357         return helpedObject != null;
358       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN:
359         return getNestedIn() != null;
360       case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED:
361         return nested != null && !nested.isEmpty();
362       case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT:
363         return in2out != null;
364       case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN:
365         return out2in != null;
366     }
367     return eDynamicIsSet(eFeature);
368   }
369
370 } //ComplexTypeConverterImpl
371
Popular Tags