KickJava   Java API By Example, From Geeks To Geeks.

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


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: MappingStrategyImpl.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.NotificationChain;
23 import org.eclipse.emf.ecore.EClass;
24 import org.eclipse.emf.ecore.EObject;
25 import org.eclipse.emf.ecore.EStructuralFeature;
26 import org.eclipse.emf.ecore.InternalEObject;
27 import org.eclipse.emf.ecore.util.InternalEList;
28 import org.eclipse.emf.mapping.Mapping;
29 import org.eclipse.emf.mapping.MappingHelper;
30 import org.eclipse.emf.mapping.MappingPackage;
31 import org.eclipse.emf.mapping.MappingStrategy;
32
33
34 /**
35  * <!-- begin-user-doc -->
36  * An implementation of the model object '<em><b>Strategy</b></em>'.
37  * <!-- end-user-doc -->
38  * <p>
39  * </p>
40  *
41  * @generated
42  */

43 public class MappingStrategyImpl extends MappingHelperImpl implements MappingStrategy
44 {
45   /**
46    * <!-- begin-user-doc -->
47    * <!-- end-user-doc -->
48    * @generated
49    */

50   protected MappingStrategyImpl()
51   {
52     super();
53   }
54
55   /**
56    * <!-- begin-user-doc -->
57    * <!-- end-user-doc -->
58    * @generated
59    */

60   protected EClass eStaticClass()
61   {
62     return MappingPackage.eINSTANCE.getMappingStrategy();
63   }
64
65   /**
66    * <!-- begin-user-doc -->
67    * <!-- end-user-doc -->
68    * @generated
69    */

70   public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
71   {
72     if (featureID >= 0)
73     {
74       switch (eDerivedStructuralFeatureID(featureID, baseClass))
75       {
76         case MappingPackage.MAPPING_STRATEGY__MAPPER:
77           if (eContainer != null)
78             msgs = eBasicRemoveFromContainer(msgs);
79           return eBasicSetContainer(otherEnd, MappingPackage.MAPPING_STRATEGY__MAPPER, msgs);
80         case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
81           if (eContainer != null)
82             msgs = eBasicRemoveFromContainer(msgs);
83           return eBasicSetContainer(otherEnd, MappingPackage.MAPPING_STRATEGY__NESTED_IN, msgs);
84         case MappingPackage.MAPPING_STRATEGY__NESTED:
85           return ((InternalEList)getNested()).basicAdd(otherEnd, msgs);
86         default:
87           return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
88       }
89     }
90     if (eContainer != null)
91       msgs = eBasicRemoveFromContainer(msgs);
92     return eBasicSetContainer(otherEnd, featureID, msgs);
93   }
94
95   /**
96    * <!-- begin-user-doc -->
97    * <!-- end-user-doc -->
98    * @generated
99    */

100   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
101   {
102     if (featureID >= 0)
103     {
104       switch (eDerivedStructuralFeatureID(featureID, baseClass))
105       {
106         case MappingPackage.MAPPING_STRATEGY__MAPPER:
107           return eBasicSetContainer(null, MappingPackage.MAPPING_STRATEGY__MAPPER, msgs);
108         case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
109           return eBasicSetContainer(null, MappingPackage.MAPPING_STRATEGY__NESTED_IN, msgs);
110         case MappingPackage.MAPPING_STRATEGY__NESTED:
111           return ((InternalEList)getNested()).basicRemove(otherEnd, msgs);
112         default:
113           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
114       }
115     }
116     return eBasicSetContainer(null, featureID, msgs);
117   }
118
119   /**
120    * <!-- begin-user-doc -->
121    * <!-- end-user-doc -->
122    * @generated
123    */

124   public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs)
125   {
126     if (eContainerFeatureID >= 0)
127     {
128       switch (eContainerFeatureID)
129       {
130         case MappingPackage.MAPPING_STRATEGY__MAPPER:
131           return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs);
132         case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
133           return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
134         default:
135           return eDynamicBasicRemoveFromContainer(msgs);
136       }
137     }
138     return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
139   }
140
141   /**
142    * <!-- begin-user-doc -->
143    * <!-- end-user-doc -->
144    * @generated
145    */

146   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
147   {
148     switch (eDerivedStructuralFeatureID(eFeature))
149     {
150       case MappingPackage.MAPPING_STRATEGY__MAPPER:
151         return getMapper();
152       case MappingPackage.MAPPING_STRATEGY__HELPED_OBJECT:
153         if (resolve) return getHelpedObject();
154         return basicGetHelpedObject();
155       case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
156         return getNestedIn();
157       case MappingPackage.MAPPING_STRATEGY__NESTED:
158         return getNested();
159     }
160     return eDynamicGet(eFeature, resolve);
161   }
162
163   /**
164    * <!-- begin-user-doc -->
165    * <!-- end-user-doc -->
166    * @generated
167    */

168   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
169   {
170     switch (eDerivedStructuralFeatureID(eFeature))
171     {
172       case MappingPackage.MAPPING_STRATEGY__MAPPER:
173         setMapper((Mapping)newValue);
174         return;
175       case MappingPackage.MAPPING_STRATEGY__HELPED_OBJECT:
176         setHelpedObject((EObject)newValue);
177         return;
178       case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
179         setNestedIn((MappingHelper)newValue);
180         return;
181       case MappingPackage.MAPPING_STRATEGY__NESTED:
182         getNested().clear();
183         getNested().addAll((Collection JavaDoc)newValue);
184         return;
185     }
186     eDynamicSet(eFeature, newValue);
187   }
188
189   /**
190    * <!-- begin-user-doc -->
191    * <!-- end-user-doc -->
192    * @generated
193    */

194   public void eUnset(EStructuralFeature eFeature)
195   {
196     switch (eDerivedStructuralFeatureID(eFeature))
197     {
198       case MappingPackage.MAPPING_STRATEGY__MAPPER:
199         setMapper((Mapping)null);
200         return;
201       case MappingPackage.MAPPING_STRATEGY__HELPED_OBJECT:
202         setHelpedObject((EObject)null);
203         return;
204       case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
205         setNestedIn((MappingHelper)null);
206         return;
207       case MappingPackage.MAPPING_STRATEGY__NESTED:
208         getNested().clear();
209         return;
210     }
211     eDynamicUnset(eFeature);
212   }
213
214   /**
215    * <!-- begin-user-doc -->
216    * <!-- end-user-doc -->
217    * @generated
218    */

219   public boolean eIsSet(EStructuralFeature eFeature)
220   {
221     switch (eDerivedStructuralFeatureID(eFeature))
222     {
223       case MappingPackage.MAPPING_STRATEGY__MAPPER:
224         return getMapper() != null;
225       case MappingPackage.MAPPING_STRATEGY__HELPED_OBJECT:
226         return helpedObject != null;
227       case MappingPackage.MAPPING_STRATEGY__NESTED_IN:
228         return getNestedIn() != null;
229       case MappingPackage.MAPPING_STRATEGY__NESTED:
230         return nested != null && !nested.isEmpty();
231     }
232     return eDynamicIsSet(eFeature);
233   }
234
235 } //MappingStrategyImpl
236

237
Popular Tags