KickJava   Java API By Example, From Geeks To Geeks.

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


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: FunctionPairImpl.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.EOperation;
27 import org.eclipse.emf.ecore.EStructuralFeature;
28 import org.eclipse.emf.ecore.InternalEObject;
29 import org.eclipse.emf.ecore.impl.ENotificationImpl;
30 import org.eclipse.emf.ecore.util.InternalEList;
31 import org.eclipse.emf.mapping.FunctionPair;
32 import org.eclipse.emf.mapping.Mapping;
33 import org.eclipse.emf.mapping.MappingHelper;
34 import org.eclipse.emf.mapping.MappingPackage;
35
36
37 /**
38  * <!-- begin-user-doc -->
39  * An implementation of the model object '<em><b>Function Pair</b></em>'.
40  * <!-- end-user-doc -->
41  * <p>
42  * The following features are implemented:
43  * <ul>
44  * <li>{@link org.eclipse.emf.mapping.impl.FunctionPairImpl#getIn2out <em>In2out</em>}</li>
45  * <li>{@link org.eclipse.emf.mapping.impl.FunctionPairImpl#getOut2in <em>Out2in</em>}</li>
46  * </ul>
47  * </p>
48  *
49  * @generated
50  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

351   public boolean eIsSet(EStructuralFeature eFeature)
352   {
353     switch (eDerivedStructuralFeatureID(eFeature))
354     {
355       case MappingPackage.FUNCTION_PAIR__MAPPER:
356         return getMapper() != null;
357       case MappingPackage.FUNCTION_PAIR__HELPED_OBJECT:
358         return helpedObject != null;
359       case MappingPackage.FUNCTION_PAIR__NESTED_IN:
360         return getNestedIn() != null;
361       case MappingPackage.FUNCTION_PAIR__NESTED:
362         return nested != null && !nested.isEmpty();
363       case MappingPackage.FUNCTION_PAIR__IN2OUT:
364         return in2out != null;
365       case MappingPackage.FUNCTION_PAIR__OUT2IN:
366         return out2in != null;
367     }
368     return eDynamicIsSet(eFeature);
369   }
370
371 } //FunctionPairImpl
372

373
374
Popular Tags