org.eclipse.emf.compare.match.engine
Class AbstractSimilarityChecker

java.lang.Object
  extended by org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker

public abstract class AbstractSimilarityChecker
extends java.lang.Object

Class responsible to check similarity of elements based on an internal strategy.

Since:
1.1

Field Summary
protected  MetamodelFilter filter
          The filter.
 
Constructor Summary
AbstractSimilarityChecker(MetamodelFilter metamodelFilter)
          Create a new checker.
 
Method Summary
abstract  double absoluteMetric(org.eclipse.emf.ecore.EObject obj1, org.eclipse.emf.ecore.EObject obj2)
          Returns an absolute comparison metric between the two given EObjects.
 org.eclipse.emf.ecore.EObject fastLookup(org.eclipse.emf.ecore.EObject obj1)
          If a checker is able to return the matching element quickly it should define that.
abstract  void init(org.eclipse.emf.ecore.EObject leftObject, org.eclipse.emf.ecore.EObject rightObject)
          Convenience method if the checker need to be initialized in some way.
abstract  void init(org.eclipse.emf.ecore.resource.Resource leftResource, org.eclipse.emf.ecore.resource.Resource rightResource)
          Convenience method if the checker need to be initialized in some way.
abstract  boolean isSimilar(org.eclipse.emf.ecore.EObject obj1, org.eclipse.emf.ecore.EObject obj2)
          Should determine whether an element is similar to the other one or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected MetamodelFilter filter
The filter.

Constructor Detail

AbstractSimilarityChecker

public AbstractSimilarityChecker(MetamodelFilter metamodelFilter)
Create a new checker.

Parameters:
metamodelFilter - a metamodel filter the checker can use to know whether a feature alwaas has the same value or not in the models.
Method Detail

isSimilar

public abstract boolean isSimilar(org.eclipse.emf.ecore.EObject obj1,
                                  org.eclipse.emf.ecore.EObject obj2)
                           throws FactoryException
Should determine whether an element is similar to the other one or not.

Parameters:
obj1 - an element.
obj2 - another element.
Returns:
true if those elements have the same identity.
Throws:
FactoryException - on error accessing features.

init

public abstract void init(org.eclipse.emf.ecore.EObject leftObject,
                          org.eclipse.emf.ecore.EObject rightObject)
                   throws FactoryException
Convenience method if the checker need to be initialized in some way.

Parameters:
leftObject - root of the left model.
rightObject - root of the right model.
Throws:
FactoryException - on error accessing features.

init

public abstract void init(org.eclipse.emf.ecore.resource.Resource leftResource,
                          org.eclipse.emf.ecore.resource.Resource rightResource)
                   throws FactoryException
Convenience method if the checker need to be initialized in some way.

Parameters:
leftResource - the left resource.
rightResource - the right resource.
Throws:
FactoryException - on error accessing features.

absoluteMetric

public abstract double absoluteMetric(org.eclipse.emf.ecore.EObject obj1,
                                      org.eclipse.emf.ecore.EObject obj2)
                               throws FactoryException
Returns an absolute comparison metric between the two given EObjects.

Parameters:
obj1 - The first EObject to compare.
obj2 - Second of the EObjects to compare.
Returns:
An absolute comparison metric. 0 < value < 1.
Throws:
FactoryException - Thrown if we cannot compute the content similarity.

fastLookup

public org.eclipse.emf.ecore.EObject fastLookup(org.eclipse.emf.ecore.EObject obj1)
If a checker is able to return the matching element quickly it should define that. Not every checker might be able to provide that !

Parameters:
obj1 - object to match.
Returns:
corresponding object if found.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.