KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xml > type > impl > AnyTypeImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2003-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: AnyTypeImpl.java,v 1.2 2005/06/08 06:20:10 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.xml.type.impl;
18
19 import java.util.Collection JavaDoc;
20
21 import org.eclipse.emf.common.notify.NotificationChain;
22 import org.eclipse.emf.ecore.EClass;
23 import org.eclipse.emf.ecore.EStructuralFeature;
24 import org.eclipse.emf.ecore.InternalEObject;
25 import org.eclipse.emf.ecore.impl.EObjectImpl;
26 import org.eclipse.emf.ecore.util.BasicFeatureMap;
27 import org.eclipse.emf.ecore.util.FeatureMap;
28 import org.eclipse.emf.ecore.util.InternalEList;
29 import org.eclipse.emf.ecore.xml.type.AnyType;
30 import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
31
32 /**
33  * <!-- begin-user-doc -->
34  * An implementation of the model object '<em><b>Any Type</b></em>'.
35  * <!-- end-user-doc -->
36  * <p>
37  * The following features are implemented:
38  * <ul>
39  * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getMixed <em>Mixed</em>}</li>
40  * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAny <em>Any</em>}</li>
41  * <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAnyAttribute <em>Any Attribute</em>}</li>
42  * </ul>
43  * </p>
44  *
45  * @generated
46  */

47 public class AnyTypeImpl extends EObjectImpl implements AnyType
48 {
49   /**
50    * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
51    * <!-- begin-user-doc -->
52    * <!-- end-user-doc -->
53    * @see #getMixed()
54    * @generated
55    * @ordered
56    */

57   protected FeatureMap mixed = null;
58
59   /**
60    * The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list.
61    * <!-- begin-user-doc -->
62    * <!-- end-user-doc -->
63    * @see #getAnyAttribute()
64    * @generated
65    * @ordered
66    */

67   protected FeatureMap anyAttribute = null;
68
69   /**
70    * <!-- begin-user-doc -->
71    * <!-- end-user-doc -->
72    * @generated
73    */

74   protected AnyTypeImpl()
75   {
76     super();
77   }
78
79   /**
80    * <!-- begin-user-doc -->
81    * <!-- end-user-doc -->
82    * @generated
83    */

84   protected EClass eStaticClass()
85   {
86     return XMLTypePackage.eINSTANCE.getAnyType();
87   }
88
89   /**
90    * <!-- begin-user-doc -->
91    * <!-- end-user-doc -->
92    * @generated
93    */

94   public FeatureMap getMixed()
95   {
96     if (mixed == null)
97     {
98       mixed = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__MIXED);
99     }
100     return mixed;
101   }
102
103   /**
104    * <!-- begin-user-doc -->
105    * <!-- end-user-doc -->
106    * @generated
107    */

108   public FeatureMap getAny()
109   {
110     return (FeatureMap)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any());
111   }
112
113   /**
114    * <!-- begin-user-doc -->
115    * <!-- end-user-doc -->
116    * @generated
117    */

118   public FeatureMap getAnyAttribute()
119   {
120     if (anyAttribute == null)
121     {
122       anyAttribute = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE);
123     }
124     return anyAttribute;
125   }
126
127   /**
128    * <!-- begin-user-doc -->
129    * <!-- end-user-doc -->
130    * @generated
131    */

132   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
133   {
134     if (featureID >= 0)
135     {
136       switch (eDerivedStructuralFeatureID(featureID, baseClass))
137       {
138         case XMLTypePackage.ANY_TYPE__MIXED:
139           return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs);
140         case XMLTypePackage.ANY_TYPE__ANY:
141           return ((InternalEList)getAny()).basicRemove(otherEnd, msgs);
142         case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
143           return ((InternalEList)getAnyAttribute()).basicRemove(otherEnd, msgs);
144         default:
145           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
146       }
147     }
148     return eBasicSetContainer(null, featureID, msgs);
149   }
150
151   /**
152    * <!-- begin-user-doc -->
153    * <!-- end-user-doc -->
154    * @generated
155    */

156   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
157   {
158     switch (eDerivedStructuralFeatureID(eFeature))
159     {
160       case XMLTypePackage.ANY_TYPE__MIXED:
161         return getMixed();
162       case XMLTypePackage.ANY_TYPE__ANY:
163         return getAny();
164       case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
165         return getAnyAttribute();
166     }
167     return eDynamicGet(eFeature, resolve);
168   }
169
170   /**
171    * <!-- begin-user-doc -->
172    * <!-- end-user-doc -->
173    * @generated
174    */

175   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
176   {
177     switch (eDerivedStructuralFeatureID(eFeature))
178     {
179       case XMLTypePackage.ANY_TYPE__MIXED:
180         getMixed().clear();
181         getMixed().addAll((Collection JavaDoc)newValue);
182         return;
183       case XMLTypePackage.ANY_TYPE__ANY:
184         getAny().clear();
185         getAny().addAll((Collection JavaDoc)newValue);
186         return;
187       case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
188         getAnyAttribute().clear();
189         getAnyAttribute().addAll((Collection JavaDoc)newValue);
190         return;
191     }
192     eDynamicSet(eFeature, newValue);
193   }
194
195   /**
196    * <!-- begin-user-doc -->
197    * <!-- end-user-doc -->
198    * @generated
199    */

200   public void eUnset(EStructuralFeature eFeature)
201   {
202     switch (eDerivedStructuralFeatureID(eFeature))
203     {
204       case XMLTypePackage.ANY_TYPE__MIXED:
205         getMixed().clear();
206         return;
207       case XMLTypePackage.ANY_TYPE__ANY:
208         getAny().clear();
209         return;
210       case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
211         getAnyAttribute().clear();
212         return;
213     }
214     eDynamicUnset(eFeature);
215   }
216
217   /**
218    * <!-- begin-user-doc -->
219    * <!-- end-user-doc -->
220    * @generated
221    */

222   public boolean eIsSet(EStructuralFeature eFeature)
223   {
224     switch (eDerivedStructuralFeatureID(eFeature))
225     {
226       case XMLTypePackage.ANY_TYPE__MIXED:
227         return mixed != null && !mixed.isEmpty();
228       case XMLTypePackage.ANY_TYPE__ANY:
229         return !getAny().isEmpty();
230       case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
231         return anyAttribute != null && !anyAttribute.isEmpty();
232     }
233     return eDynamicIsSet(eFeature);
234   }
235
236   /**
237    * <!-- begin-user-doc -->
238    * <!-- end-user-doc -->
239    * @generated
240    */

241   public String JavaDoc toString()
242   {
243     if (eIsProxy()) return super.toString();
244
245     StringBuffer JavaDoc result = new StringBuffer JavaDoc(super.toString());
246     result.append(" (mixed: ");
247     result.append(mixed);
248     result.append(", anyAttribute: ");
249     result.append(anyAttribute);
250     result.append(')');
251     return result.toString();
252   }
253
254 } //AnyTypeImpl
255
Popular Tags