org.eclipse.emf.ecore.util
Class EcoreUtil.UsageCrossReferencer

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<EObject,java.util.Collection<EStructuralFeature.Setting>>
          extended by org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer
              extended by org.eclipse.emf.ecore.util.EcoreUtil.UsageCrossReferencer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>>
Enclosing class:
EcoreUtil

public static class EcoreUtil.UsageCrossReferencer
extends EcoreUtil.CrossReferencer

A cross referencer that finds each usage of an EObject or collection of EObjects.

See Also:
Serialized Form

Field Summary
protected  java.util.Collection<?> eObjectsOfInterest
          The collection of usage target objects.
 
Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer
emfObjects
 
Constructor Summary
protected EcoreUtil.UsageCrossReferencer(java.util.Collection<?> emfObjects)
          Creates an instance for the given collection of objects.
protected EcoreUtil.UsageCrossReferencer(EObject eObject)
          Creates an instance for the given object.
protected EcoreUtil.UsageCrossReferencer(Resource resource)
          Creates an instance for the given resource.
protected EcoreUtil.UsageCrossReferencer(ResourceSet resourceSet)
          Creates an instance for the given resource set.
 
Method Summary
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.
static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest, java.util.Collection<?> emfObjectsToSearch)
          Returns a collection of usage references from the combined content trees of the specified collection of objects.
static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest, EObject eObject)
          Returns a collection of usage references from the specified content tree.
static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest, Resource resource)
          Returns a collection of usage references from the specified content tree.
static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest, ResourceSet resourceSet)
          Returns a collection of usage references from the specified content tree.
static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest, java.util.Collection<?> emfObjectsToSearch)
          Returns a map of usage references from the combined content trees of the specified collection of objects.
static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest, EObject eObject)
          Returns a map of usage references from the specified content tree.
static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest, Resource resource)
          Returns a map of usage references from the specified content tree.
static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest, ResourceSet resourceSet)
          Returns a map of usage references from the specified content tree.
protected  java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAllUsage(java.util.Collection<?> eObjectsOfInterest)
          Returns the map of usage references to objects in the specified collection.
protected  java.util.Collection<EStructuralFeature.Setting> findUsage(EObject eObject)
          Returns the collection of usage references to the specified object.
 
Methods inherited from class org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer
add, containment, crossReference, done, find, getCollection, getCrossReferences, handleCrossReference, newCollection, newContentsIterator, print, print, resolve, toString
 
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

eObjectsOfInterest

protected java.util.Collection<?> eObjectsOfInterest
The collection of usage target objects.

Constructor Detail

EcoreUtil.UsageCrossReferencer

protected EcoreUtil.UsageCrossReferencer(EObject eObject)
Creates an instance for the given object.

Parameters:
eObject - the object to cross reference.

EcoreUtil.UsageCrossReferencer

protected EcoreUtil.UsageCrossReferencer(Resource resource)
Creates an instance for the given resource.

Parameters:
resource - the resource to cross reference.

EcoreUtil.UsageCrossReferencer

protected EcoreUtil.UsageCrossReferencer(ResourceSet resourceSet)
Creates an instance for the given resource set.

Parameters:
resourceSet - the resource set to cross reference.

EcoreUtil.UsageCrossReferencer

protected EcoreUtil.UsageCrossReferencer(java.util.Collection<?> emfObjects)
Creates an instance for the given collection of objects.

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

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.

Overrides:
crossReference in class EcoreUtil.CrossReferencer
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.

findUsage

protected java.util.Collection<EStructuralFeature.Setting> findUsage(EObject eObject)
Returns the collection of usage references to the specified object.

Parameters:
eObject - the usage target.
Returns:
a collection of cross references.

findAllUsage

protected java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAllUsage(java.util.Collection<?> eObjectsOfInterest)
Returns the map of usage references to objects in the specified collection.

Parameters:
eObjectsOfInterest - a collection of usage targets.
Returns:
a map of cross references.

find

public static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest,
                                                                    EObject eObject)
Returns a collection of usage references from the specified content tree.

Parameters:
eObjectOfInterest - the usage target.
eObject - an object whose content trees should be considered.
Returns:
a collection of cross references.

find

public static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest,
                                                                    Resource resource)
Returns a collection of usage references from the specified content tree.

Parameters:
eObjectOfInterest - the usage target.
resource - a resource whose content tree should be considered.
Returns:
a collection of cross references.

find

public static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest,
                                                                    ResourceSet resourceSet)
Returns a collection of usage references from the specified content tree.

Parameters:
eObjectOfInterest - the usage target.
resourceSet - a resource set whose content tree should be considered.
Returns:
a collection of cross references.

find

public static java.util.Collection<EStructuralFeature.Setting> find(EObject eObjectOfInterest,
                                                                    java.util.Collection<?> emfObjectsToSearch)
Returns a collection of usage references from the combined content trees of the specified collection of objects.

Parameters:
eObjectOfInterest - the usage target.
emfObjectsToSearch - a collection of objects whose combined content trees should be considered.
Returns:
a collection of cross references.

findAll

public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest,
                                                                                              EObject eObject)
Returns a map of usage references from the specified content tree.

Parameters:
eObjectsOfInterest - a collection of usage targets.
eObject - an object whose content trees should be considered.
Returns:
a map of cross references.

findAll

public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest,
                                                                                              Resource resource)
Returns a map of usage references from the specified content tree.

Parameters:
eObjectsOfInterest - a collection of usage targets.
resource - a resource whose content tree should be considered.
Returns:
a map of cross references.

findAll

public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest,
                                                                                              ResourceSet resourceSet)
Returns a map of usage references from the specified content tree.

Parameters:
eObjectsOfInterest - a collection of usage targets.
resourceSet - a resource set whose content tree should be considered.
Returns:
a map of cross references.

findAll

public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findAll(java.util.Collection<?> eObjectsOfInterest,
                                                                                              java.util.Collection<?> emfObjectsToSearch)
Returns a map of usage references from the combined content trees of the specified collection of objects.

Parameters:
eObjectsOfInterest - a collection of usage targets.
emfObjectsToSearch - a collection of objects whose combined content trees should be considered.
Returns:
a map of cross references.

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