|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FuzzyComparable<T>
Compares its two arguments for similarity. Returns a floating point number between zero and one representing the degree of similarity.
This interface imposes a NO ordering on the objects of each class that implements it.
The fuzzy comparison for a class C is said to be consistent with equals if and only if (e1.compareTo((Object)e2) == 0) has the same boolean value as e1.equals((Object)e2) for almost every e1 and e2 of class C. Note that null is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.
The implementor should strive for ensuring that the following properties:
Furhtermore compare(x, y) must throw an exception iff compare(y, x) throws an exception.
It is strongly recommended (though not required) that the comparison is consistent with equals. So it is generally the case, but not strictly required that (compare(x, y)==1) == (x.equals(y)). Generally speaking, any comparator that violates this condition should clearly indicate this fact.
FuzzyComparator
,
Comparator
,
Comparable
,
Object.equals(Object)
Method Summary | |
---|---|
float |
compareTo(T o)
Compares its two arguments for similarity. |
Method Detail |
---|
float compareTo(T o) throws FuzzyException
The implementor should strive for ensuring that the following properties:
Furhtermore compare(x, y) must throw an exception iff compare(y, x) throws an exception.
It is strongly recommended (though not required) that the comparison is consistent with equals. So it is generally the case, but not strictly required that (compare(x, y)==1) == (x.equals(y)). Generally speaking, any comparator that violates this condition should clearly indicate this fact.
o1
- the first object to be compared.o2
- the second object to be compared.
FuzzyException
- - if an error occured.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |