| 2602 | } |
| 2603 | |
| 2604 | void |
| 2605 | Printer::printElem(std::ostream& out, |
| 2606 | AST::Node* ai, |
| 2607 | const Gecode::IntVarArray& iv, |
| 2608 | const Gecode::BoolVarArray& bv |
| 2609 | #ifdef GECODE_HAS_SET_VARS |
| 2610 | , const Gecode::SetVarArray& sv |
| 2611 | #endif |
| 2612 | #ifdef GECODE_HAS_FLOAT_VARS |
| 2613 | , |
| 2614 | const Gecode::FloatVarArray& fv |
| 2615 | #endif |
| 2616 | ) const { |
| 2617 | int k; |
| 2618 | if (ai->isInt(k)) { |
| 2619 | out << k; |
| 2620 | } else if (ai->isIntVar()) { |
| 2621 | out << iv[ai->getIntVar()]; |
| 2622 | } else if (ai->isBoolVar()) { |
| 2623 | if (bv[ai->getBoolVar()].min() == 1) { |
| 2624 | out << "true"; |
| 2625 | } else if (bv[ai->getBoolVar()].max() == 0) { |
| 2626 | out << "false"; |
| 2627 | } else { |
| 2628 | out << "false..true"; |
| 2629 | } |
| 2630 | #ifdef GECODE_HAS_SET_VARS |
| 2631 | } else if (ai->isSetVar()) { |
| 2632 | if (!sv[ai->getSetVar()].assigned()) { |
| 2633 | out << sv[ai->getSetVar()]; |
| 2634 | return; |
| 2635 | } |
| 2636 | SetVarGlbRanges svr(sv[ai->getSetVar()]); |
| 2637 | if (!svr()) { |
| 2638 | out << "{}"; |
| 2639 | return; |
| 2640 | } |
| 2641 | int min = svr.min(); |
| 2642 | int max = svr.max(); |
| 2643 | ++svr; |
| 2644 | if (svr()) { |
| 2645 | SetVarGlbValues svv(sv[ai->getSetVar()]); |
| 2646 | int i = svv.val(); |
| 2647 | out << "{" << i; |
| 2648 | ++svv; |
| 2649 | for (; svv(); ++svv) |
| 2650 | out << ", " << svv.val(); |
| 2651 | out << "}"; |
| 2652 | } else { |
| 2653 | out << min << ".." << max; |
| 2654 | } |
| 2655 | #endif |
| 2656 | #ifdef GECODE_HAS_FLOAT_VARS |
| 2657 | } else if (ai->isFloatVar()) { |
| 2658 | if (fv[ai->getFloatVar()].assigned()) { |
| 2659 | FloatVal vv = fv[ai->getFloatVar()].val(); |
| 2660 | FloatNum v; |
| 2661 | if (vv.singleton()) |
nothing calls this directly
no test coverage detected