|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FuzzyComparator<T>
A comparison function to measure the similarity between objects that imposes a NO ordering on them.
For the mathematically inclined, the relation:
{(x, y) such that c.compare((Object)x, (Object)y) == 1}.defined by a given
Comparator
c and a given set of
objects S should be a pseudo equivalence relation,
that is the relation imposed by c on S should be
consistent with equals in the almost all cases (neglectable number
of exceptions).
Be aware of this fuzzyness! An #equals(Object)
method based
on a FuzzyComparator
will never be 100% reliable.
FuzzyComparable
,
Comparator
,
Comparable
,
Object.equals(Object)
Method Summary | |
---|---|
float |
compare(T o1,
T o2)
Compares its two arguments for similarity. |
Method Detail |
---|
float compare(T o1, T o2) throws FuzzyException
The implementor should strive for ensuring that the following properties:
Furthermore 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.
FuzzyComparisonException
- -
FuzzyException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |