## org.eclipse.emf.ecore.util
Class EcoreUtil.CrossReferencer

    java.lang.Object
      java.util.AbstractMap<K,V>
          java.util.HashMap<EObject,java.util.Collection<EStructuralFeature.Setting>>
              org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>>

Direct Known Subclasses:
  EcoreUtil.ExternalCrossReferencer, EcoreUtil.ProxyCrossReferencer, EcoreUtil.UnresolvedProxyCrossReferencer, EcoreUtil.UsageCrossReferencer, ECrossReferenceAdapter.InverseCrossReferencer

Enclosing class:
  EcoreUtil

    public static class EcoreUtil.CrossReferencer

extends java.util.HashMap<EObject,java.util.Collection<EStructuralFeature.Setting>>

A mapping building traverser of a collection of `content trees`; the map is from target `object` to a collection of `EStructuralFeature.Setting`. Since this implementation extends a Map implementation, it can yield itself as the result for most operations. The traverser considers each EObject in the `EObject.eCrossReferences()` of each EObject in the content tree, and creates a setting for each positive match. This default implementation `creates` a map of all cross references.

See Also:
  Serialized Form

Field Summary
`protected java.util.Collection<?>` `emfObjects` The collection of objects being cross referenced.

Constructor Summary
`protected` `EcoreUtil.CrossReferencer(java.util.Collection<?> emfObjects)` Creates an instance for the given collection of objects.
`protected` `EcoreUtil.CrossReferencer(EObject eObject)` Creates an instance for the given object.
`protected` `EcoreUtil.CrossReferencer(Resource resource)` Creates an instance for the given resource.
`protected` `EcoreUtil.CrossReferencer(ResourceSet resourceSet)` Creates an instance for the given resource set.

Method Summary
`protected void` `add(InternalEObject eObject, EReference eReference, EObject crossReferencedEObject)`
`protected boolean` `containment(EObject eObject)` Return true if the cross referencer should include references from children of the specified object.
`protected void` `crossReference()` Compute the map of cross references.
`protected boolean` `crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject)` Return true if the specified eReference from eObject to crossReferencedEObject should be considered a cross reference by this cross referencer.
`protected void` `done()` Reset this cross referencer's object set.
`static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>>` `find(java.util.Collection<?> emfObjects)` Returns a map of all cross references in the content tree.
`protected java.util.Collection<EStructuralFeature.Setting>` `getCollection(java.lang.Object key)` Return the collection of cross reference `settings` for the specified key (target object).
`protected EContentsEList.FeatureIterator<EObject>` `getCrossReferences(EObject eObject)`
`protected void` `handleCrossReference(EObject eObject)`
`protected java.util.Collection<EStructuralFeature.Setting>` `newCollection()` Return a collection to use for storing `settings`.
`protected TreeIterator<Notifier>` `newContentsIterator()` Return a tree iterator over the content trees of this cross referencer's objects.
`static void` `print(java.io.PrintStream out, java.util.Collection<EStructuralFeature.Setting> settings)` Print the specified collection of `settings` to the specified stream.
`static void` `print(java.io.PrintStream out, java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> crossReferenceMap)` Print the specified cross reference map to the specified stream.
`protected boolean` `resolve()` Return true if cross references that are proxies should be resolved.
`java.lang.String` `toString()` Returns a string representation of this cross referencer.

Methods inherited from class java.util.HashMap
`clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### emfObjects

    protected java.util.Collection<?> emfObjects

  The collection of objects being cross referenced.

Constructor Detail

### EcoreUtil.CrossReferencer

    protected EcoreUtil.CrossReferencer(EObject eObject)

  Creates an instance for the given object.

  Parameters:
    `eObject` - the object to cross reference.

### EcoreUtil.CrossReferencer

    protected EcoreUtil.CrossReferencer(Resource resource)

  Creates an instance for the given resource.

  Parameters:
    `resource` - the resource to cross reference.

### EcoreUtil.CrossReferencer

    protected EcoreUtil.CrossReferencer(ResourceSet resourceSet)

  Creates an instance for the given resource set.

  Parameters:
    `resourceSet` - the resource set to cross reference.

### EcoreUtil.CrossReferencer

    protected EcoreUtil.CrossReferencer(java.util.Collection<?> emfObjects)

  Creates an instance for the given collection of objects.

  Parameters:
    `emfObjects` - the collection of objects to cross reference.

Method Detail

### containment

    protected boolean containment(EObject eObject)

  Return true if the cross referencer should include references from children of the specified object.

  Parameters:
    `eObject` - an object in the cross referencer's content tree.
  Returns:
    if the cross referencer should include references from children of the object.

### crossReference

    protected boolean crossReference(EObject eObject,
                                     EReference eReference,
                                     EObject crossReferencedEObject)

  Return true if the specified eReference from eObject to crossReferencedEObject should be considered a cross reference by this cross referencer.

  Parameters:
    `eObject` - an object in the cross referencer's content tree.
    `eReference` - a reference from the object.
    `crossReferencedEObject` - the target of the specified reference.
  Returns:
    if the cross referencer should consider the specified reference a cross reference.

### resolve

    protected boolean resolve()

  Return true if cross references that are proxies should be resolved.

  Returns:
    if the cross referencer should resolve proxies.

### newCollection

    protected java.util.Collection<EStructuralFeature.Setting> newCollection()

  Return a collection to use for storing `settings`.

  Returns:
    a collection for settings.

### getCollection

    protected java.util.Collection<EStructuralFeature.Setting> getCollection(java.lang.Object key)

  Return the collection of cross reference `settings` for the specified key (target object).

  Parameters:
    `key` - the key for the cross referencer's map.
  Returns:
    the collection of settings.

### newContentsIterator

    protected TreeIterator<Notifier> newContentsIterator()

  Return a tree iterator over the content trees of this cross referencer's objects.

  Returns:
    a tree iterator over content trees.

### crossReference

    protected void crossReference()

  Compute the map of cross references.

### getCrossReferences

    protected EContentsEList.FeatureIterator<EObject> getCrossReferences(EObject eObject)

### handleCrossReference

    protected void handleCrossReference(EObject eObject)

### add

    protected void add(InternalEObject eObject,
                       EReference eReference,
                       EObject crossReferencedEObject)

### done

    protected void done()

  Reset this cross referencer's object set.

### find

    public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> find(java.util.Collection<?> emfObjects)

  Returns a map of all cross references in the content tree.

  Parameters:
    `emfObjects` - a collection of objects whose combined content trees should be considered.
  Returns:
    a map of cross references.

### toString

    public java.lang.String toString()

  Returns a string representation of this cross referencer.

  Overrides:
    `toString` in class `java.util.AbstractMap<EObject,java.util.Collection<EStructuralFeature.Setting>>`
  Returns:
    the string representation.

### print

    public static void print(java.io.PrintStream out,
                             java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> crossReferenceMap)

  Print the specified cross reference map to the specified stream.

  Parameters:
    `out` - the stream to print to.
    `crossReferenceMap` - a map (cross referencer) to print.

### print

    public static void print(java.io.PrintStream out,
                             java.util.Collection<EStructuralFeature.Setting> settings)

  Print the specified collection of `settings` to the specified stream.

  Parameters:
    `out` - the stream to print to.
    `settings` - a collection of settings.

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