OverSim
KeyRingMetric Class Reference

OverlayKey Ring Metric. More...

#include <Comparator.h>

Static Public Member Functions

static OverlayKey distance (const OverlayKey &x, const OverlayKey &y)
 calculates the distance from x to y on a bidirectional ring

Detailed Description

OverlayKey Ring Metric.

Definition at line 111 of file Comparator.h.

Member Function Documentation

static OverlayKey KeyRingMetric::distance ( const OverlayKey x,
const OverlayKey y 
)
inlinestatic

calculates the distance from x to y on a bidirectional ring

Parameters
xorigination key
ydestination key
Returns
|y-x| on a bidirectional ring

Definition at line 121 of file Comparator.h.

Referenced by BasePastry::distance(), PastryLeafSet::estimateMeanDistance(), and OverlayKey::test().

{
OverlayKey dist1(x - y);
OverlayKey dist2(y - x);
if (dist1 > dist2)
return dist2;
else
return dist1;
}

The documentation for this class was generated from the following file: