Public Member Functions

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.


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.

    {
        int temp = m.distance(lhs.key, key).compareTo(m.distance(rhs.key, key));
        if (temp != 0) {
            return temp;
        }
        return pc.compare(lhs.prox, rhs.prox);
    }


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