org.eclipse.xsd.impl
Class XSDNamedComponentImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.ecore.impl.BasicEObjectImpl
          extended by org.eclipse.emf.ecore.impl.EObjectImpl
              extended by org.eclipse.xsd.impl.XSDConcreteComponentImpl
                  extended by org.eclipse.xsd.impl.XSDComponentImpl
                      extended by org.eclipse.xsd.impl.XSDNamedComponentImpl
All Implemented Interfaces:
Notifier, EObject, InternalEObject, XSDComponent, XSDConcreteComponent, XSDNamedComponent
Direct Known Subclasses:
XSDFeatureImpl, XSDIdentityConstraintDefinitionImpl, XSDNotationDeclarationImpl, XSDRedefinableComponentImpl

public abstract class XSDNamedComponentImpl
extends XSDComponentImpl
implements XSDNamedComponent

An implementation of the model object 'Named Component'.

The following features are implemented:


Nested Class Summary
static class XSDNamedComponentImpl.Comparator
           
static class XSDNamedComponentImpl.StringPairComparator
           
static class XSDNamedComponentImpl.XSDNamedComponentList<E extends java.lang.Object & XSDNamedComponent>
           
 
Nested classes/interfaces inherited from class org.eclipse.xsd.impl.XSDConcreteComponentImpl
XSDConcreteComponentImpl.XSDContentsEList
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
BasicEObjectImpl.EPropertiesHolder, BasicEObjectImpl.EPropertiesHolderBaseImpl, BasicEObjectImpl.EPropertiesHolderImpl
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
BasicNotifierImpl.EAdapterList<E extends java.lang.Object & Adapter>
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
InternalEObject.EStore
 
Field Summary
protected static java.lang.String ALIAS_NAME_EDEFAULT
          The default value of the 'Alias Name' attribute
protected static java.lang.String ALIAS_URI_EDEFAULT
          The default value of the 'Alias URI' attribute
protected  java.lang.String name
          The cached value of the 'Name' attribute
protected static java.lang.String NAME_EDEFAULT
          The default value of the 'Name' attribute
protected static java.lang.String QNAME_EDEFAULT
          The default value of the 'QName' attribute
protected static java.lang.String TARGET_NAMESPACE_EDEFAULT
          The default value of the 'Target Namespace' attribute
protected  java.lang.String targetNamespace
          The cached value of the 'Target Namespace' attribute
protected static java.lang.String URI_EDEFAULT
          The default value of the 'URI' attribute
 
Fields inherited from class org.eclipse.xsd.impl.XSDConcreteComponentImpl
ANALYZED, ANALYZING, CIRCULAR, diagnostics, element, ELEMENT_EDEFAULT, ERROR, FATAL, forceResolve, INFORMATION, isReconciling, UNANALYZED, updatingDOM, WARNING, xsdContents
 
Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eContainer, eContainerFeatureID, EDELIVER, EDYNAMIC_CLASS, eFlags, ELAST_EOBJECT_FLAG, ELAST_NOTIFIER_FLAG, eProperties, EPROXY
 
Fields inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
EVIRTUAL_GET, EVIRTUAL_IS_SET, EVIRTUAL_NO_VALUE, EVIRTUAL_SET, EVIRTUAL_UNSET
 
Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
EOPPOSITE_FEATURE_BASE
 
Constructor Summary
protected XSDNamedComponentImpl()
           
 
Method Summary
static
<T extends XSDNamedComponent>
void
addToSortedList(java.util.List<T> xsdNamedComponents, T xsdNamedComponent)
           
protected  void adoptBy(XSDSchema xsdSchema)
           
protected  void changeAttribute(EAttribute eAttribute)
           
 java.lang.Object eGet(int featureID, boolean resolve, boolean coreType)
           
 boolean eIsSet(int featureID)
           
 void eSet(int featureID, java.lang.Object newValue)
           
protected  EClass eStaticClass()
           
 void eUnset(int featureID)
           
static XSDNamedComponent findInSortedList(java.util.List<? extends XSDNamedComponent> xsdNamedComponents, java.lang.String targetNamespace, java.lang.String localName)
           
 java.lang.String getAliasName()
          Returns the value of the 'Alias Name' attribute
 java.lang.String getAliasURI()
           
 java.lang.String getName()
           
 java.lang.String getQName()
          Returns the value of the 'QName' attribute
 java.lang.String getQName(XSDConcreteComponent relativeToComponent)
          Returns this named component's 'QName' in the context of the given component
 XSDNamedComponent getResolvedNamedComponent()
           
 java.lang.String getTargetNamespace()
           
 java.lang.String getURI()
          Returns the value of the 'URI' attribute
protected  java.lang.String getURIReferenceLabel()
           
 boolean hasNameAndTargetNamespace(java.lang.String name, java.lang.String targetNamespace)
          Returns whether this named component has the given name and target namespace
 boolean hasSameNameAndTargetNamespace(XSDNamedComponent xsdNamedComponent)
          Returns whether this named component and the given named component are named the same
 boolean hasURI(java.lang.String uri)
          Returns whether this named component has the given URI
 boolean isNamedComponentReference()
           
static
<T extends XSDNamedComponent>
void
mergeToSortedList(java.util.List<T> xsdNamedComponentsTarget, java.util.List<T> xsdNamedComponentsSource)
           
protected  void patch()
           
protected  void patchTargetNamespaceAttribute()
           
protected  void reconcileAttributes(org.w3c.dom.Element changedElement)
           
protected  void reconcileNameAttribute()
           
 void setName(java.lang.String newName)
           
 void setTargetNamespace(java.lang.String newTargetNamespace)
           
static java.util.List<XSDNamedComponent> sortNamedComponents(java.util.Collection<XSDNamedComponent> xsdNamedComponents)
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.xsd.impl.XSDConcreteComponentImpl
adoptContent, adoptDiagnostic, analyze, changeReference, checkAttributes, checkAttributeTypeConstraint, checkAttributeTypeConstraint, checkBuiltInTypeConstraint, checkComplexContent, checkComplexContent, checkElementComplexContent, checkSimpleTypeConstraint, clearDiagnostics, cloneConcreteComponent, cloneConcreteComponents, considerAllContainsForBestConcreteComponent, contains, createDiagnostic, createDiagnostic, createDiagnostic, createDiagnostic, createElement, createElement, createRequiredAttributeDiagnostic, createUnresolvedAttributeDeclaration, createUnresolvedAttributeGroupDefinition, createUnresolvedComplexTypeDefinition, createUnresolvedElementDeclaration, createUnresolvedIdentityConstraintDefinition, createUnresolvedModelGroupDefinition, createUnresolvedNotationDeclaration, createUnresolvedSimpleTypeDefinition, createUnresolvedTypeDefinition, eInverseRemove, elementAttributesChanged, elementChanged, elementContentsChanged, eNotificationRequired, eNotify, eObjectForURIFragmentSegment, eURIFragmentSegment, forceEngulf, forceEngulf, forceNiceInsertBefore, forceNiceRemoveChild, forceReplace, getAdoptionParentNode, getBestConcreteComponent, getComponentsWithApplicationInformation, getComponentsWithInformation, getComponentsWithUserInformation, getContainer, getContentNodes, getDiagnostics, getDiagnosticTarget, getElement, getRootContainer, getSchema, getXSDConcreteComponentImpls, getXSDContents, getXSDFactory, getXSDPackage, handleAnnotationReconciliation, handleElementForAdopt, handleReconciliation, handleUnreconciledElement, isUpdatingDOM, moveContent, niceCreateNamespaceAttribute, niceInsertBefore, niceRemoveChild, niceSetAttribute, niceSetAttributeURIValue, orphanBy, orphanContent, orphanDiagnostic, populateDiagnostic, printDFA, reconcile, reconcileContents, reportConstraintViolation, reset, resolveAttributeDeclaration, resolveAttributeDeclaration, resolveAttributeDeclarationURI, resolveAttributeGroupDefinition, resolveAttributeGroupDefinition, resolveAttributeGroupDefinitionURI, resolveComplexTypeDefinition, resolveComplexTypeDefinition, resolveComplexTypeDefinitionURI, resolveElementDeclaration, resolveElementDeclaration, resolveElementDeclarationURI, resolveIdentityConstraintDefinition, resolveIdentityConstraintDefinition, resolveIdentityConstraintDefinitionURI, resolveModelGroupDefinition, resolveModelGroupDefinition, resolveModelGroupDefinitionURI, resolveNotationDeclaration, resolveNotationDeclaration, resolveNotationDeclarationURI, resolveSimpleTypeDefinition, resolveSimpleTypeDefinition, resolveSimpleTypeDefinitionURI, resolveTypeDefinition, resolveTypeDefinition, resolveTypeDefinitionURI, setElement, setElementGen, setListContentAndOrder, traverseToRootForAnalysis, traverseToRootForPatching, updateElement, updateElement, updatePrefix, validate
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eIsSet, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStore, eUnset, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.xsd.XSDConcreteComponent
clearDiagnostics, cloneConcreteComponent, contains, elementAttributesChanged, elementChanged, elementContentsChanged, getComponentsWithApplicationInformation, getComponentsWithUserInformation, getContainer, getDiagnostics, getElement, getRootContainer, getSchema, resolveAttributeDeclaration, resolveAttributeDeclaration, resolveAttributeDeclarationURI, resolveAttributeGroupDefinition, resolveAttributeGroupDefinition, resolveAttributeGroupDefinitionURI, resolveComplexTypeDefinition, resolveComplexTypeDefinition, resolveComplexTypeDefinitionURI, resolveElementDeclaration, resolveElementDeclaration, resolveElementDeclarationURI, resolveIdentityConstraintDefinition, resolveIdentityConstraintDefinition, resolveIdentityConstraintDefinitionURI, resolveModelGroupDefinition, resolveModelGroupDefinition, resolveModelGroupDefinitionURI, resolveNotationDeclaration, resolveNotationDeclaration, resolveNotationDeclarationURI, resolveSimpleTypeDefinition, resolveSimpleTypeDefinition, resolveSimpleTypeDefinitionURI, resolveTypeDefinition, resolveTypeDefinition, resolveTypeDefinitionURI, setElement, updateElement, updateElement, validate
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Field Detail

NAME_EDEFAULT

protected static final java.lang.String NAME_EDEFAULT
The default value of the 'Name' attribute.

See Also:
getName()

name

protected java.lang.String name
The cached value of the 'Name' attribute.

See Also:
getName()

TARGET_NAMESPACE_EDEFAULT

protected static final java.lang.String TARGET_NAMESPACE_EDEFAULT
The default value of the 'Target Namespace' attribute.

See Also:
getTargetNamespace()

targetNamespace

protected java.lang.String targetNamespace
The cached value of the 'Target Namespace' attribute.

See Also:
getTargetNamespace()

ALIAS_NAME_EDEFAULT

protected static final java.lang.String ALIAS_NAME_EDEFAULT
The default value of the 'Alias Name' attribute.

See Also:
getAliasName()

URI_EDEFAULT

protected static final java.lang.String URI_EDEFAULT
The default value of the 'URI' attribute.

See Also:
getURI()

ALIAS_URI_EDEFAULT

protected static final java.lang.String ALIAS_URI_EDEFAULT
The default value of the 'Alias URI' attribute.

See Also:
getAliasURI()

QNAME_EDEFAULT

protected static final java.lang.String QNAME_EDEFAULT
The default value of the 'QName' attribute.

See Also:
getQName()
Constructor Detail

XSDNamedComponentImpl

protected XSDNamedComponentImpl()

Method Detail

sortNamedComponents

public static java.util.List<XSDNamedComponent> sortNamedComponents(java.util.Collection<XSDNamedComponent> xsdNamedComponents)

addToSortedList

public static <T extends XSDNamedComponent> void addToSortedList(java.util.List<T> xsdNamedComponents,
                                                                 T xsdNamedComponent)

findInSortedList

public static XSDNamedComponent findInSortedList(java.util.List<? extends XSDNamedComponent> xsdNamedComponents,
                                                 java.lang.String targetNamespace,
                                                 java.lang.String localName)

mergeToSortedList

public static <T extends XSDNamedComponent> void mergeToSortedList(java.util.List<T> xsdNamedComponentsTarget,
                                                                   java.util.List<T> xsdNamedComponentsSource)

eStaticClass

protected EClass eStaticClass()

Overrides:
eStaticClass in class XSDComponentImpl

getName

public java.lang.String getName()

Specified by:
getName in interface XSDNamedComponent
Returns:
the value of the 'Name' attribute.
See Also:
XSDNamedComponent.setName(String), XSDPackage.getXSDNamedComponent_Name()

setName

public void setName(java.lang.String newName)

Specified by:
setName in interface XSDNamedComponent
Parameters:
newName - the new value of the 'Name' attribute.
See Also:
XSDNamedComponent.getName()

getTargetNamespace

public java.lang.String getTargetNamespace()

Specified by:
getTargetNamespace in interface XSDNamedComponent
Returns:
the value of the 'Target Namespace' attribute.
See Also:
XSDNamedComponent.setTargetNamespace(String), XSDPackage.getXSDNamedComponent_TargetNamespace()

setTargetNamespace

public void setTargetNamespace(java.lang.String newTargetNamespace)

Specified by:
setTargetNamespace in interface XSDNamedComponent
Parameters:
newTargetNamespace - the new value of the 'Target Namespace' attribute.
See Also:
XSDNamedComponent.getTargetNamespace()

getURIReferenceLabel

protected java.lang.String getURIReferenceLabel()
Overrides:
getURIReferenceLabel in class XSDConcreteComponentImpl

getAliasName

public java.lang.String getAliasName()
Description copied from interface: XSDNamedComponent
Returns the value of the 'Alias Name' attribute.

This attempts to construct a relatively meaningful name for an anonymous component by using the name of the containing component and an indication of the relation to that component, For example, "E_._type" would be the alias name of the anonymous type definition of the element "E" and "LT_._item" would be the alias name of the anonymous item type definition of the list type defintion "LT".

Specified by:
getAliasName in interface XSDNamedComponent
Returns:
the value of the 'Alias Name' attribute.
See Also:
XSDPackage.getXSDNamedComponent_AliasName()

getURI

public java.lang.String getURI()
Description copied from interface: XSDNamedComponent
Returns the value of the 'URI' attribute.

This is equivalent to the string

  <target namespace>#<name>
where a null target namespace is taken to mean an empty string.

Specified by:
getURI in interface XSDNamedComponent
Returns:
the value of the 'URI' attribute.
See Also:
XSDConcreteComponent.resolveAttributeDeclarationURI(java.lang.String), XSDConcreteComponent.resolveAttributeGroupDefinitionURI(java.lang.String), XSDConcreteComponent.resolveComplexTypeDefinitionURI(java.lang.String), XSDConcreteComponent.resolveElementDeclarationURI(java.lang.String), XSDConcreteComponent.resolveIdentityConstraintDefinitionURI(java.lang.String), XSDConcreteComponent.resolveModelGroupDefinitionURI(java.lang.String), XSDConcreteComponent.resolveNotationDeclarationURI(java.lang.String), XSDConcreteComponent.resolveSimpleTypeDefinitionURI(java.lang.String), XSDPackage.getXSDNamedComponent_URI()

getAliasURI

public java.lang.String getAliasURI()

Specified by:
getAliasURI in interface XSDNamedComponent
Returns:
the value of the 'Alias URI' attribute.
See Also:
XSDPackage.getXSDNamedComponent_AliasURI()

getQName

public java.lang.String getQName(XSDConcreteComponent relativeToComponent)
Description copied from interface: XSDNamedComponent
Returns this named component's 'QName' in the context of the given component.

Specified by:
getQName in interface XSDNamedComponent
Parameters:
relativeToComponent - the context at which to express the QName.
Returns:
the 'QName'.
See Also:
XSDNamedComponent.getQName()

getQName

public java.lang.String getQName()
Description copied from interface: XSDNamedComponent
Returns the value of the 'QName' attribute.

This concrete attribute is equivalent to

  xsdNamedComponent.getQName(xsdNamedComponent)

Specified by:
getQName in interface XSDNamedComponent
Returns:
the value of the 'QName' attribute.
See Also:
XSDNamedComponent.getQName(org.eclipse.xsd.XSDConcreteComponent), XSDPackage.getXSDNamedComponent_QName()

eGet

public java.lang.Object eGet(int featureID,
                             boolean resolve,
                             boolean coreType)

