Class EditDistanceComparator
- java.lang.Object
-
- com.crawljax.oraclecomparator.AbstractComparator
-
- com.crawljax.oraclecomparator.comparators.EditDistanceComparator
-
- All Implemented Interfaces:
Comparator
public class EditDistanceComparator extends AbstractComparator
Oracle Comparator that uses the Levenshtein Edit Distance to determine whether two states are equivalent.
-
-
Field Summary
Fields Modifier and Type Field Description private doublethreshold
-
Constructor Summary
Constructors Constructor Description EditDistanceComparator()Default constructor with edit distance threshold = 1.EditDistanceComparator(double threshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetThreshold()(package private) doublegetThreshold(String x, String y, double p)Calculate a threshold.(package private) booleanisClone(String str1, String str2, double thresholdCoefficient)booleanisEquivalent(String oldDom, String newDom)voidsetThreshold(double threshold)-
Methods inherited from class com.crawljax.oraclecomparator.AbstractComparator
getDifferences, normalize
-
-
-
-
Method Detail
-
isEquivalent
public boolean isEquivalent(String oldDom, String newDom)
- Specified by:
isEquivalentin interfaceComparator- Overrides:
isEquivalentin classAbstractComparator- Returns:
- true if and only if the edit distance threshold is >= the specified threshold
-
getThreshold
public double getThreshold()
- Returns:
- the threshold
-
setThreshold
public void setThreshold(double threshold)
- Parameters:
threshold- the threshold to set
-
isClone
boolean isClone(String str1, String str2, double thresholdCoefficient)
- Parameters:
str1- the first string.str2- the second string.thresholdCoefficient- the threshold coefficient: must be between 0.0-1.0.- Returns:
- true if the Levenshtein distance is lower than or equal to the computed threshold.
-
-