org.eclipse.emf.compare.match.statistic.similarity
Class NameSimilarity

java.lang.Object
  extended by org.eclipse.emf.compare.match.statistic.similarity.NameSimilarity

public final class NameSimilarity
extends java.lang.Object

This class provides services to work on strings and to compare EObjects.


Method Summary
static java.lang.String contentValue(org.eclipse.emf.ecore.EObject current, MetamodelFilter filter)
          Returns a string representation of all the features' values for a given EObject.
static java.lang.String findName(org.eclipse.emf.ecore.EObject current)
          Finds the property which is the best candidate to be the name of an EObject.
static org.eclipse.emf.ecore.EAttribute findNameFeature(org.eclipse.emf.ecore.EObject current)
          Returns the feature which seems to be the name of the given EObject.
static double nameSimilarityMetric(java.lang.String str1, java.lang.String str2)
          Return a metric result about name similarity.
static java.util.List<java.lang.String> pairs(java.lang.String source)
          This method returns a List of Strings called "pairs".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

contentValue

public static java.lang.String contentValue(org.eclipse.emf.ecore.EObject current,
                                            MetamodelFilter filter)
                                     throws FactoryException
Returns a string representation of all the features' values for a given EObject.

Parameters:
current - Object for which we need String representation.
filter - Allows filtering of pertinent features.
Returns:
A string representation of all the features' values for a given EObject.
Throws:
FactoryException - Thrown if one of the operation on EObject fails.

findName

public static java.lang.String findName(org.eclipse.emf.ecore.EObject current)
                                 throws FactoryException
Finds the property which is the best candidate to be the name of an EObject.

Parameters:
current - EObject we seek the name for.
Returns:
The best candidate to be the name of the given object.
Throws:
FactoryException - Thrown if an operation on current fails.

findNameFeature

public static org.eclipse.emf.ecore.EAttribute findNameFeature(org.eclipse.emf.ecore.EObject current)
Returns the feature which seems to be the name of the given EObject.

Parameters:
current - EObject we seek the name feature of.
Returns:
The feature which seems to be the name of the given EObject.

nameSimilarityMetric

public static double nameSimilarityMetric(java.lang.String str1,
                                          java.lang.String str2)
Return a metric result about name similarity. It compares 2 strings and return a double comprised between 0 and 1. The greater this metric, the more equal the strings are.

Parameters:
str1 - First of the two Strings to compare.
str2 - Second of the two Strings to compare.
Returns:
A metric result about name similarity (0 <= value <= 1).

pairs

public static java.util.List<java.lang.String> pairs(java.lang.String source)
This method returns a List of Strings called "pairs". For example,
 pairs("MyString")
 
returns ["My","yS","St","tr","ri","in","ng"]

Parameters:
source - The String to process.
Returns:
A List of String corresponding to the possibles pairs of the source one.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.