KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > impl > EParameterImpl


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: EParameterImpl.java,v 1.5 2005/06/08 06:20:10 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.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.EClassifier;
25 import org.eclipse.emf.ecore.EOperation;
26 import org.eclipse.emf.ecore.EParameter;
27 import org.eclipse.emf.ecore.EStructuralFeature;
28 import org.eclipse.emf.ecore.EcorePackage;
29 import org.eclipse.emf.ecore.InternalEObject;
30 import org.eclipse.emf.ecore.util.InternalEList;
31
32
33 /**
34  * <!-- begin-user-doc -->
35  * An implementation of the model object '<em><b>EParameter</b></em>'.
36  * <!-- end-user-doc -->
37  * <p>
38  * The following features are implemented:
39  * <ul>
40  * <li>{@link org.eclipse.emf.ecore.impl.EParameterImpl#getEOperation <em>EOperation</em>}</li>
41  * </ul>
42  * </p>
43  *
44  * @generated
45  */

46 public class EParameterImpl extends ETypedElementImpl implements EParameter
47 {
48   /**
49    * <!-- begin-user-doc -->
50    * <!-- end-user-doc -->
51    * @generated
52    */

53   protected EParameterImpl()
54   {
55     super();
56   }
57
58   /**
59    * <!-- begin-user-doc -->
60    * <!-- end-user-doc -->
61    * @generated
62    */

63   protected EClass eStaticClass()
64   {
65     return EcorePackage.eINSTANCE.getEParameter();
66   }
67
68   /**
69    * <!-- begin-user-doc -->
70    * <!-- end-user-doc -->
71    * @generated modifiable
72    */

73   public EOperation getEOperation()
74   {
75     return (eContainerFeatureID == EcorePackage.EPARAMETER__EOPERATION) ? (EOperation)eContainer : null;
76   }
77
78   /**
79    * <!-- begin-user-doc -->
80    * <!-- end-user-doc -->
81    * @generated
82    */

83   public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
84   {
85     if (featureID >= 0)
86     {
87       switch (eDerivedStructuralFeatureID(featureID, baseClass))
88       {
89         case EcorePackage.EPARAMETER__EANNOTATIONS:
90           return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs);
91         case EcorePackage.EPARAMETER__EOPERATION:
92           if (eContainer != null)
93             msgs = eBasicRemoveFromContainer(msgs);
94           return eBasicSetContainer(otherEnd, EcorePackage.EPARAMETER__EOPERATION, msgs);
95         default:
96           return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
97       }
98     }
99     if (eContainer != null)
100       msgs = eBasicRemoveFromContainer(msgs);
101     return eBasicSetContainer(otherEnd, featureID, msgs);
102   }
103
104   /**
105    * <!-- begin-user-doc -->
106    * <!-- end-user-doc -->
107    * @generated
108    */

109   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
110   {
111     if (featureID >= 0)
112     {
113       switch (eDerivedStructuralFeatureID(featureID, baseClass))
114       {
115         case EcorePackage.EPARAMETER__EANNOTATIONS:
116           return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
117         case EcorePackage.EPARAMETER__EOPERATION:
118           return eBasicSetContainer(null, EcorePackage.EPARAMETER__EOPERATION, msgs);
119         default:
120           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
121       }
122     }
123     return eBasicSetContainer(null, featureID, msgs);
124   }
125
126   /**
127    * <!-- begin-user-doc -->
128    * <!-- end-user-doc -->
129    * @generated
130    */

131   public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs)
132   {
133     if (eContainerFeatureID >= 0)
134     {
135       switch (eContainerFeatureID)
136       {
137         case EcorePackage.EPARAMETER__EOPERATION:
138           return eContainer.eInverseRemove(this, EcorePackage.EOPERATION__EPARAMETERS, EOperation.class, msgs);
139         default:
140           return eDynamicBasicRemoveFromContainer(msgs);
141       }
142     }
143     return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
144   }
145
146   /**
147    * <!-- begin-user-doc -->
148    * <!-- end-user-doc -->
149    * @generated
150    */

151   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
152   {
153     switch (eDerivedStructuralFeatureID(eFeature))
154     {
155       case EcorePackage.EPARAMETER__EANNOTATIONS:
156         return getEAnnotations();
157       case EcorePackage.EPARAMETER__NAME:
158         return getName();
159       case EcorePackage.EPARAMETER__ORDERED:
160         return isOrdered() ? Boolean.TRUE : Boolean.FALSE;
161       case EcorePackage.EPARAMETER__UNIQUE:
162         return isUnique() ? Boolean.TRUE : Boolean.FALSE;
163       case EcorePackage.EPARAMETER__LOWER_BOUND:
164         return new Integer JavaDoc(getLowerBound());
165       case EcorePackage.EPARAMETER__UPPER_BOUND:
166         return new Integer JavaDoc(getUpperBound());
167       case EcorePackage.EPARAMETER__MANY:
168         return isMany() ? Boolean.TRUE : Boolean.FALSE;
169       case EcorePackage.EPARAMETER__REQUIRED:
170         return isRequired() ? Boolean.TRUE : Boolean.FALSE;
171       case EcorePackage.EPARAMETER__ETYPE:
172         if (resolve) return getEType();
173         return basicGetEType();
174       case EcorePackage.EPARAMETER__EOPERATION:
175         return getEOperation();
176     }
177     return eDynamicGet(eFeature, resolve);
178   }
179
180   /**
181    * <!-- begin-user-doc -->
182    * <!-- end-user-doc -->
183    * @generated
184    */

185   public boolean eIsSet(EStructuralFeature eFeature)
186   {
187     switch (eDerivedStructuralFeatureID(eFeature))
188     {
189       case EcorePackage.EPARAMETER__EANNOTATIONS:
190         return eAnnotations != null && !eAnnotations.isEmpty();
191       case EcorePackage.EPARAMETER__NAME:
192         return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
193       case EcorePackage.EPARAMETER__ORDERED:
194         return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT;
195       case EcorePackage.EPARAMETER__UNIQUE:
196         return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT;
197       case EcorePackage.EPARAMETER__LOWER_BOUND:
198         return lowerBound != LOWER_BOUND_EDEFAULT;
199       case EcorePackage.EPARAMETER__UPPER_BOUND:
200         return upperBound != UPPER_BOUND_EDEFAULT;
201       case EcorePackage.EPARAMETER__MANY:
202         return isMany() != MANY_EDEFAULT;
203       case EcorePackage.EPARAMETER__REQUIRED:
204         return isRequired() != REQUIRED_EDEFAULT;
205       case EcorePackage.EPARAMETER__ETYPE:
206         return eType != null;
207       case EcorePackage.EPARAMETER__EOPERATION:
208         return getEOperation() != null;
209     }
210     return eDynamicIsSet(eFeature);
211   }
212
213   /**
214    * <!-- begin-user-doc -->
215    * <!-- end-user-doc -->
216    * @generated
217    */

218   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
219   {
220     switch (eDerivedStructuralFeatureID(eFeature))
221     {
222       case EcorePackage.EPARAMETER__EANNOTATIONS:
223         getEAnnotations().clear();
224         getEAnnotations().addAll((Collection JavaDoc)newValue);
225         return;
226       case EcorePackage.EPARAMETER__NAME:
227         setName((String JavaDoc)newValue);
228         return;
229       case EcorePackage.EPARAMETER__ORDERED:
230         setOrdered(((Boolean JavaDoc)newValue).booleanValue());
231         return;
232       case EcorePackage.EPARAMETER__UNIQUE:
233         setUnique(((Boolean JavaDoc)newValue).booleanValue());
234         return;
235       case EcorePackage.EPARAMETER__LOWER_BOUND:
236         setLowerBound(((Integer JavaDoc)newValue).intValue());
237         return;
238       case EcorePackage.EPARAMETER__UPPER_BOUND:
239         setUpperBound(((Integer JavaDoc)newValue).intValue());
240         return;
241       case EcorePackage.EPARAMETER__ETYPE:
242         setEType((EClassifier)newValue);
243         return;
244     }
245     eDynamicSet(eFeature, newValue);
246   }
247
248   /**
249    * <!-- begin-user-doc -->
250    * <!-- end-user-doc -->
251    * @generated
252    */

253   public void eUnset(EStructuralFeature eFeature)
254   {
255     switch (eDerivedStructuralFeatureID(eFeature))
256     {
257       case EcorePackage.EPARAMETER__EANNOTATIONS:
258         getEAnnotations().clear();
259         return;
260       case EcorePackage.EPARAMETER__NAME:
261         setName(NAME_EDEFAULT);
262         return;
263       case EcorePackage.EPARAMETER__ORDERED:
264         setOrdered(ORDERED_EDEFAULT);
265         return;
266       case EcorePackage.EPARAMETER__UNIQUE:
267         setUnique(UNIQUE_EDEFAULT);
268         return;
269       case EcorePackage.EPARAMETER__LOWER_BOUND:
270         setLowerBound(LOWER_BOUND_EDEFAULT);
271         return;
272       case EcorePackage.EPARAMETER__UPPER_BOUND:
273         setUpperBound(UPPER_BOUND_EDEFAULT);
274         return;
275       case EcorePackage.EPARAMETER__ETYPE:
276         setEType((EClassifier)null);
277         return;
278     }
279     eDynamicUnset(eFeature);
280   }
281
282 } //EParameterImpl
283
Popular Tags