PolyBoRi
CheckChainCriterion.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_CheckChainCriterion_h_
17 #define polybori_groebner_CheckChainCriterion_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
23 
29 template <class StrategyType>
31 public:
32  typedef StrategyType strategy_type;
33 
35  m_strategy(strategy), m_status(status) {}
36 
38  bool operator()(const Pair& current) {
39  switch (current.getType()) {
40  case IJ_PAIR: return compute(current.ijPair(), current.lm);
41  case VARIABLE_PAIR: return compute(current.variablePair());
42  }
43  return false;
44  }
45 
46 protected:
47  bool compute(const IJPairData& ij, const Exponent& exp) {
48  return m_status.hasTRep(ij.i, ij.j) ||
49  checkPairCriteria(exp, ij.i, ij.j);
50  }
51 
52  bool compute(const VariablePairData& vp) {
53  return m_strategy.checkVariableCriteria(vp.i, vp.v);
54  }
55 
56  bool checkPairCriteria(const Exponent& exp, int i, int j) {
57  if (m_strategy.checkPairCriteria(exp, i, j)) {
58  m_status.setToHasTRep(i, j);
59  return true;
60  }
61  return false;
62  }
63 
64 private:
65  strategy_type& m_strategy;
66  PairStatusSet& m_status;
67 };
68 
70 
71 #endif /* polybori_groebner_CheckChainCriterion_h_ */