org.infai.emo.matcher
Class Comparator

java.lang.Object
  extended by org.infai.emo.matcher.Comparator
Direct Known Subclasses:
ElementComparator, StructureComparator

public abstract class Comparator
extends java.lang.Object

Abstract class for comparing two elements.
No comparative methods implemented! User must override Method compareTo.

Version:
1.0.0
Author:
Stanley Hillner

Field Summary
private  java.lang.String name
          The name of the comparator
 
Constructor Summary
Comparator()
          Constructor that initializes the comparator.
 
Method Summary
abstract  double compareTo(org.eclipse.emf.ecore.EObject leftElement, org.eclipse.emf.ecore.EObject rightElement)
          Method for comparing two elements.
 java.lang.String getName()
           
 void setName(java.lang.String name)
          Assign explicitly a name to the comparator.
 java.lang.String toString()
          Prints out the name of the comparator for identifying its type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name
The name of the comparator

Constructor Detail

Comparator

public Comparator()
Constructor that initializes the comparator. The comparators name will initially be set to the name of the class (important for the set oft standard-comparators like the MetaClassComparator).

Method Detail

getName

public java.lang.String getName()
Returns:
the name of the comparator.

setName

public void setName(java.lang.String name)
Assign explicitly a name to the comparator.

Parameters:
name - the name for the comparator.

toString

public java.lang.String toString()
Prints out the name of the comparator for identifying its type.

Overrides:
toString in class java.lang.Object

compareTo

public abstract double compareTo(org.eclipse.emf.ecore.EObject leftElement,
                                 org.eclipse.emf.ecore.EObject rightElement)
Method for comparing two elements.

Parameters:
leftElement - the first element to compare with the second one.
rightElement - the second element to compare with the first one.
Returns:
This method must return a double value between 0 and 1.0
1.0 stands for a total matching without any differences and 0 means that there are no commonalities.
See Also:
EObject