|
||||||||||
| 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
Contains the options given to the match procedure. |
| 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 EObjects 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 EObjects 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)
This will compute the similarity between two EObjects' contents. |
|
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 boolean |
haveDistinctID(org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right)
This will lookup in the matchedByID map and check if the two given objects have indeed been
matched by their ID. |
|
protected boolean |
haveDistinctXMIID(org.eclipse.emf.ecore.EObject left,
org.eclipse.emf.ecore.EObject right)
This will lookup in the matchedByXMIID map and check if the two given objects have indeed been
matched by their XMI ID. |
|
protected boolean |
isSimilar(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
Returns True if the 2 given EObjects 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)
This will compute the similarity between two EObjects' names. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final MetamodelFilter filter
MetamodelFilter used for filtering unused features of the objects we're computing the
similarity for.
protected final 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)
EObjects and their direct content, ignoring the given objects'
siblings and parents for the match.
contentMatch in interface IMatchEngineleftObject - 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)
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)
EObjects and their direct content, ignoring the given objects'
siblings and parents for the match.
contentMatch in interface IMatchEngineleftObject - 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 IMatchEngineleftRoot - 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 IMatchEngineleftRoot - 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 IMatchEngineIMatchEngine.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 IMatchEngineleftResource - 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 IMatchEngineleftResource - 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 double contentSimilarity(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
throws FactoryException
EObjects' contents.
obj1 - First of the two EObjects.obj2 - Second of the two EObjects.
double representing the similarity between the two EObjects' contents. 0
< value < 1.
FactoryException - Thrown if we cannot compute the EObjects' contents similarity metrics.NameSimilarity.contentValue(EObject, MetamodelFilter)
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 ClassCastExceptions.
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.
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.
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.
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.
protected boolean isSimilar(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
throws FactoryException
True if the 2 given EObjects are considered similar.
obj1 - The first EObject to compare.obj2 - Second of the EObjects 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 double nameSimilarity(org.eclipse.emf.ecore.EObject obj1,
org.eclipse.emf.ecore.EObject obj2)
EObjects' names.
obj1 - First of the two EObjects.obj2 - Second of the two EObjects.
double representing the similarity between the two EObjects' names. 0 <
value < 1.NameSimilarity.nameSimilarityMetric(String, String)
|
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 | |||||||||