org.eclipse.emf.mapping.impl
Class MappingRootImpl

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.emf.mapping.impl.MappingImpl
                  extended by org.eclipse.emf.mapping.impl.MappingRootImpl
All Implemented Interfaces:
Notifier, EObject, InternalEObject, Mapping, MappingRoot
Direct Known Subclasses:
Ecore2EcoreMappingRootImpl, XSD2EcoreMappingRootImpl

public class MappingRootImpl
extends MappingImpl
implements MappingRoot

An implementation of the model object 'Root'.

The following features are implemented:


Nested Class Summary
protected  class MappingRootImpl.MappedObjectStateAdapter
          This is a simple implementation of the basic information that needs to be maintained for any mapped object.
protected  class MappingRootImpl.MappedObjectStateAdapterFactory
          This is the factory that creates adapters for the objects being mapped.
 
Nested classes/interfaces inherited from class org.eclipse.emf.mapping.impl.MappingImpl
MappingImpl.MappingTreeIterator
 
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>, BasicNotifierImpl.EObservableAdapterList
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
InternalEObject.EStore
 
Field Summary
protected static java.lang.String COMMAND_STACK_EDEFAULT
          The default value of the 'Command Stack' attribute
protected  java.lang.String commandStack
          The cached value of the 'Command Stack' attribute
protected  MappingDomain domain
          This keeps track of the mapping domain that uses this mapping root.
protected  AdapterImpl mappedObjectListener
          This allows this listen for changes to inputs or outputs.
protected  AdapterFactory mappedObjectStateAdapterFactory
          This keeps track of the factory for creating the MappedObjectState.
protected static boolean OUTPUT_READ_ONLY_EDEFAULT
          The default value of the 'Output Read Only' attribute
protected  boolean outputDirty
          This keeps track of whether the output has been modified.
protected  boolean outputReadOnly
          The cached value of the 'Output Read Only' attribute
protected static boolean TOP_TO_BOTTOM_EDEFAULT
          The default value of the 'Top To Bottom' attribute
protected  boolean topToBottom
          The cached value of the 'Top To Bottom' attribute
 
Fields inherited from class org.eclipse.emf.mapping.impl.MappingImpl
helper, inputs, nested, outputs, typeMapping
 
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 MappingRootImpl()
           
 
Method Summary
 boolean canCreateMapping(java.util.Collection<?> inputs, java.util.Collection<?> outputs, Mapping mapping)
          If mapping is null, this checks if a mapping can be created with the given inputs and outputs.
 boolean canRemoveMapping(Mapping mapping)
          This checks if the given mapping can be removed.
protected  Adapter createMappedObjectStateAdapter(Notifier target)
          By default, this creates a new instance of MappingRootImpl.MappedObjectStateAdapter.
protected  AdapterFactory createMappedObjectStateAdapterFactory()
          By default, this creates an adapter factory that delegates createAdapter to createMappedObjectStateAdapter.
protected  Mapping createMapping()
           
 Mapping createMapping(java.util.Collection<?> inputs, java.util.Collection<?> outputs)
          This creates a new, appropriately-parented, mapping object with the given collections of input and output objects.
 void deregister(Mapping mapping)
          This removes cached information about this mapping.
 void dispose()
          This disposes all the adapters used to record the mapped object state.
 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)
           
 java.util.Collection<? extends Mapping> getAllMappings(java.util.Collection<?> collection)
          This returns the intersection of the result of getMappings(Object) for each object of the collection.
 java.lang.String getCommandStack()
           
 MappingDomain getDomain()
          This returns the associated mapping domain.
 java.util.Collection<? extends Mapping> getExactMappings(java.util.Collection<?> collection)
          This returns the subset of mappings returned by MappingRoot.getAllMappings(java.util.Collection) such that have each mapping has exactly the collection as its mapped objects, i.e., as return by Mapping#getMappedObjects().
 MappedObjectState getMappedObjectState(java.lang.Object object)
          This uses the mappedObjectStateAdapterFactory to get an adapter that implements this interface.
 java.util.Collection<? extends Mapping> getMappings(java.lang.Object object)
          This returns a collection of the mappings that refer to the given object.
 Mapping getParentMapping(java.util.Collection<?> collection)
          This returns the mapping in the tree that would be the parent of a mapping that has the given collection as its mapped objects.
protected  java.util.Collection<java.lang.Object> getTypeClassifiers(java.util.Collection<?> collection)
           
 MappingRoot getTypeMappingRoot()
          This returns the root of the type mapping model.
protected  java.util.Collection<?> getTypeMappings(java.util.Collection<?> inputTypes, java.util.Collection<?> outputTypes)
           
protected  boolean hasCompatibleMetaObjects(java.util.Collection<?> inputs, java.util.Collection<?> outputs)
           
protected  boolean hasCompatibleTypes(java.util.Collection<?> inputs, java.util.Collection<?> outputs)
           
protected  boolean hasMappedChildren(Mapping mapping)
           
protected  boolean hasMappedParents(java.util.Collection<?> inputs, java.util.Collection<?> outputs)
           
protected  boolean hasTypeMappings(java.util.Collection<?> types)
           
protected  void initializeMappedObjectStates()
           
protected  void initializeNewMapping(Mapping newMapping, java.util.Collection<?> inputs, java.util.Collection<?> outputs)
           
 boolean isAttachedObject(java.lang.Object object)
          This returns whether the given object descends from one of the root's input or output objects.
 boolean isBottomObject(java.lang.Object object)
          This returns whether the given object is a bottom domain object.
 boolean isDirty()
          This method returns true if the mapping tree needs to be saved.
 boolean isInputObject(java.lang.Object object)
          This returns whether the given object is an input object in the domain.
protected  boolean isMapped(java.util.Collection<?> collection, Mapping mapping)
           
 boolean isOutputDirty()
          This method returns true if the mapping output needs to be saved.
 boolean isOutputObject(java.lang.Object object)
          This returns whether the given object is an output object in the domain.
 boolean isOutputReadOnly()
           
 boolean isTopObject(java.lang.Object object)
          This returns whether the given object is a top domain object.
 boolean isTopToBottom()
           
protected  void printAdapters()
           
 void refreshMappedObjectStates(Mapping subtree)
          This refreshes the mapped objects states of all mappings rooted at the specified mapping subtree.
 void register(Mapping mapping)
          This adds cached information about this mapping.
 void resetDirty()
          This method resets the mapping and output dirty flags.
 void setCommandStack(java.lang.String newCommandStack)
           
 void setDomain(MappingDomain domain)
          This sets the domain of this mapping root.
 void setOutputDirty(boolean dirty)
          This method sets the output dirty flag.
 void setOutputReadOnly(boolean newOutputReadOnly)
           
 void setTopToBottom(boolean newTopToBottom)
           
 java.lang.String toString()
           
protected  void walk(EObject object)
           
 
Methods inherited from class org.eclipse.emf.mapping.impl.MappingImpl
basicGetTypeMapping, basicSetHelper, basicSetNestedIn, eBasicRemoveFromContainerFeature, eInverseAdd, eInverseRemove, getBottoms, getEffectiveHelper, getHelper, getInputs, getMappedObjects, getMappingRoot, getNested, getNestedIn, getOutputs, getReceivers, getSenders, getTops, getTypeMapping, isReverse, setHelper, setNestedIn, setTypeMapping, treeIterator, treeIterator
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eInvoke, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainerAdapterArray, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicInvoke, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseRemove, eInvocationDelegate, eInvoke, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStaticOperationCount, eStore, eUnset, eURIFragmentSegment, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.mapping.Mapping
getBottoms, getEffectiveHelper, getHelper, getInputs, getMappedObjects, getMappingRoot, getNested, getNestedIn, getOutputs, getReceivers, getSenders, getTops, getTypeMapping, isReverse, setHelper, setNestedIn, setTypeMapping, treeIterator, treeIterator
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
eNotificationRequired
 

Field Detail

OUTPUT_READ_ONLY_EDEFAULT

protected static final boolean OUTPUT_READ_ONLY_EDEFAULT
The default value of the 'Output Read Only' attribute.

See Also:
isOutputReadOnly(), Constant Field Values

outputReadOnly

protected boolean outputReadOnly
The cached value of the 'Output Read Only' attribute.

See Also:
isOutputReadOnly()

TOP_TO_BOTTOM_EDEFAULT

protected static final boolean TOP_TO_BOTTOM_EDEFAULT
The default value of the 'Top To Bottom' attribute.

See Also:
isTopToBottom(), Constant Field Values

topToBottom

protected boolean topToBottom
The cached value of the 'Top To Bottom' attribute.

See Also:
isTopToBottom()

COMMAND_STACK_EDEFAULT

protected static final java.lang.String COMMAND_STACK_EDEFAULT
The default value of the 'Command Stack' attribute.

See Also:
getCommandStack()

commandStack

protected java.lang.String commandStack
The cached value of the 'Command Stack' attribute.

See Also:
getCommandStack()

domain

protected MappingDomain domain
This keeps track of the mapping domain that uses this mapping root.


outputDirty

protected boolean outputDirty
This keeps track of whether the output has been modified.


mappedObjectListener

protected AdapterImpl mappedObjectListener
This allows this listen for changes to inputs or outputs.


mappedObjectStateAdapterFactory

protected AdapterFactory mappedObjectStateAdapterFactory
This keeps track of the factory for creating the MappedObjectState.

Constructor Detail

MappingRootImpl

protected MappingRootImpl()

Method Detail

eStaticClass

protected EClass eStaticClass()

Overrides:
eStaticClass in class MappingImpl

isOutputReadOnly

public boolean isOutputReadOnly()

Specified by:
isOutputReadOnly in interface MappingRoot
Returns:
the value of the 'Output Read Only' attribute.
See Also:
MappingRoot.setOutputReadOnly(boolean), MappingPackage.getMappingRoot_OutputReadOnly()

setOutputReadOnly

public void setOutputReadOnly(boolean newOutputReadOnly)

Specified by:
setOutputReadOnly in interface MappingRoot
Parameters:
newOutputReadOnly - the new value of the 'Output Read Only' attribute.
See Also:
MappingRoot.isOutputReadOnly()

isTopToBottom

public boolean isTopToBottom()

Specified by:
isTopToBottom in interface MappingRoot
Returns:
the value of the 'Top To Bottom' attribute.
See Also:
MappingRoot.setTopToBottom(boolean), MappingPackage.getMappingRoot_TopToBottom()

setTopToBottom

public void setTopToBottom(boolean newTopToBottom)

Specified by:
setTopToBottom in interface MappingRoot
Parameters:
newTopToBottom - the new value of the 'Top To Bottom' attribute.
See Also:
MappingRoot.isTopToBottom()

getCommandStack

public java.lang.String getCommandStack()

Specified by:
getCommandStack in interface MappingRoot
Returns:
the value of the 'Command Stack' attribute.
See Also:
MappingRoot.setCommandStack(String), MappingPackage.getMappingRoot_CommandStack()

setCommandStack

public void setCommandStack(java.lang.String newCommandStack)

Specified by:
setCommandStack in interface MappingRoot
Parameters:
newCommandStack - the new value of the 'Command Stack' attribute.
See Also:
MappingRoot.getCommandStack()

eGet

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

Specified by:
eGet in interface InternalEObject
Overrides:
eGet in class MappingImpl
See Also:
InternalEObject.eGet(EStructuralFeature, boolean, boolean)

eSet

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

Specified by:
eSet in interface InternalEObject
Overrides:
eSet in class MappingImpl
See Also:
EObject.eSet(EStructuralFeature, Object)

eUnset

public void eUnset(int featureID)

Specified by:
eUnset in interface InternalEObject
Overrides:
eUnset in class MappingImpl
See Also:
EObject.eUnset(EStructuralFeature)

eIsSet

public boolean eIsSet(int featureID)

Specified by:
eIsSet in interface InternalEObject
Overrides:
eIsSet in class MappingImpl
See Also:
EObject.eIsSet(EStructuralFeature)

toString

public java.lang.String toString()

Overrides:
toString in class MappingImpl

getDomain

public MappingDomain getDomain()
Description copied from interface: MappingRoot
This returns the associated mapping domain.

Specified by:
getDomain in interface MappingRoot

setDomain

public void setDomain(MappingDomain domain)
Description copied from interface: MappingRoot
This sets the domain of this mapping root.

Specified by:
setDomain in interface MappingRoot

refreshMappedObjectStates

public void refreshMappedObjectStates(Mapping subtree)
Description copied from interface: MappingRoot
This refreshes the mapped objects states of all mappings rooted at the specified mapping subtree.

Specified by:
refreshMappedObjectStates in interface MappingRoot

initializeMappedObjectStates

protected void initializeMappedObjectStates()

getParentMapping

public Mapping getParentMapping(java.util.Collection<?> collection)
Description copied from interface: MappingRoot
This returns the mapping in the tree that would be the parent of a mapping that has the given collection as its mapped objects.

Specified by:
getParentMapping in interface MappingRoot

isDirty

public boolean isDirty()
Description copied from interface: MappingRoot
This method returns true if the mapping tree needs to be saved.

Specified by:
isDirty in interface MappingRoot

isOutputDirty

public boolean isOutputDirty()
Description copied from interface: MappingRoot
This method returns true if the mapping output needs to be saved.

Specified by:
isOutputDirty in interface MappingRoot

register

public void register(Mapping mapping)
Description copied from interface: MappingRoot
This adds cached information about this mapping.

Specified by:
register in interface MappingRoot

deregister

public void deregister(Mapping mapping)
Description copied from interface: MappingRoot
This removes cached information about this mapping.

Specified by:
deregister in interface MappingRoot

canCreateMapping

public boolean canCreateMapping(java.util.Collection<?> inputs,
                                java.util.Collection<?> outputs,
                                Mapping mapping)
Description copied from interface: MappingRoot
If mapping is null, this checks if a mapping can be created with the given inputs and outputs. If mapping is not null, it checks if the specified mapping can be changed to the given inputs and outputs.

Specified by:
canCreateMapping in interface MappingRoot

canRemoveMapping

public boolean canRemoveMapping(Mapping mapping)
Description copied from interface: MappingRoot
This checks if the given mapping can be removed.

Specified by:
canRemoveMapping in interface MappingRoot

hasMappedChildren

protected boolean hasMappedChildren(Mapping mapping)

hasMappedParents

protected boolean hasMappedParents(java.util.Collection<?> inputs,
                                   java.util.Collection<?> outputs)

isMapped

protected boolean isMapped(java.util.Collection<?> collection,
                           Mapping mapping)

hasCompatibleMetaObjects

protected boolean hasCompatibleMetaObjects(java.util.Collection<?> inputs,
                                           java.util.Collection<?> outputs)

hasCompatibleTypes

protected boolean hasCompatibleTypes(java.util.Collection<?> inputs,
                                     java.util.Collection<?> outputs)

getTypeMappings

protected java.util.Collection<?> getTypeMappings(java.util.Collection<?> inputTypes,
                                                  java.util.Collection<?> outputTypes)

hasTypeMappings

protected boolean hasTypeMappings(java.util.Collection<?> types)

getTypeClassifiers

protected java.util.Collection<java.lang.Object> getTypeClassifiers(java.util.Collection<?> collection)

createMapping

public Mapping createMapping(java.util.Collection<?> inputs,
                             java.util.Collection<?> outputs)
Description copied from interface: MappingRoot
This creates a new, appropriately-parented, mapping object with the given collections of input and output objects.

Specified by:
createMapping in interface MappingRoot

createMapping

protected Mapping createMapping()

initializeNewMapping

protected void initializeNewMapping(Mapping newMapping,
                                    java.util.Collection<?> inputs,
                                    java.util.Collection<?> outputs)

resetDirty

public void resetDirty()
Description copied from interface: MappingRoot
This method resets the mapping and output dirty flags.

Specified by:
resetDirty in interface MappingRoot

setOutputDirty

public void setOutputDirty(boolean dirty)
Description copied from interface: MappingRoot
This method sets the output dirty flag.

Specified by:
setOutputDirty in interface MappingRoot

isInputObject

public boolean isInputObject(java.lang.Object object)
Description copied from interface: MappingRoot
This returns whether the given object is an input object in the domain.

Specified by:
isInputObject in interface MappingRoot

isOutputObject

public boolean isOutputObject(java.lang.Object object)
Description copied from interface: MappingRoot
This returns whether the given object is an output object in the domain.

Specified by:
isOutputObject in interface MappingRoot

isTopObject

public boolean isTopObject(java.lang.Object object)
Description copied from interface: MappingRoot
This returns whether the given object is a top domain object.

Specified by:
isTopObject in interface MappingRoot

isBottomObject

public boolean isBottomObject(java.lang.Object object)
Description copied from interface: MappingRoot
This returns whether the given object is a bottom domain object.

Specified by:
isBottomObject in interface MappingRoot

isAttachedObject

public boolean isAttachedObject(java.lang.Object object)
Description copied from interface: MappingRoot
This returns whether the given object descends from one of the root's input or output objects.

Specified by:
isAttachedObject in interface MappingRoot

getMappings

public java.util.Collection<? extends Mapping> getMappings(java.lang.Object object)
Description copied from interface: MappingRoot
This returns a collection of the mappings that refer to the given object.

Specified by:
getMappings in interface MappingRoot

getAllMappings

public java.util.Collection<? extends Mapping> getAllMappings(java.util.Collection<?> collection)
Description copied from interface: MappingRoot
This returns the intersection of the result of getMappings(Object) for each object of the collection.

Specified by:
getAllMappings in interface MappingRoot

getExactMappings

public java.util.Collection<? extends Mapping> getExactMappings(java.util.Collection<?> collection)
Description copied from interface: MappingRoot
This returns the subset of mappings returned by MappingRoot.getAllMappings(java.util.Collection) such that have each mapping has exactly the collection as its mapped objects, i.e., as return by Mapping#getMappedObjects().

Specified by:
getExactMappings in interface MappingRoot

getMappedObjectState

public MappedObjectState getMappedObjectState(java.lang.Object object)
This uses the mappedObjectStateAdapterFactory to get an adapter that implements this interface.

Specified by:
getMappedObjectState in interface MappingRoot

getTypeMappingRoot

public MappingRoot getTypeMappingRoot()
Description copied from interface: MappingRoot
This returns the root of the type mapping model.

Specified by:
getTypeMappingRoot in interface MappingRoot

createMappedObjectStateAdapterFactory

protected AdapterFactory createMappedObjectStateAdapterFactory()
By default, this creates an adapter factory that delegates createAdapter to createMappedObjectStateAdapter.


createMappedObjectStateAdapter

protected Adapter createMappedObjectStateAdapter(Notifier target)
By default, this creates a new instance of MappingRootImpl.MappedObjectStateAdapter.


dispose

public void dispose()
Description copied from interface: MappingRoot
This disposes all the adapters used to record the mapped object state.

Specified by:
dispose in interface MappingRoot

printAdapters

protected void printAdapters()

walk

protected void walk(EObject object)

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