/src/rdkit/Code/Query/GreaterEqualQuery.h
Line | Count | Source |
1 | | // |
2 | | // Copyright (c) 2003-2020 Greg Landrum and Rational Discovery LLC |
3 | | // |
4 | | // @@ All Rights Reserved @@ |
5 | | // This file is part of the RDKit. |
6 | | // The contents are covered by the terms of the BSD license |
7 | | // which is included in the file license.txt, found at the root |
8 | | // of the RDKit source tree. |
9 | | // |
10 | | #include <RDGeneral/export.h> |
11 | | #ifndef RD_GREATEREQUALQUERY_H |
12 | | #define RD_GREATEREQUALQUERY_H |
13 | | #include "Query.h" |
14 | | #include "EqualityQuery.h" |
15 | | |
16 | | namespace Queries { |
17 | | //! \brief a Query implementing >= using a particular |
18 | | //! value (and an optional tolerance) |
19 | | template <class MatchFuncArgType, class DataFuncArgType = MatchFuncArgType, |
20 | | bool needsConversion = false> |
21 | | class RDKIT_QUERY_EXPORT GreaterEqualQuery |
22 | | : public EqualityQuery<MatchFuncArgType, DataFuncArgType, needsConversion> { |
23 | | public: |
24 | 5.49k | GreaterEqualQuery() { this->d_tol = 0; }Queries::GreaterEqualQuery<int, RDKit::Atom const*, true>::GreaterEqualQuery() Line | Count | Source | 24 | 4.65k | GreaterEqualQuery() { this->d_tol = 0; } |
Queries::GreaterEqualQuery<int, RDKit::Bond const*, true>::GreaterEqualQuery() Line | Count | Source | 24 | 838 | GreaterEqualQuery() { this->d_tol = 0; } |
|
25 | | //! constructs with our target value |
26 | | explicit GreaterEqualQuery(DataFuncArgType what) { |
27 | | this->d_val = what; |
28 | | this->d_tol = 0; |
29 | | this->df_negate = false; |
30 | | } |
31 | | //! constructs with our target value and a tolerance |
32 | | GreaterEqualQuery(DataFuncArgType v, DataFuncArgType t) { |
33 | | this->d_val = v; |
34 | | this->d_tol = t; |
35 | | this->df_negate = false; |
36 | | } |
37 | | |
38 | 0 | bool Match(const DataFuncArgType what) const override { |
39 | 0 | MatchFuncArgType mfArg = |
40 | 0 | this->TypeConvert(what, Int2Type<needsConversion>()); |
41 | 0 | if (queryCmp(this->d_val, mfArg, this->d_tol) >= 0) { |
42 | 0 | return !this->getNegation(); |
43 | 0 | } else { |
44 | 0 | return this->getNegation(); |
45 | 0 | } |
46 | 0 | } Unexecuted instantiation: Queries::GreaterEqualQuery<int, RDKit::Atom const*, true>::Match(RDKit::Atom const*) const Unexecuted instantiation: Queries::GreaterEqualQuery<int, RDKit::Bond const*, true>::Match(RDKit::Bond const*) const |
47 | | Query<MatchFuncArgType, DataFuncArgType, needsConversion> *copy() |
48 | 3.29k | const override { |
49 | 3.29k | GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, needsConversion> *res = |
50 | 3.29k | new GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, |
51 | 3.29k | needsConversion>(); |
52 | 3.29k | res->setVal(this->d_val); |
53 | 3.29k | res->setTol(this->d_tol); |
54 | 3.29k | res->setNegation(this->getNegation()); |
55 | 3.29k | res->setDataFunc(this->d_dataFunc); |
56 | 3.29k | res->d_description = this->d_description; |
57 | 3.29k | res->d_queryType = this->d_queryType; |
58 | 3.29k | return res; |
59 | 3.29k | } Queries::GreaterEqualQuery<int, RDKit::Atom const*, true>::copy() const Line | Count | Source | 48 | 2.71k | const override { | 49 | 2.71k | GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, needsConversion> *res = | 50 | 2.71k | new GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, | 51 | 2.71k | needsConversion>(); | 52 | 2.71k | res->setVal(this->d_val); | 53 | 2.71k | res->setTol(this->d_tol); | 54 | 2.71k | res->setNegation(this->getNegation()); | 55 | 2.71k | res->setDataFunc(this->d_dataFunc); | 56 | 2.71k | res->d_description = this->d_description; | 57 | 2.71k | res->d_queryType = this->d_queryType; | 58 | 2.71k | return res; | 59 | 2.71k | } |
Queries::GreaterEqualQuery<int, RDKit::Bond const*, true>::copy() const Line | Count | Source | 48 | 582 | const override { | 49 | 582 | GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, needsConversion> *res = | 50 | 582 | new GreaterEqualQuery<MatchFuncArgType, DataFuncArgType, | 51 | 582 | needsConversion>(); | 52 | 582 | res->setVal(this->d_val); | 53 | 582 | res->setTol(this->d_tol); | 54 | 582 | res->setNegation(this->getNegation()); | 55 | 582 | res->setDataFunc(this->d_dataFunc); | 56 | 582 | res->d_description = this->d_description; | 57 | 582 | res->d_queryType = this->d_queryType; | 58 | 582 | return res; | 59 | 582 | } |
|
60 | | |
61 | 0 | std::string getFullDescription() const override { |
62 | 0 | std::ostringstream res; |
63 | 0 | res << this->getDescription(); |
64 | 0 | res << " " << this->d_val; |
65 | 0 | if (this->getNegation()) { |
66 | 0 | res << " ! >= "; |
67 | 0 | } else { |
68 | 0 | res << " >= "; |
69 | 0 | } |
70 | 0 | return res.str(); |
71 | 0 | } Unexecuted instantiation: Queries::GreaterEqualQuery<int, RDKit::Atom const*, true>::getFullDescription() const Unexecuted instantiation: Queries::GreaterEqualQuery<int, RDKit::Bond const*, true>::getFullDescription() const |
72 | | }; |
73 | | } // namespace Queries |
74 | | #endif |