T
- type of the elements comparedpublic interface Metric<T>
The similarity measure should be consistent with equals such that
a.equals(b) => compare(a,b) == 1.0
.
The similarity measure should be reflexive such that
compare(a,a) == 1.0
.
The similarity measure should be symmetric such that
compare(a,b) == compare(b,a)
.
The similarity measure may be transitive such that
1.0 - compare(a, c) ≤ 1.0 - compare(a, b) + 1.0 - compare(b, c)
The similarity measure may satisfy the coincidence axiom such that
compare(a, b) = 0 if and only if a.equals(b)
Implementations may not modify the arguments. Arguments should be treated as if they were unmodifiable.
Modifier and Type | Method and Description |
---|---|
float |
compare(T a,
T b)
Measures the similarity between a and b.
|
float compare(T a, T b)
0.0
indicates that
a
and b
are dissimilar, a value of 1.0
indicates
they are similar.a
- object a to compareb
- object b to compareNullPointerException
- when either a or b is nullCopyright © 2014–2018. All rights reserved.