KeyDistanceComparator< Metric > Class Template Reference

OverlayKey distance comparator. More...

#include <Comparator.h>

Inheritance diagram for KeyDistanceComparator< Metric >:
Comparator< OverlayKey >

List of all members.

Public Member Functions

 KeyDistanceComparator (const OverlayKey &relativeKey)
 constructor
int compare (const OverlayKey &lhs, const OverlayKey &rhs) const
 indicates which of the two given keys is closer to the relative key

Private Attributes

Metric m
 indicates which metric to use for the comparison
OverlayKey key
 the relative key to which distances are compared

Detailed Description

template<class Metric = KeyStdMetric>
class KeyDistanceComparator< Metric >

OverlayKey distance comparator.

Definition at line 194 of file Comparator.h.


Constructor & Destructor Documentation

template<class Metric = KeyStdMetric>
KeyDistanceComparator< Metric >::KeyDistanceComparator ( const OverlayKey relativeKey  )  [inline]

constructor

Definition at line 204 of file Comparator.h.

00205     {
00206         this->key = relativeKey;
00207     }


Member Function Documentation

template<class Metric = KeyStdMetric>
int KeyDistanceComparator< Metric >::compare ( const OverlayKey lhs,
const OverlayKey rhs 
) const [inline, virtual]

indicates which of the two given keys is closer to the relative key

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

Reimplemented from Comparator< OverlayKey >.

Definition at line 218 of file Comparator.h.

00219     {
00220         return m.distance(lhs, key).compareTo(m.distance(rhs, key));
00221     }


Member Data Documentation

template<class Metric = KeyStdMetric>
OverlayKey KeyDistanceComparator< Metric >::key [private]
template<class Metric = KeyStdMetric>
Metric KeyDistanceComparator< Metric >::m [private]

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