OverSim
AccordionPRComparator Class Reference

#include <Comparator.h>

Inheritance diagram for AccordionPRComparator:
ProxKeyComparator< KeyPrefixMetric > AbstractProxKeyComparator

Public Member Functions

 AccordionPRComparator (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
- Public Member Functions inherited from ProxKeyComparator< KeyPrefixMetric >
 ProxKeyComparator (const OverlayKey &relativeKey, uint32_t bitsPerDigit=1)
 constructor
- Public Member Functions inherited from AbstractProxKeyComparator
virtual ~AbstractProxKeyComparator ()

Additional Inherited Members

- Protected Attributes inherited from ProxKeyComparator< KeyPrefixMetric >
KeyPrefixMetric m
 indicates which metric to use for the key comparison
StdProxComparator pc
OverlayKey key
 the relative key to which distances are compared

Detailed Description

Definition at line 377 of file Comparator.h.

Constructor & Destructor Documentation

AccordionPRComparator::AccordionPRComparator ( const OverlayKey relativeKey,
uint32_t  bitsPerDigit = 1 
)
inline

Definition at line 380 of file Comparator.h.

Member Function Documentation

int AccordionPRComparator::compare ( const ProxKey lhs,
const ProxKey rhs 
) const
inlinevirtual

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

Parameters
lhsfirst prox/key-pair
rhssecond 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 383 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: