StdProxComparator Class Reference

#include <Comparator.h>

Inheritance diagram for StdProxComparator:
AbstractProxComparator

List of all members.

Public Member Functions

int compare (const Prox &lhs, const Prox &rhs) const
 indicates which of the two given proximities is "better"

Detailed Description

Definition at line 271 of file Comparator.h.


Member Function Documentation

int StdProxComparator::compare ( const Prox lhs,
const Prox rhs 
) const [inline, virtual]

indicates which of the two given proximities is "better"

Parameters:
lhs first proximity value
rhs second proximity value
Returns:
-1 if lhs is closer, 0 if lhs and rhs are equal and 1 if rhs closer

Implements AbstractProxComparator.

Definition at line 274 of file Comparator.h.

Referenced by KademliaPRComparator::compare().

00275     {
00276         // return 0 if accuracy is too low
00277         if (lhs.accuracy < 0.5 || rhs.accuracy < 0.5) return 0;
00278 
00279         if (lhs.proximity < rhs.proximity) return -1;
00280         if (lhs.proximity > rhs.proximity) return 1;
00281         return 0;
00282     }


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