GreaterEqualQuery.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_GREATEREQUALQUERY_H__
00007 #define __RD_GREATEREQUALQUERY_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 GreaterEqualQuery :
00017     public EqualityQuery<MatchFuncArgType, DataFuncArgType,needsConversion> {
00018 
00019   public:
00020     GreaterEqualQuery() { this->d_tol=0;};
00021     //! constructs with our target value
00022     explicit GreaterEqualQuery(DataFuncArgType what) {
00023       this->d_val = what;
00024       this->d_tol = 0;
00025       this->df_negate = false;
00026     };
00027     //! constructs with our target value and a tolerance
00028     GreaterEqualQuery(DataFuncArgType v,DataFuncArgType t) {
00029       this->d_val = v;
00030       this->d_tol = t;
00031       this->df_negate = false;
00032     };
00033 
00034 
00035     bool Match(const DataFuncArgType what) const {
00036       MatchFuncArgType mfArg = TypeConvert(what,Int2Type<needsConversion>());
00037       if( queryCmp(this->d_val,mfArg,this->d_tol) >= 0 ){
00038         if( this->getNegation() ) return false;
00039         else return true;
00040       } else {
00041         if( this->getNegation() ) return true;
00042         else return false;
00043       }
00044     };
00045     Query<MatchFuncArgType,DataFuncArgType,needsConversion> *
00046     copy( ) const {
00047       GreaterEqualQuery<MatchFuncArgType,DataFuncArgType,needsConversion> *res =
00048         new GreaterEqualQuery<MatchFuncArgType,DataFuncArgType,needsConversion>();
00049       res->setVal(this->d_val);
00050       res->setTol(this->d_tol);
00051       res->setNegation(this->getNegation());
00052       res->setDataFunc(this->d_dataFunc);
00053       res->d_description = this->d_description;
00054       return res;
00055     };
00056   };
00057 
00058 }
00059 #endif

Generated on Tue Oct 7 06:10:10 2008 for RDCode by  doxygen 1.5.5