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

Method shrinkElement

gecode/flatzinc/flatzinc.cpp:2935–2968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2933#endif
2934
2935 void
2936 Printer::shrinkElement(AST::Node* node,
2937 std::map<int,int>& iv, std::map<int,int>& bv,
2938 std::map<int,int>& sv, std::map<int,int>& fv) {
2939 if (node->isIntVar()) {
2940 AST::IntVar* x = static_cast<AST::IntVar*>(node);
2941 if (iv.find(x->i) == iv.end()) {
2942 int newi = iv.size();
2943 iv[x->i] = newi;
2944 }
2945 x->i = iv[x->i];
2946 } else if (node->isBoolVar()) {
2947 AST::BoolVar* x = static_cast<AST::BoolVar*>(node);
2948 if (bv.find(x->i) == bv.end()) {
2949 int newi = bv.size();
2950 bv[x->i] = newi;
2951 }
2952 x->i = bv[x->i];
2953 } else if (node->isSetVar()) {
2954 AST::SetVar* x = static_cast<AST::SetVar*>(node);
2955 if (sv.find(x->i) == sv.end()) {
2956 int newi = sv.size();
2957 sv[x->i] = newi;
2958 }
2959 x->i = sv[x->i];
2960 } else if (node->isFloatVar()) {
2961 AST::FloatVar* x = static_cast<AST::FloatVar*>(node);
2962 if (fv.find(x->i) == fv.end()) {
2963 int newi = fv.size();
2964 fv[x->i] = newi;
2965 }
2966 x->i = fv[x->i];
2967 }
2968 }
2969
2970 void
2971 Printer::shrinkArrays(Space& home,

Callers

nothing calls this directly

Calls 7

isIntVarMethod · 0.80
isBoolVarMethod · 0.80
isSetVarMethod · 0.80
isFloatVarMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected