KademliaPRComparator Class Reference

#include <Comparator.h>

Inheritance diagram for KademliaPRComparator:
ProxKeyComparator< KeyPrefixMetric > AbstractProxKeyComparator

List of all members.

Public Member Functions

 KademliaPRComparator (const OverlayKey &relativeKey, uint32_t bitsPerDigit=1)
int compare (const ProxKey &lhs, const ProxKey &rhs) const
 indicates which of the two given prox/key-pairs is closer to the relative key

Detailed Description

Definition at line 340 of file Comparator.h.


Constructor & Destructor Documentation

KademliaPRComparator::KademliaPRComparator ( const OverlayKey relativeKey,
uint32_t  bitsPerDigit = 1 
) [inline]

Definition at line 343 of file Comparator.h.

00344     : ProxKeyComparator<KeyPrefixMetric, StdProxComparator>(relativeKey, bitsPerDigit) { }


Member Function Documentation

int KademliaPRComparator::compare ( const ProxKey lhs,
const ProxKey rhs 
) const [inline, virtual]

indicates which of the two given prox/key-pairs is closer to the relative key

Parameters:
lhs first prox/key-pair
rhs second prox/key-pair
Returns:
-1 if lhs is closer, 0 if lhs and rhs are equal and 1 if rhs closer to the relative key

Implements AbstractProxKeyComparator.

Definition at line 346 of file Comparator.h.

00347     {
00348         int temp = m.distance(lhs.key, key).compareTo(m.distance(rhs.key, key));
00349         if (temp != 0) {
00350             return temp;
00351         }
00352         return pc.compare(lhs.prox, rhs.prox);
00353     }


The documentation for this class was generated from the following file:
Generated on Wed May 26 16:21:17 2010 for OverSim by  doxygen 1.6.3