1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
package com.wcohen.ss.api;
import java.util.*;
/**
* An 'instance' for a StringDistance, analogous to an 'instance' for
* a classification learner. Consists of a pair of StringWrappers,
* a distance, and some labeling information.
*/
public interface DistanceInstance
{
public StringWrapper getA();
public StringWrapper getB();
public boolean isCorrect();
public double getDistance();
public void setDistance(double distance);
public static final Comparator INCREASING_DISTANCE = new Comparator() {
public int compare(Object o1,Object o2) {
DistanceInstance a = (DistanceInstance)o1;
DistanceInstance b = (DistanceInstance)o2;
if (a.getDistance() > b.getDistance()) return -1;
else if (a.getDistance() < b.getDistance()) return +1;
else return 0;
}
};
}
|