KeyDistanceComparator< Metric > Class Template Reference

#include <Comparator.h>

Inheritance diagram for KeyDistanceComparator< Metric >:

Comparator< OverlayKey >

List of all members.


Detailed Description

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

OverlayKey distance comparator.

Public Member Functions

 KeyDistanceComparator (const OverlayKey &relativeKey)
 constructor
int compare (const OverlayKey &lhs, const OverlayKey &rhs) const
 indicates which of the two given keys has a longer distance 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

Constructor & Destructor Documentation

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

constructor

00137     {
00138         this->key = relativeKey;
00139     }


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 has a longer distance 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 >.

00151     {
00152         return m.distance( key, lhs ) .compareTo( 
00153                m.distance( key, rhs ) );
00154     }


Member Data Documentation

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

indicates which metric to use for the comparison

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

the relative key to which distances are compared


The documentation for this class was generated from the following file:
Generated on Thu Apr 17 13:19:29 2008 for ITM OverSim by  doxygen 1.5.3