KeyPrefixMetric Class Reference

#include <Comparator.h>

List of all members.


Detailed Description

OverlayKey prefix metric.

Definition at line 156 of file Comparator.h.


Public Member Functions

 KeyPrefixMetric ()
OverlayKey distance (const OverlayKey &x, const OverlayKey &y) const
 calculates the distance from x to y with the prefix metric
void setBitsPerDigit (uint32_t bitsPerDigit)

Private Attributes

uint32_t bitsPerDigit

Constructor & Destructor Documentation

KeyPrefixMetric::KeyPrefixMetric (  )  [inline]

Definition at line 159 of file Comparator.h.

00160     {
00161         bitsPerDigit = 1;
00162     }


Member Function Documentation

OverlayKey KeyPrefixMetric::distance ( const OverlayKey &  x,
const OverlayKey &  y 
) const [inline]

calculates the distance from x to y with the prefix metric

Parameters:
x origination key
y destination key
Returns:
|differing suffix|

Definition at line 171 of file Comparator.h.

00173     {
00174         return OverlayKey::getLength() / bitsPerDigit
00175                - x.sharedPrefixLength(y, bitsPerDigit);
00176     }

void KeyPrefixMetric::setBitsPerDigit ( uint32_t  bitsPerDigit  )  [inline]

Definition at line 178 of file Comparator.h.

00179     {
00180         this->bitsPerDigit = bitsPerDigit;
00181     }


Member Data Documentation

uint32_t KeyPrefixMetric::bitsPerDigit [private]

Definition at line 184 of file Comparator.h.

Referenced by distance(), and KeyPrefixMetric().


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

Generated on Wed Mar 25 16:32:53 2009 for OverSim by  doxygen 1.5.5