KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xml > namespace > impl > XMLNamespaceDocumentRootImpl


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

17 package org.eclipse.emf.ecore.xml.namespace.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.common.util.EMap;
25 import org.eclipse.emf.ecore.EClass;
26 import org.eclipse.emf.ecore.EStructuralFeature;
27 import org.eclipse.emf.ecore.EcorePackage;
28 import org.eclipse.emf.ecore.InternalEObject;
29 import org.eclipse.emf.ecore.impl.ENotificationImpl;
30 import org.eclipse.emf.ecore.impl.EObjectImpl;
31 import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
32 import org.eclipse.emf.ecore.util.BasicFeatureMap;
33 import org.eclipse.emf.ecore.util.EcoreEMap;
34 import org.eclipse.emf.ecore.util.FeatureMap;
35 import org.eclipse.emf.ecore.util.InternalEList;
36 import org.eclipse.emf.ecore.xml.namespace.SpaceType;
37 import org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot;
38 import org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage;
39
40
41 /**
42  * <!-- begin-user-doc -->
43  * An implementation of the model object '<em><b>Document Root</b></em>'.
44  * <!-- end-user-doc -->
45  * <p>
46  * The following features are implemented:
47  * <ul>
48  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getMixed <em>Mixed</em>}</li>
49  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li>
50  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getXSISchemaLocation <em>XSI Schema Location</em>}</li>
51  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getBase <em>Base</em>}</li>
52  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getId <em>Id</em>}</li>
53  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getLang <em>Lang</em>}</li>
54  * <li>{@link org.eclipse.emf.ecore.xml.namespace.impl.XMLNamespaceDocumentRootImpl#getSpace <em>Space</em>}</li>
55  * </ul>
56  * </p>
57  *
58  * @generated
59  */

60 public class XMLNamespaceDocumentRootImpl extends EObjectImpl implements XMLNamespaceDocumentRoot
61 {
62   /**
63    * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
64    * <!-- begin-user-doc -->
65    * <!-- end-user-doc -->
66    * @see #getMixed()
67    * @generated
68    * @ordered
69    */

70   protected FeatureMap mixed = null;
71
72   /**
73    * The cached value of the '{@link #getXMLNSPrefixMap() <em>XMLNS Prefix Map</em>}' map.
74    * <!-- begin-user-doc -->
75    * <!-- end-user-doc -->
76    * @see #getXMLNSPrefixMap()
77    * @generated
78    * @ordered
79    */

80   protected EMap xMLNSPrefixMap = null;
81
82   /**
83    * The cached value of the '{@link #getXSISchemaLocation() <em>XSI Schema Location</em>}' map.
84    * <!-- begin-user-doc -->
85    * <!-- end-user-doc -->
86    * @see #getXSISchemaLocation()
87    * @generated
88    * @ordered
89    */

90   protected EMap xSISchemaLocation = null;
91
92   /**
93    * The default value of the '{@link #getBase() <em>Base</em>}' attribute.
94    * <!-- begin-user-doc -->
95    * <!-- end-user-doc -->
96    * @see #getBase()
97    * @generated
98    * @ordered
99    */

100   protected static final String JavaDoc BASE_EDEFAULT = null;
101
102   /**
103    * The cached value of the '{@link #getBase() <em>Base</em>}' attribute.
104    * <!-- begin-user-doc -->
105    * <!-- end-user-doc -->
106    * @see #getBase()
107    * @generated
108    * @ordered
109    */

110   protected String JavaDoc base = BASE_EDEFAULT;
111
112   /**
113    * The default value of the '{@link #getId() <em>Id</em>}' attribute.
114    * <!-- begin-user-doc -->
115    * <!-- end-user-doc -->
116    * @see #getId()
117    * @generated
118    * @ordered
119    */

120   protected static final String JavaDoc ID_EDEFAULT = null;
121
122   /**
123    * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
124    * <!-- begin-user-doc -->
125    * <!-- end-user-doc -->
126    * @see #getId()
127    * @generated
128    * @ordered
129    */

130   protected String JavaDoc id = ID_EDEFAULT;
131
132   /**
133    * The default value of the '{@link #getLang() <em>Lang</em>}' attribute.
134    * <!-- begin-user-doc -->
135    * <!-- end-user-doc -->
136    * @see #getLang()
137    * @generated
138    * @ordered
139    */

140   protected static final String JavaDoc LANG_EDEFAULT = null;
141
142   /**
143    * The cached value of the '{@link #getLang() <em>Lang</em>}' attribute.
144    * <!-- begin-user-doc -->
145    * <!-- end-user-doc -->
146    * @see #getLang()
147    * @generated
148    * @ordered
149    */

150   protected String JavaDoc lang = LANG_EDEFAULT;
151
152   /**
153    * The default value of the '{@link #getSpace() <em>Space</em>}' attribute.
154    * <!-- begin-user-doc -->
155    * <!-- end-user-doc -->
156    * @see #getSpace()
157    * @generated
158    * @ordered
159    */

160   protected static final SpaceType SPACE_EDEFAULT = SpaceType.PRESERVE_LITERAL;
161
162   /**
163    * The cached value of the '{@link #getSpace() <em>Space</em>}' attribute.
164    * <!-- begin-user-doc -->
165    * <!-- end-user-doc -->
166    * @see #getSpace()
167    * @generated
168    * @ordered
169    */

170   protected SpaceType space = SPACE_EDEFAULT;
171
172   /**
173    * This is true if the Space attribute has been set.
174    * <!-- begin-user-doc -->
175    * <!-- end-user-doc -->
176    * @generated
177    * @ordered
178    */

179   protected boolean spaceESet = false;
180
181   /**
182    * <!-- begin-user-doc -->
183    * <!-- end-user-doc -->
184    * @generated
185    */

186   protected XMLNamespaceDocumentRootImpl()
187   {
188     super();
189   }
190
191   /**
192    * <!-- begin-user-doc -->
193    * <!-- end-user-doc -->
194    * @generated
195    */

196   protected EClass eStaticClass()
197   {
198     return XMLNamespacePackage.eINSTANCE.getXMLNamespaceDocumentRoot();
199   }
200
201   /**
202    * <!-- begin-user-doc -->
203    * <!-- end-user-doc -->
204    * @generated
205    */

206   public FeatureMap getMixed()
207   {
208     if (mixed == null)
209     {
210       mixed = new BasicFeatureMap(this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED);
211     }
212     return mixed;
213   }
214
215   /**
216    * <!-- begin-user-doc -->
217    * <!-- end-user-doc -->
218    * @generated
219    */

220   public EMap getXMLNSPrefixMap()
221   {
222     if (xMLNSPrefixMap == null)
223     {
224       xMLNSPrefixMap = new EcoreEMap(EcorePackage.eINSTANCE.getEStringToStringMapEntry(), EStringToStringMapEntryImpl.class, this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
225     }
226     return xMLNSPrefixMap;
227   }
228
229   /**
230    * <!-- begin-user-doc -->
231    * <!-- end-user-doc -->
232    * @generated
233    */

234   public EMap getXSISchemaLocation()
235   {
236     if (xSISchemaLocation == null)
237     {
238       xSISchemaLocation = new EcoreEMap(EcorePackage.eINSTANCE.getEStringToStringMapEntry(), EStringToStringMapEntryImpl.class, this, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
239     }
240     return xSISchemaLocation;
241   }
242
243   /**
244    * <!-- begin-user-doc -->
245    * <!-- end-user-doc -->
246    * @generated
247    */

248   public String JavaDoc getBase()
249   {
250     return base;
251   }
252
253   /**
254    * <!-- begin-user-doc -->
255    * <!-- end-user-doc -->
256    * @generated
257    */

258   public void setBase(String JavaDoc newBase)
259   {
260     String JavaDoc oldBase = base;
261     base = newBase;
262     if (eNotificationRequired())
263       eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE, oldBase, base));
264   }
265
266   /**
267    * <!-- begin-user-doc -->
268    * <!-- end-user-doc -->
269    * @generated
270    */

271   public String JavaDoc getId()
272   {
273     return id;
274   }
275
276   /**
277    * <!-- begin-user-doc -->
278    * <!-- end-user-doc -->
279    * @generated
280    */

281   public void setId(String JavaDoc newId)
282   {
283     String JavaDoc oldId = id;
284     id = newId;
285     if (eNotificationRequired())
286       eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID, oldId, id));
287   }
288
289   /**
290    * <!-- begin-user-doc -->
291    * <!-- end-user-doc -->
292    * @generated
293    */

294   public String JavaDoc getLang()
295   {
296     return lang;
297   }
298
299   /**
300    * <!-- begin-user-doc -->
301    * <!-- end-user-doc -->
302    * @generated
303    */

304   public void setLang(String JavaDoc newLang)
305   {
306     String JavaDoc oldLang = lang;
307     lang = newLang;
308     if (eNotificationRequired())
309       eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG, oldLang, lang));
310   }
311
312   /**
313    * <!-- begin-user-doc -->
314    * <!-- end-user-doc -->
315    * @generated
316    */

317   public SpaceType getSpace()
318   {
319     return space;
320   }
321
322   /**
323    * <!-- begin-user-doc -->
324    * <!-- end-user-doc -->
325    * @generated
326    */

327   public void setSpace(SpaceType newSpace)
328   {
329     SpaceType oldSpace = space;
330     space = newSpace == null ? SPACE_EDEFAULT : newSpace;
331     boolean oldSpaceESet = spaceESet;
332     spaceESet = true;
333     if (eNotificationRequired())
334       eNotify(new ENotificationImpl(this, Notification.SET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE, oldSpace, space, !oldSpaceESet));
335   }
336
337   /**
338    * <!-- begin-user-doc -->
339    * <!-- end-user-doc -->
340    * @generated
341    */

342   public void unsetSpace()
343   {
344     SpaceType oldSpace = space;
345     boolean oldSpaceESet = spaceESet;
346     space = SPACE_EDEFAULT;
347     spaceESet = false;
348     if (eNotificationRequired())
349       eNotify(new ENotificationImpl(this, Notification.UNSET, XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE, oldSpace, SPACE_EDEFAULT, oldSpaceESet));
350   }
351
352   /**
353    * <!-- begin-user-doc -->
354    * <!-- end-user-doc -->
355    * @generated
356    */

357   public boolean isSetSpace()
358   {
359     return spaceESet;
360   }
361
362   /**
363    * <!-- begin-user-doc -->
364    * <!-- end-user-doc -->
365    * @generated
366    */

367   public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class JavaDoc baseClass, NotificationChain msgs)
368   {
369     if (featureID >= 0)
370     {
371       switch (eDerivedStructuralFeatureID(featureID, baseClass))
372       {
373         case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED:
374           return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs);
375         case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
376           return ((InternalEList)getXMLNSPrefixMap()).basicRemove(otherEnd, msgs);
377         case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
378           return ((InternalEList)getXSISchemaLocation()).basicRemove(otherEnd, msgs);
379         default:
380           return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
381       }
382     }
383     return eBasicSetContainer(null, featureID, msgs);
384   }
385
386   /**
387    * <!-- begin-user-doc -->
388    * <!-- end-user-doc -->
389    * @generated
390    */

391   public Object JavaDoc eGet(EStructuralFeature eFeature, boolean resolve)
392   {
393     switch (eDerivedStructuralFeatureID(eFeature))
394     {
395       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED:
396         return getMixed();
397       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
398         return getXMLNSPrefixMap();
399       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
400         return getXSISchemaLocation();
401       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE:
402         return getBase();
403       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID:
404         return getId();
405       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG:
406         return getLang();
407       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE:
408         return getSpace();
409     }
410     return eDynamicGet(eFeature, resolve);
411   }
412
413   /**
414    * <!-- begin-user-doc -->
415    * <!-- end-user-doc -->
416    * @generated
417    */

418   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
419   {
420     switch (eDerivedStructuralFeatureID(eFeature))
421     {
422       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED:
423         getMixed().clear();
424         getMixed().addAll((Collection JavaDoc)newValue);
425         return;
426       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
427         getXMLNSPrefixMap().clear();
428         getXMLNSPrefixMap().addAll((Collection JavaDoc)newValue);
429         return;
430       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
431         getXSISchemaLocation().clear();
432         getXSISchemaLocation().addAll((Collection JavaDoc)newValue);
433         return;
434       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE:
435         setBase((String JavaDoc)newValue);
436         return;
437       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID:
438         setId((String JavaDoc)newValue);
439         return;
440       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG:
441         setLang((String JavaDoc)newValue);
442         return;
443       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE:
444         setSpace((SpaceType)newValue);
445         return;
446     }
447     eDynamicSet(eFeature, newValue);
448   }
449
450   /**
451    * <!-- begin-user-doc -->
452    * <!-- end-user-doc -->
453    * @generated
454    */

455   public void eUnset(EStructuralFeature eFeature)
456   {
457     switch (eDerivedStructuralFeatureID(eFeature))
458     {
459       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED:
460         getMixed().clear();
461         return;
462       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
463         getXMLNSPrefixMap().clear();
464         return;
465       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
466         getXSISchemaLocation().clear();
467         return;
468       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE:
469         setBase(BASE_EDEFAULT);
470         return;
471       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID:
472         setId(ID_EDEFAULT);
473         return;
474       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG:
475         setLang(LANG_EDEFAULT);
476         return;
477       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE:
478         unsetSpace();
479         return;
480     }
481     eDynamicUnset(eFeature);
482   }
483
484   /**
485    * <!-- begin-user-doc -->
486    * <!-- end-user-doc -->
487    * @generated
488    */

489   public boolean eIsSet(EStructuralFeature eFeature)
490   {
491     switch (eDerivedStructuralFeatureID(eFeature))
492     {
493       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED:
494         return mixed != null && !mixed.isEmpty();
495       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
496         return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty();
497       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
498         return xSISchemaLocation != null && !xSISchemaLocation.isEmpty();
499       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE:
500         return BASE_EDEFAULT == null ? base != null : !BASE_EDEFAULT.equals(base);
501       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID:
502         return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
503       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG:
504         return LANG_EDEFAULT == null ? lang != null : !LANG_EDEFAULT.equals(lang);
505       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__SPACE:
506         return isSetSpace();
507     }
508     return eDynamicIsSet(eFeature);
509   }
510
511   /**
512    * <!-- begin-user-doc -->
513    * <!-- end-user-doc -->
514    * @generated
515    */

516   public String JavaDoc toString()
517   {
518     if (eIsProxy()) return super.toString();
519
520     StringBuffer JavaDoc result = new StringBuffer JavaDoc(super.toString());
521     result.append(" (mixed: ");
522     result.append(mixed);
523     result.append(", base: ");
524     result.append(base);
525     result.append(", id: ");
526     result.append(id);
527     result.append(", lang: ");
528     result.append(lang);
529     result.append(", space: ");
530     if (spaceESet) result.append(space); else result.append("<unset>");
531     result.append(')');
532     return result.toString();
533   }
534
535 } //XMLNamespaceDocumentRootImpl
536
Popular Tags