PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef polybori_groebner_CheckChainCriterion_h_ 00017 #define polybori_groebner_CheckChainCriterion_h_ 00018 00019 // include basic definitions 00020 #include "groebner_defs.h" 00021 00022 BEGIN_NAMESPACE_PBORIGB 00023 00029 template <class StrategyType> 00030 class CheckChainCriterion { 00031 public: 00032 typedef StrategyType strategy_type; 00033 00034 CheckChainCriterion(strategy_type& strategy, PairStatusSet& status): 00035 m_strategy(strategy), m_status(status) {} 00036 00038 bool operator()(const Pair& current) { 00039 switch (current.getType()) { 00040 case IJ_PAIR: return compute(current.ijPair(), current.lm); 00041 case VARIABLE_PAIR: return compute(current.variablePair()); 00042 } 00043 return false; 00044 } 00045 00046 protected: 00047 bool compute(const IJPairData& ij, const Exponent& exp) { 00048 return m_status.hasTRep(ij.i, ij.j) || 00049 checkPairCriteria(exp, ij.i, ij.j); 00050 } 00051 00052 bool compute(const VariablePairData& vp) { 00053 return m_strategy.checkVariableCriteria(vp.i, vp.v); 00054 } 00055 00056 bool checkPairCriteria(const Exponent& exp, int i, int j) { 00057 if (m_strategy.checkPairCriteria(exp, i, j)) { 00058 m_status.setToHasTRep(i, j); 00059 return true; 00060 } 00061 return false; 00062 } 00063 00064 private: 00065 strategy_type& m_strategy; 00066 PairStatusSet& m_status; 00067 }; 00068 00069 END_NAMESPACE_PBORIGB 00070 00071 #endif /* polybori_groebner_CheckChainCriterion_h_ */