#include <Comparator.h>
Public Member Functions | |
OverlayKey | distance (const OverlayKey &x, const OverlayKey &y) const |
calculates the distance from x to y on a bidirectional ring |
OverlayKey KeyRingMetric::distance | ( | const OverlayKey & | x, | |
const OverlayKey & | y | |||
) | const [inline] |
calculates the distance from x to y on a bidirectional ring
x | origination key | |
y | destination key |
00098 { 00099 OverlayKey dist1(x - y); 00100 OverlayKey dist2(y - x); 00101 00102 if (dist1 > dist2) 00103 return dist2; 00104 else 00105 return dist1; 00106 }