public static class EcoreUtil.CrossReferencer extends java.util.HashMap<EObject,java.util.Collection<EStructuralFeature.Setting>>
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.Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<?> |
emfObjects
The collection of objects being cross referenced.
|
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
protected java.util.Collection<?> emfObjects
protected EcoreUtil.CrossReferencer(EObject eObject)
eObject
- the object to cross reference.protected EcoreUtil.CrossReferencer(Resource resource)
resource
- the resource to cross reference.protected EcoreUtil.CrossReferencer(ResourceSet resourceSet)
resourceSet
- the resource set to cross reference.protected EcoreUtil.CrossReferencer(java.util.Collection<?> emfObjects)
emfObjects
- the collection of objects to cross reference.protected boolean containment(EObject eObject)
eObject
- an object in the cross referencer's content tree.protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject)
eObject
- an object in the cross referencer's content tree.eReference
- a reference from the object.crossReferencedEObject
- the target of the specified reference.protected boolean resolve()
protected java.util.Collection<EStructuralFeature.Setting> newCollection()
settings
.protected java.util.Collection<EStructuralFeature.Setting> getCollection(java.lang.Object key)
settings
for the specified key (target object).key
- the key for the cross referencer's map.protected TreeIterator<Notifier> newContentsIterator()
protected void crossReference()
protected EContentsEList.FeatureIterator<EObject> getCrossReferences(EObject eObject)
protected void handleCrossReference(EObject eObject)
protected void add(InternalEObject eObject, EReference eReference, EObject crossReferencedEObject)
protected void done()
public static java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> find(java.util.Collection<?> emfObjects)
emfObjects
- a collection of objects whose combined content trees should be considered.public java.lang.String toString()
toString
in class java.util.AbstractMap<EObject,java.util.Collection<EStructuralFeature.Setting>>
public static void print(java.io.PrintStream out, java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> crossReferenceMap)
out
- the stream to print to.crossReferenceMap
- a map (cross referencer) to print.public static void print(java.io.PrintStream out, java.util.Collection<EStructuralFeature.Setting> settings)
settings
to the specified stream.out
- the stream to print to.settings
- a collection of settings.