T
- type of the elements comparedpublic interface Distance<T>
The distance measure should be consistent with equals such that
a.equals(b) => distance(a,b) == 0.0
.
The distance measure should be reflexive such that
distance(a,a) == 0.0
.
The distance measure should be symmetric such that
distance(a,b) == distance(b,a)
.
The distance measure may be transitive such that
distance(a, c) ≤ distance(a, b) + distance(b, c)
The distance 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 |
distance(T a,
T b)
Measures the distance between a and b.
|
float distance(T a, T b)
0.0
indicates that a
and
b
are similar.a
- object a to compareb
- object b to compareNullPointerException
- when either a or b is nullCopyright © 2014–2018. All rights reserved.