1 17 package org.eclipse.emf.ecore.xml.namespace.impl; 18 19 20 import java.util.Collection ; 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 60 public class XMLNamespaceDocumentRootImpl extends EObjectImpl implements XMLNamespaceDocumentRoot 61 { 62 70 protected FeatureMap mixed = null; 71 72 80 protected EMap xMLNSPrefixMap = null; 81 82 90 protected EMap xSISchemaLocation = null; 91 92 100 protected static final String BASE_EDEFAULT = null; 101 102 110 protected String base = BASE_EDEFAULT; 111 112 120 protected static final String ID_EDEFAULT = null; 121 122 130 protected String id = ID_EDEFAULT; 131 132 140 protected static final String LANG_EDEFAULT = null; 141 142 150 protected String lang = LANG_EDEFAULT; 151 152 160 protected static final SpaceType SPACE_EDEFAULT = SpaceType.PRESERVE_LITERAL; 161 162 170 protected SpaceType space = SPACE_EDEFAULT; 171 172 179 protected boolean spaceESet = false; 180 181 186 protected XMLNamespaceDocumentRootImpl() 187 { 188 super(); 189 } 190 191 196 protected EClass eStaticClass() 197 { 198 return XMLNamespacePackage.eINSTANCE.getXMLNamespaceDocumentRoot(); 199 } 200 201 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 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 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 248 public String getBase() 249 { 250 return base; 251 } 252 253 258 public void setBase(String newBase) 259 { 260 String 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 271 public String getId() 272 { 273 return id; 274 } 275 276 281 public void setId(String newId) 282 { 283 String 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 294 public String getLang() 295 { 296 return lang; 297 } 298 299 304 public void setLang(String newLang) 305 { 306 String 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 317 public SpaceType getSpace() 318 { 319 return space; 320 } 321 322 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 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 357 public boolean isSetSpace() 358 { 359 return spaceESet; 360 } 361 362 367 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class 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 391 public Object 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 418 public void eSet(EStructuralFeature eFeature, Object newValue) 419 { 420 switch (eDerivedStructuralFeatureID(eFeature)) 421 { 422 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__MIXED: 423 getMixed().clear(); 424 getMixed().addAll((Collection )newValue); 425 return; 426 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XMLNS_PREFIX_MAP: 427 getXMLNSPrefixMap().clear(); 428 getXMLNSPrefixMap().addAll((Collection )newValue); 429 return; 430 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: 431 getXSISchemaLocation().clear(); 432 getXSISchemaLocation().addAll((Collection )newValue); 433 return; 434 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__BASE: 435 setBase((String )newValue); 436 return; 437 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__ID: 438 setId((String )newValue); 439 return; 440 case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT__LANG: 441 setLang((String )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 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 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 516 public String toString() 517 { 518 if (eIsProxy()) return super.toString(); 519 520 StringBuffer result = new StringBuffer (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 } | Popular Tags |