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

Function p_array_set_element_op

gecode/flatzinc/registry.cpp:2041–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2039 }
2040
2041 void p_array_set_element_op(FlatZincSpace& s, const ConExpr& ce,
2042 AST::Node*, SetOpType op,
2043 const IntSet& universe =
2044 IntSet(Set::Limits::min,Set::Limits::max)) {
2045 bool isConstant = true;
2046 AST::Array* a = ce[1]->getArray();
2047 for (int i=a->a.size(); i--;) {
2048 if (a->a[i]->isSetVar()) {
2049 isConstant = false;
2050 break;
2051 }
2052 }
2053 SetVar selector = s.arg2SetVar(ce[0]);
2054 dom(s, selector, SRT_DISJ, 0);
2055 if (isConstant) {
2056 IntSetArgs sv = s.arg2intsetargs(ce[1], 1);
2057 element(s, op, sv, selector, s.arg2SetVar(ce[2]), universe);
2058 } else {
2059 SetVarArgs sv = s.arg2setvarargs(ce[1], 1);
2060 element(s, op, sv, selector, s.arg2SetVar(ce[2]), universe);
2061 }
2062 }
2063
2064 void p_array_set_element_union(FlatZincSpace& s, const ConExpr& ce,
2065 AST::Node* ann) {

Calls 9

IntSetClass · 0.85
getArrayMethod · 0.80
isSetVarMethod · 0.80
arg2SetVarMethod · 0.80
arg2intsetargsMethod · 0.80
arg2setvarargsMethod · 0.80
domFunction · 0.50
elementFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected