|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.compare.match.engine.GenericMatchEngine
public class GenericMatchEngine
These services are useful when one wants to compare models more precisely using the method modelDiff.
Field Summary | |
---|---|
protected MetamodelFilter |
filter
MetamodelFilter used for filtering unused features of the objects we're computing the
similarity for. |
protected java.util.Map<java.lang.String,java.lang.Object> |
options
Deprecated. |
Constructor Summary | |
---|---|
GenericMatchEngine()
|
Method Summary | ||
---|---|---|
MatchModel |
contentMatch(org.eclipse.emf.ecore.EObject leftObject,
org.eclipse.emf.ecore.EObject rightObject,
org.eclipse.emf.ecore.EObject ancestor,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method will compare three EObject s and their direct content, ignoring the given objects'
siblings and parents for the match. |
|
MatchModel |
contentMatch(org.eclipse.emf.ecore.EObject leftObject,
org.eclipse.emf.ecore.EObject rightObject,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method will compare two EObject s and their direct content, ignoring the given objects'
siblings and parents for the match. |
|
protected double |
contentSimilarity(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
Deprecated. |
|
protected org.eclipse.emf.ecore.EObject |
findMostSimilar(org.eclipse.emf.ecore.EObject eObj,
java.util.List<org.eclipse.emf.ecore.EObject> list)
This will iterate through the given List and return its element which is most similar (as given
by #absoluteMetric(EObject, EObject) ) to the given EObject . |
|
protected
|
getOption(java.lang.String key)
This will return the value associated to the given key in the options map. |
|
protected java.util.List<org.eclipse.emf.ecore.EObject> |
getScopeInternalContents(org.eclipse.emf.ecore.EObject eObject,
IMatchScope scope)
Workaround for bug #235606 : elements held by a reference with containment=true and derived=true are not matched since not returned by EObject.eContents() . |
|
protected boolean |
haveDistinctID(org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right)
Deprecated. |
|
protected boolean |
haveDistinctXMIID(org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right)
Deprecated. |
|
protected boolean |
isSimilar(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
Returns True if the 2 given EObject s are considered similar. |
|
MatchModel |
modelMatch(org.eclipse.emf.ecore.EObject leftRoot,
org.eclipse.emf.ecore.EObject rightRoot,
org.eclipse.emf.ecore.EObject ancestor,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method returns a MatchModel for three models. |
|
MatchModel |
modelMatch(org.eclipse.emf.ecore.EObject leftRoot,
org.eclipse.emf.ecore.EObject rightRoot,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method returns a MatchModel for two models. |
|
protected double |
nameSimilarity(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
Deprecated. |
|
protected AbstractSimilarityChecker |
prepareChecker()
Build the best checker depending on the options. |
|
void |
reset()
This will be called with each access from the service to the singleton instance of this engine. |
|
MatchModel |
resourceMatch(org.eclipse.emf.ecore.resource.Resource leftResource,
org.eclipse.emf.ecore.resource.Resource rightResource,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method returns a MatchModel for two resources. |
|
MatchModel |
resourceMatch(org.eclipse.emf.ecore.resource.Resource leftResource,
org.eclipse.emf.ecore.resource.Resource rightResource,
org.eclipse.emf.ecore.resource.Resource ancestorResource,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
This method returns a MatchModel for three resources. |
|
protected void |
setModelRoots(MatchModel modelRoot,
org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right)
Sets the values of the MatchModel 's left and right models. |
|
protected void |
setModelRoots(MatchModel modelRoot,
org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right,
org.eclipse.emf.ecore.EObject ancestor)
Sets the values of the MatchModel 's left, right and ancestor models. |
|
protected void |
updateSettings(MatchSettings settings,
java.util.Map<java.lang.String,java.lang.Object> optionMap)
prepare the engine with the options. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MetamodelFilter filter
MetamodelFilter
used for filtering unused features of the objects we're computing the
similarity for.
@Deprecated protected java.util.Map<java.lang.String,java.lang.Object> options
Constructor Detail |
---|
public GenericMatchEngine()
Method Detail |
---|
public MatchModel contentMatch(org.eclipse.emf.ecore.EObject leftObject, org.eclipse.emf.ecore.EObject rightObject, org.eclipse.emf.ecore.EObject ancestor, java.util.Map<java.lang.String,java.lang.Object> optionMap)
EObject
s and their direct content, ignoring the given objects'
siblings and parents for the match.
contentMatch
in interface IMatchEngine
leftObject
- Left of the three objects to get compared.rightObject
- Right of the three objects to compare.ancestor
- Common ancestor of the two others.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
for these three objects' comparison.IMatchEngine.contentMatch(org.eclipse.emf.ecore.EObject,
org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, java.util.Map)
protected AbstractSimilarityChecker prepareChecker()
protected void updateSettings(MatchSettings settings, java.util.Map<java.lang.String,java.lang.Object> optionMap)
settings
- the settings to update.optionMap
- the match options.public MatchModel contentMatch(org.eclipse.emf.ecore.EObject leftObject, org.eclipse.emf.ecore.EObject rightObject, java.util.Map<java.lang.String,java.lang.Object> optionMap)
EObject
s and their direct content, ignoring the given objects'
siblings and parents for the match.
contentMatch
in interface IMatchEngine
leftObject
- Left of the two objects to get compared.rightObject
- Right of the two objects to compare.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
for these two objects' comparison.IMatchEngine.contentMatch(org.eclipse.emf.ecore.EObject,
org.eclipse.emf.ecore.EObject, java.util.Map)
public MatchModel modelMatch(org.eclipse.emf.ecore.EObject leftRoot, org.eclipse.emf.ecore.EObject rightRoot, org.eclipse.emf.ecore.EObject ancestor, java.util.Map<java.lang.String,java.lang.Object> optionMap) throws java.lang.InterruptedException
modelMatch
in interface IMatchEngine
leftRoot
- Left model for the comparison.rightRoot
- Right model for the comparison.ancestor
- Common ancestor of the right and left models.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
.
java.lang.InterruptedException
- Thrown if the options map specifies a progress monitor, and the comparison gets interrupted
somehow.IMatchEngine.modelMatch(org.eclipse.emf.ecore.EObject,
org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, java.util.Map)
public MatchModel modelMatch(org.eclipse.emf.ecore.EObject leftRoot, org.eclipse.emf.ecore.EObject rightRoot, java.util.Map<java.lang.String,java.lang.Object> optionMap) throws java.lang.InterruptedException
modelMatch
in interface IMatchEngine
leftRoot
- Left model for the comparison.rightRoot
- Right model for the comparison.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
.
java.lang.InterruptedException
- Thrown if the options map specifies a progress monitor, and the comparison gets interrupted
somehow.IMatchEngine.modelMatch(org.eclipse.emf.ecore.EObject,
org.eclipse.emf.ecore.EObject, java.util.Map)
public void reset()
reset
in interface IMatchEngine
IMatchEngine.reset()
public MatchModel resourceMatch(org.eclipse.emf.ecore.resource.Resource leftResource, org.eclipse.emf.ecore.resource.Resource rightResource, java.util.Map<java.lang.String,java.lang.Object> optionMap) throws java.lang.InterruptedException
resourceMatch
in interface IMatchEngine
leftResource
- Left compared resource.rightResource
- Right compared resource.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
.
java.lang.InterruptedException
- Thrown if the options map specifies a progress monitor, and the comparison gets interrupted
somehow.IMatchEngine.resourceMatch(org.eclipse.emf.ecore.resource.Resource,
org.eclipse.emf.ecore.resource.Resource, java.util.Map)
public MatchModel resourceMatch(org.eclipse.emf.ecore.resource.Resource leftResource, org.eclipse.emf.ecore.resource.Resource rightResource, org.eclipse.emf.ecore.resource.Resource ancestorResource, java.util.Map<java.lang.String,java.lang.Object> optionMap) throws java.lang.InterruptedException
resourceMatch
in interface IMatchEngine
leftResource
- Left compared resource.rightResource
- Right compared resource.ancestorResource
- Common ancestor of the two compared resources.optionMap
- Options to tweak the matching procedure. null
or
Collections.EMPTY_MAP
will result in the default options to be used.
MatchModel
.
java.lang.InterruptedException
- Thrown if the options map specifies a progress monitor, and the comparison gets interrupted
somehow.IMatchEngine.resourceMatch(org.eclipse.emf.ecore.resource.Resource,
org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource, java.util.Map)
protected org.eclipse.emf.ecore.EObject findMostSimilar(org.eclipse.emf.ecore.EObject eObj, java.util.List<org.eclipse.emf.ecore.EObject> list) throws FactoryException
List
and return its element which is most similar (as given
by #absoluteMetric(EObject, EObject)
) to the given EObject
.
eObj
- EObject
we're searching a similar item for in the list.list
- List
in which we are to find an object similar to eObj
.
list
which is the most similar to eObj
.
FactoryException
- Thrown if we cannot compute the absolute metric
between eObj
and one of the list's objects.protected <T> T getOption(java.lang.String key) throws java.lang.ClassCastException
NOTE : Misuses of this method will easily throw ClassCastException
s.
T
- Expected type of the value associated to key
.key
- Key of the value to retrieve.
java.lang.ClassCastException
- If the value isn't assignment compatible with the expected type.@Deprecated protected boolean haveDistinctID(org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right) throws FactoryException
#matchedByID
map and check if the two given objects have indeed been
matched by their ID. This method is no more used by the generic match engine implementation itself as
this logic moved to the AbstractSimilarityChecker
left
- Left of the two objects to check.right
- Right of the two objects to check.
True
these objects haven't been matched by their ID, False
otherwise.
FactoryException
- Thrown if we cannot compute the key for the object to match.@Deprecated protected boolean haveDistinctXMIID(org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right) throws FactoryException
#matchedByXMIID
map and check if the two given objects have indeed been
matched by their XMI ID.
left
- Left of the two objects to check.right
- Right of the two objects to check.
True
these objects haven't been matched by their XMI ID, False
otherwise.
FactoryException
- Thrown if we cannot compute the key for the object to match.@Deprecated protected double nameSimilarity(org.eclipse.emf.ecore.EObject obj1, org.eclipse.emf.ecore.EObject obj2)
EObject
s' names.
obj1
- First of the two EObject
s.obj2
- Second of the two EObject
s.
double
representing the similarity between the two EObject
s' names. 0 <
value < 1.NameSimilarity.nameSimilarityMetric(String, String)
@Deprecated protected double contentSimilarity(org.eclipse.emf.ecore.EObject obj1, org.eclipse.emf.ecore.EObject obj2) throws FactoryException
EObject
s' contents.
obj1
- First of the two EObject
s.obj2
- Second of the two EObject
s.
double
representing the similarity between the two EObject
s' contents. 0
< value < 1.
FactoryException
- Thrown if we cannot compute the EObject
s' contents similarity metrics.NameSimilarity.contentValue(EObject, MetamodelFilter)
protected void setModelRoots(MatchModel modelRoot, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right)
MatchModel
's left and right models.
modelRoot
- Root of the MatchModel
.left
- Element from which to resolve the left model URI.right
- Element from which to resolve the right model URI.protected void setModelRoots(MatchModel modelRoot, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right, org.eclipse.emf.ecore.EObject ancestor)
MatchModel
's left, right and ancestor models.
modelRoot
- Root of the MatchModel
.left
- Element from which to resolve the left model URI.right
- Element from which to resolve the right model URI.ancestor
- Element from which to resolve the ancestor model URI. Can be null
.protected boolean isSimilar(org.eclipse.emf.ecore.EObject obj1, org.eclipse.emf.ecore.EObject obj2) throws FactoryException
True
if the 2 given EObject
s are considered similar.
obj1
- The first EObject
to compare.obj2
- Second of the EObject
s to compare.
True
if both elements have the same serialization ID, False
otherwise.
FactoryException
- Thrown if we cannot compute one of the needed similarity.protected java.util.List<org.eclipse.emf.ecore.EObject> getScopeInternalContents(org.eclipse.emf.ecore.EObject eObject, IMatchScope scope)
EObject.eContents()
. This allows us to return the list of all
contents from an EObject including those references.
eObject
- The EObject we seek the content of.scope
- The scope to restrict the contents.
|
Copyright 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |