|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
org.eclipse.emf.ecore.util.EcoreUtil.EqualityHelper
A helper for determining whether two EObjects are structurally equal.
Two EObjects, eObject1 and eObject2, are structurally equal
if their classes are the same,
and if, for each non-derived feature of the class,
the isSet states are the same
and the corresponding values are structurally equal
as appropriate for the type of feature.
For feature map features,
the positionally corresponding entries
must have the same entry features
and must have structurally equal values
as appropriate for the type of entry's feature.
For reference features,
the corresponding values must recursively be structurally equal according to this definition.
For attribute features,
the corresponding values must be equal according to Java equality.
Note that container references are derived and hence are ignored.
During the recursive process of determining equality,
the helper instance is populated as a two way map
such that a given eObject1 is considered to be equal to at most one other eObject2,
i.e., get(eObject1) == eObject2 && get(eObject2) == eObject1.
While their features are being compared, the two objects are assumed to be equal:
put(eObject1, eObject2); put(eObject2, eObject1);Once that correspondence is established, an
eObject1 considered equal to a different eObject2
will not even be considered equal to itself.
This ensures that two objects are structurally equal only if the graphs formed by all their referenced objects
have the same topology.
EcoreUtil.equals(EObject, EObject),
EqualityHelper#equals(EObject, EObject),
Serialized Form| Constructor Summary | |
|---|---|
EcoreUtil.EqualityHelper()
|
|
| Method Summary | |
|---|---|
protected boolean |
equalFeatureMaps(FeatureMap featureMap1,
FeatureMap featureMap2)
Returns whether the two feature maps are equal. |
protected boolean |
equalFeatureMapValues(java.lang.Object value1,
java.lang.Object value2,
EStructuralFeature feature)
Returns whether the two values of a feature map are equal. |
boolean |
equals(EObject eObject1,
EObject eObject2)
Returns whether eObject1 and eObject2 are equal
in the context of this helper instance. |
boolean |
equals(java.util.List list1,
java.util.List list2)
Returns whether list1 and list2 contain
equal EObjects at the same index.
|
protected boolean |
haveEqualAttribute(EObject eObject1,
EObject eObject2,
EAttribute attribute)
Returns whether the two objects have equal values for the attribute. |
protected boolean |
haveEqualFeature(EObject eObject1,
EObject eObject2,
EStructuralFeature feature)
Returns whether the two objects have equal
isSet states and values for the feature. |
protected boolean |
haveEqualReference(EObject eObject1,
EObject eObject2,
EReference reference)
Returns whether the two objects have equal values for the reference. |
| 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, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
public EcoreUtil.EqualityHelper()
| Method Detail |
public boolean equals(EObject eObject1,
EObject eObject2)
eObject1 and eObject2 are equal
in the context of this helper instance.
eObject1 and eObject2 are equal.
public boolean equals(java.util.List list1,
java.util.List list2)
list1 and list2 contain
equal EObjects at the same index.
It is assumed that list1 and list2 only contain EObjects.
list1 and list2 contain equal objects.
protected boolean haveEqualFeature(EObject eObject1,
EObject eObject2,
EStructuralFeature feature)
equal
isSet states and values for the feature.
EcoreUtil.EqualityHelper.equals(EObject, EObject),
EcoreUtil.EqualityHelper.equals(List, List)
protected boolean haveEqualReference(EObject eObject1,
EObject eObject2,
EReference reference)
equal values for the reference.
EcoreUtil.EqualityHelper.equals(EObject, EObject),
EcoreUtil.EqualityHelper.equals(List, List)
protected boolean haveEqualAttribute(EObject eObject1,
EObject eObject2,
EAttribute attribute)
equal values for the attribute.
EcoreUtil.EqualityHelper.equalFeatureMaps(FeatureMap, FeatureMap)
protected boolean equalFeatureMaps(FeatureMap featureMap1,
FeatureMap featureMap2)
equal.
protected boolean equalFeatureMapValues(java.lang.Object value1,
java.lang.Object value2,
EStructuralFeature feature)
equal.
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||