public class MinimumEditDistance {
public interface CostFunction{
public int cost(int[][] distanceMatrix,CharSequence x, CharSequence y,int i,int j);
}
public static final CostFunction ONE = new CostFunction() {
public int cost(int[][] distanceMatrix, CharSequence x, CharSequence y, int i, int j) {
return 1;
}
};
public static final CostFunction TWO = new CostFunction() {
public int cost(int[][] distanceMatrix, CharSequence x, CharSequence y, int i, int j) {
return 2;
}
};
我无法理解这段代码中实际做了什么!!!new
前面是什么意思CostFunction()
。实际上,我对这个理解很混乱!