KickJava   Java API By Example, From Geeks To Geeks.

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


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: FunctionNamePairImpl.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.FunctionNamePair;
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>Function Name Pair</b></em>'.
39  * <!-- end-user-doc -->
40  * <p>
41  * The following features are implemented:
42  * <ul>
43  * <li>{@link org.eclipse.emf.mapping.impl.FunctionNamePairImpl#getIn2out <em>In2out</em>}</li>
44  * <li>{@link org.eclipse.emf.mapping.impl.FunctionNamePairImpl#getOut2in <em>Out2in</em>}</li>
45  * </ul>
46  * </p>
47  *
48  * @generated
49  */

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

60   protected static final String JavaDoc IN2OUT_EDEFAULT = null;
61
62   /**
63    * The cached value of the '{@link #getIn2out() <em>In2out</em>}' attribute.
64    * <!-- begin-user-doc -->
65    * <!-- end-user-doc -->
66    * @see #getIn2out()
67    * @generated
68    * @ordered
69    */

70   protected String JavaDoc in2out = IN2OUT_EDEFAULT;
71
72   /**
73    * The default value of the '{@link #getOut2in() <em>Out2in</em>}' attribute.
74    * <!-- begin-user-doc -->
75    * <!-- end-user-doc -->
76    * @see #getOut2in()
77    * @generated
78    * @ordered
79    */

80   protected static final String JavaDoc OUT2IN_EDEFAULT = null;
81
82   /**
83    * The cached value of the '{@link #getOut2in() <em>Out2in</em>}' attribute.
84    * <!-- begin-user-doc -->
85    * <!-- end-user-doc -->
86    * @see #getOut2in()
87    * @generated
88    * @ordered
89    */

90   protected String JavaDoc out2in = OUT2IN_EDEFAULT;
91
92   /**
93    * <!-- begin-user-doc -->
94    * <!-- end-user-doc -->
95    * @generated
96    */

97   protected FunctionNamePairImpl()
98   {
99     super();
100   }
101
102   /**
103    * <!-- begin-user-doc -->
104    * <!-- end-user-doc -->
105    * @generated
106    */

107   protected EClass eStaticClass()
108   {
109     return MappingPackage.eINSTANCE.getFunctionNamePair();
110   }
111
112   /**
113    * <!-- begin-user-doc -->
114    * <!-- end-user-doc -->
115    * @generated
116    */

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

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

140   public String JavaDoc getOut2in()
141   {
142     return out2in;
143   }
144
145   /**
146    * <!-- begin-user-doc -->
147    * <!-- end-user-doc -->
148    * @generated
149    */

150   public void setOut2in(String JavaDoc newOut2in)
151   {
152     String JavaDoc oldOut2in = out2in;
153     out2in = newOut2in;
154     if (eNotificationRequired())
155       eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.FUNCTION_NAME_PAIR__OUT2IN, oldOut2in, out2in));
156   }
157
158   /**
159    * <!-- begin-user-doc -->
160    * <!-- end-user-doc -->
161    * @generated
162    */

163   public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
164   {
165     if (featureID >= 0)
166     {
167       switch (eDerivedStructuralFeatureID(featureID, baseClass))
168       {
169         case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
170           if (eContainer != null)
171             msgs = eBasicRemoveFromContainer(msgs);
172           return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_NAME_PAIR__MAPPER, msgs);
173         case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
174           if (eContainer != null)
175             msgs = eBasicRemoveFromContainer(msgs);
176           return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN, msgs);
177         case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
178           return ((InternalEList)getNested()).basicAdd(otherEnd, msgs);
179         default:
180           return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
181       }
182     }
183     if (eContainer != null)
184       msgs = eBasicRemoveFromContainer(msgs);
185     return eBasicSetContainer(otherEnd, featureID, msgs);
186   }
187
188   /**
189    * <!-- begin-user-doc -->
190    * <!-- end-user-doc -->
191    * @generated
192    */

193   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
194   {
195     if (featureID >= 0)
196     {
197       switch (eDerivedStructuralFeatureID(featureID, baseClass))
198       {
199         case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
200           return eBasicSetContainer(null, MappingPackage.FUNCTION_NAME_PAIR__MAPPER, msgs);
201         case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
202           return eBasicSetContainer(null, MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN, msgs);
203         case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
204           return ((InternalEList)getNested()).basicRemove(otherEnd, msgs);
205         default:
206           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
207       }
208     }
209     return eBasicSetContainer(null, featureID, msgs);
210   }
211
212   /**
213    * <!-- begin-user-doc -->
214    * <!-- end-user-doc -->
215    * @generated
216    */

