MCPcopy Create free account
hub / github.com/Gecode/gecode / printElemDiff

Method printElemDiff

gecode/flatzinc/flatzinc.cpp:2708–2814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2706 }
2707
2708 void
2709 Printer::printElemDiff(std::ostream& out,
2710 AST::Node* ai,
2711 const Gecode::IntVarArray& iv1,
2712 const Gecode::IntVarArray& iv2,
2713 const Gecode::BoolVarArray& bv1,
2714 const Gecode::BoolVarArray& bv2
2715#ifdef GECODE_HAS_SET_VARS
2716 , const Gecode::SetVarArray& sv1,
2717 const Gecode::SetVarArray& sv2
2718#endif
2719#ifdef GECODE_HAS_FLOAT_VARS
2720 , const Gecode::FloatVarArray& fv1,
2721 const Gecode::FloatVarArray& fv2
2722#endif
2723 ) const {
2724#ifdef GECODE_HAS_GIST
2725 using namespace Gecode::Gist;
2726 int k;
2727 if (ai->isInt(k)) {
2728 out << k;
2729 } else if (ai->isIntVar()) {
2730 std::string res(Comparator::compare("",iv1[ai->getIntVar()],
2731 iv2[ai->getIntVar()]));
2732 if (res.length() > 0) {
2733 res.erase(0, 1); // Remove '='
2734 out << res;
2735 } else {
2736 out << iv1[ai->getIntVar()];
2737 }
2738 } else if (ai->isBoolVar()) {
2739 std::string res(Comparator::compare("",bv1[ai->getBoolVar()],
2740 bv2[ai->getBoolVar()]));
2741 if (res.length() > 0) {
2742 res.erase(0, 1); // Remove '='
2743 out << res;
2744 } else {
2745 out << bv1[ai->getBoolVar()];
2746 }
2747#ifdef GECODE_HAS_SET_VARS
2748 } else if (ai->isSetVar()) {
2749 std::string res(Comparator::compare("",sv1[ai->getSetVar()],
2750 sv2[ai->getSetVar()]));
2751 if (res.length() > 0) {
2752 res.erase(0, 1); // Remove '='
2753 out << res;
2754 } else {
2755 out << sv1[ai->getSetVar()];
2756 }
2757#endif
2758#ifdef GECODE_HAS_FLOAT_VARS
2759 } else if (ai->isFloatVar()) {
2760 std::string res(Comparator::compare("",fv1[ai->getFloatVar()],
2761 fv2[ai->getFloatVar()]));
2762 if (res.length() > 0) {
2763 res.erase(0, 1); // Remove '='
2764 out << res;
2765 } else {

Callers

nothing calls this directly

Calls 15

isIntMethod · 0.80
isIntVarMethod · 0.80
getIntVarMethod · 0.80
isBoolVarMethod · 0.80
getBoolVarMethod · 0.80
isSetVarMethod · 0.80
getSetVarMethod · 0.80
isFloatVarMethod · 0.80
getFloatVarMethod · 0.80
isBoolMethod · 0.80
getBoolMethod · 0.80
isSetMethod · 0.80

Tested by

no test coverage detected