GreaterQuery.h

Go to the documentation of this file.
00001 //
00002 // Copyright (c) 2003-2006 Greg Landrum and Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef __RD_GREATERQUERY_H__
00007 #define __RD_GREATERQUERY_H__
00008 #include "Query.h"
00009 #include "EqualityQuery.h"
00010 
00011 namespace Queries {
00012   //! \brief a Query implementing > using a particular
00013   //!  value (and an optional tolerance)
00014   template <class MatchFuncArgType, class DataFuncArgType=MatchFuncArgType,
00015     bool needsConversion=false>
00016   class GreaterQuery :
00017     public EqualityQuery<MatchFuncArgType, DataFuncArgType,needsConversion> {
00018 
00019   public:
00020     GreaterQuery() {
00021       this->d_tol = 0;
00022     };
00023     //! constructs with our target value
00024     explicit GreaterQuery(DataFuncArgType v) {
00025       this->d_val = v;
00026       this->d_tol = 0;
00027       this->df_negate = false;
00028     };
00029     //! constructs with our target value and a tolerance
00030     GreaterQuery(DataFuncArgType v,DataFuncArgType t) {
00031       this->d_val = v;
00032       this->d_tol = t;
00033       this->df_negate = false;
00034     };
00035 
00036     bool Match(const DataFuncArgType what) const {
00037       MatchFuncArgType mfArg = TypeConvert(what,Int2Type<needsConversion>());
00038       if( queryCmp(this->d_val,mfArg,this->d_tol) > 0 ){
00039         if( this->getNegation() ) return false;
00040         else return true;
00041       } else {
00042         if( this->getNegation() ) return true;
00043         else return false;
00044       }
00045     };
00046 
00047     Query<MatchFuncArgType,DataFuncArgType,needsConversion> *
00048     copy( ) const {
00049       GreaterQuery<MatchFuncArgType,DataFuncArgType,needsConversion> *res =
00050         new GreaterQuery<MatchFuncArgType,DataFuncArgType,needsConversion>();
00051       res->setVal(this->d_val);
00052       res->setTol(this->d_tol);
00053       res->setNegation(this->getNegation());
00054       res->setDataFunc(this->d_dataFunc);
00055       res->d_description = this->d_description;
00056       return res;
00057     };
00058 
00059   };
00060 
00061 }
00062 #endif

Generated on Sat May 24 08:36:32 2008 for RDCode by  doxygen 1.5.3