Specified by:
eGet in interface InternalEObject
Overrides:
eGet in class XSDConcreteComponentImpl

eSet

public void eSet(int featureID,
                 java.lang.Object newValue)

Specified by:
eSet in interface InternalEObject
Overrides:
eSet in class XSDConcreteComponentImpl

eUnset

public void eUnset(int featureID)

Specified by:
eUnset in interface InternalEObject
Overrides:
eUnset in class XSDConcreteComponentImpl

eIsSet

public boolean eIsSet(int featureID)

Specified by:
eIsSet in interface InternalEObject
Overrides:
eIsSet in class XSDConcreteComponentImpl

toString

public java.lang.String toString()

Overrides:
toString in class XSDConcreteComponentImpl

patch

protected void patch()
Overrides:
patch in class XSDConcreteComponentImpl

patchTargetNamespaceAttribute

protected void patchTargetNamespaceAttribute()

adoptBy

protected void adoptBy(XSDSchema xsdSchema)
Overrides:
adoptBy in class XSDConcreteComponentImpl

reconcileAttributes

protected void reconcileAttributes(org.w3c.dom.Element changedElement)
Overrides:
reconcileAttributes in class XSDConcreteComponentImpl

reconcileNameAttribute

protected void reconcileNameAttribute()

changeAttribute

protected void changeAttribute(EAttribute eAttribute)
Overrides:
changeAttribute in class XSDConcreteComponentImpl

isNamedComponentReference

public boolean isNamedComponentReference()

getResolvedNamedComponent

public XSDNamedComponent getResolvedNamedComponent()

hasSameNameAndTargetNamespace

public boolean hasSameNameAndTargetNamespace(XSDNamedComponent xsdNamedComponent)
Description copied from interface: XSDNamedComponent
Returns whether this named component and the given named component are named the same.

This is equivalent to

  xsdNamedComponent.hasNameAndTargetNamespace
    (xsdOtherNamedComponent.getName(), 
     xsdOtherNamedComponent.getTargetNamespace())

Specified by:
hasSameNameAndTargetNamespace in interface XSDNamedComponent
Parameters:
xsdNamedComponent - another named component.
Returns:
whether this named component and the given named component are named the same.
See Also:
XSDNamedComponent.hasNameAndTargetNamespace(java.lang.String, java.lang.String), XSDNamedComponent.getName(), XSDNamedComponent.getTargetNamespace()

hasNameAndTargetNamespace

public boolean hasNameAndTargetNamespace(java.lang.String name,
                                         java.lang.String targetNamespace)
Description copied from interface: XSDNamedComponent
Returns whether this named component has the given name and target namespace.

This is equivalent to

  (targetNamespace == null ?
     getTargetNamespace() == null :
     targetNamespace.equals(getTargetNamespace())) &&
  (name == null ?
     getName() == null :
     name.equals(getName()))

Specified by:
hasNameAndTargetNamespace in interface XSDNamedComponent
Parameters:
name - the name.
targetNamespace - namespace the target namespace.
Returns:
whether this named component has the given name and target namespace.
See Also:
XSDNamedComponent.hasSameNameAndTargetNamespace(org.eclipse.xsd.XSDNamedComponent), XSDNamedComponent.hasURI(java.lang.String), XSDNamedComponent.getName(), XSDNamedComponent.getTargetNamespace()

hasURI

public boolean hasURI(java.lang.String uri)
Description copied from interface: XSDNamedComponent
Returns whether this named component has the given URI.

This is equivalent to

  String theTargetNamespace = getTargetNamespace();
  if (theTargetNamespace == null)
  {
    theTargetNamespace = "";
  }
  String theName = getName();
  if (theName == null)
  {
    theName = "";
  }
  return
    qName.startsWith(theTargetNamespace) &&
      qName.endsWith(theName) &&
      qName.length() == theName.length() + theTargetNamespace.length() + 1;

Specified by:
hasURI in interface XSDNamedComponent
Parameters:
uri - the URI.
Returns:
whether this named component has the given URI.
See Also:
XSDNamedComponent.hasNameAndTargetNamespace(java.lang.String, java.lang.String), XSDNamedComponent.hasSameNameAndTargetNamespace(org.eclipse.xsd.XSDNamedComponent), XSDNamedComponent.getURI()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.