217   public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs)
218   {
219     if (eContainerFeatureID >= 0)
220     {
221       switch (eContainerFeatureID)
222       {
223         case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
224           return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs);
225         case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
226           return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
227         default:
228           return eDynamicBasicRemoveFromContainer(msgs);
229       }
230     }
231     return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
232   }
233
234   /**
235    * <!-- begin-user-doc -->
236    * <!-- end-user-doc -->
237    * @generated
238    */

239   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
240   {
241     switch (eDerivedStructuralFeatureID(eFeature))
242     {
243       case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
244         return getMapper();
245       case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT:
246         if (resolve) return getHelpedObject();
247         return basicGetHelpedObject();
248       case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
249         return getNestedIn();
250       case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
251         return getNested();
252       case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT:
253         return getIn2out();
254       case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN:
255         return getOut2in();
256     }
257     return eDynamicGet(eFeature, resolve);
258   }
259
260   /**
261    * <!-- begin-user-doc -->
262    * <!-- end-user-doc -->
263    * @generated
264    */

265   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
266   {
267     switch (eDerivedStructuralFeatureID(eFeature))
268     {
269       case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
270         setMapper((Mapping)newValue);
271         return;
272       case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT:
273         setHelpedObject((EObject)newValue);
274         return;
275       case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
276         setNestedIn((MappingHelper)newValue);
277         return;
278       case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
279         getNested().clear();
280         getNested().addAll((Collection JavaDoc)newValue);
281         return;
282       case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT:
283         setIn2out((String JavaDoc)newValue);
284         return;
285       case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN:
286         setOut2in((String JavaDoc)newValue);
287         return;
288     }
289     eDynamicSet(eFeature, newValue);
290   }
291
292   /**
293    * <!-- begin-user-doc -->
294    * <!-- end-user-doc -->
295    * @generated
296    */

297   public void eUnset(EStructuralFeature eFeature)
298   {
299     switch (eDerivedStructuralFeatureID(eFeature))
300     {
301       case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
302         setMapper((Mapping)null);
303         return;
304       case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT:
305         setHelpedObject((EObject)null);
306         return;
307       case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
308         setNestedIn((MappingHelper)null);
309         return;
310       case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
311         getNested().clear();
312         return;
313       case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT:
314         setIn2out(IN2OUT_EDEFAULT);
315         return;
316       case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN:
317         setOut2in(OUT2IN_EDEFAULT);
318         return;
319     }
320     eDynamicUnset(eFeature);
321   }
322
323   /**
324    * <!-- begin-user-doc -->
325    * <!-- end-user-doc -->
326    * @generated
327    */

328   public boolean eIsSet(EStructuralFeature eFeature)
329   {
330     switch (eDerivedStructuralFeatureID(eFeature))
331     {
332       case MappingPackage.FUNCTION_NAME_PAIR__MAPPER:
333         return getMapper() != null;
334       case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT:
335         return helpedObject != null;
336       case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN:
337         return getNestedIn() != null;
338       case MappingPackage.FUNCTION_NAME_PAIR__NESTED:
339         return nested != null && !nested.isEmpty();
340       case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT:
341         return IN2OUT_EDEFAULT == null ? in2out != null : !IN2OUT_EDEFAULT.equals(in2out);
342       case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN:
343         return OUT2IN_EDEFAULT == null ? out2in != null : !OUT2IN_EDEFAULT.equals(out2in);
344     }
345     return eDynamicIsSet(eFeature);
346   }
347
348   /**
349    * <!-- begin-user-doc -->
350    * <!-- end-user-doc -->
351    * @generated
352    */

353   public String JavaDoc toString()
354   {
355     if (eIsProxy()) return super.toString();
356
357     StringBuffer JavaDoc result = new StringBuffer JavaDoc(super.toString());
358     result.append(" (in2out: ");
359     result.append(in2out);
360     result.append(", out2in: ");
361     result.append(out2in);
362     result.append(')');
363     return result.toString();
364   }
365
366 } //FunctionNamePairImpl
367
Popular Tags