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

Function p_array_set_element

gecode/flatzinc/registry.cpp:2020–2039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2018 }
2019
2020 void p_array_set_element(FlatZincSpace& s, const ConExpr& ce,
2021 AST::Node*) {
2022 bool isConstant = true;
2023 AST::Array* a = ce[1]->getArray();
2024 for (int i=a->a.size(); i--;) {
2025 if (a->a[i]->isSetVar()) {
2026 isConstant = false;
2027 break;
2028 }
2029 }
2030 IntVar selector = s.arg2IntVar(ce[0]);
2031 rel(s, selector > 0);
2032 if (isConstant) {
2033 IntSetArgs sv = s.arg2intsetargs(ce[1],1);
2034 element(s, sv, selector, s.arg2SetVar(ce[2]));
2035 } else {
2036 SetVarArgs sv = s.arg2setvarargs(ce[1], 1);
2037 element(s, sv, selector, s.arg2SetVar(ce[2]));
2038 }
2039 }
2040
2041 void p_array_set_element_op(FlatZincSpace& s, const ConExpr& ce,
2042 AST::Node*, SetOpType op,

Callers

nothing calls this directly

Calls 9

getArrayMethod · 0.80
isSetVarMethod · 0.80
arg2IntVarMethod · 0.80
arg2intsetargsMethod · 0.80
arg2SetVarMethod · 0.80
arg2setvarargsMethod · 0.80
relFunction · 0.50
elementFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected