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

Function p_array_int_element

gecode/flatzinc/registry.cpp:694–713  ·  view source on GitHub ↗

element constraints */

Source from the content-addressed store, hash-verified

692
693 /* element constraints */
694 void p_array_int_element(FlatZincSpace& s, const ConExpr& ce,
695 AST::Node* ann) {
696 bool isConstant = true;
697 AST::Array* a = ce[1]->getArray();
698 for (int i=a->a.size(); i--;) {
699 if (!a->a[i]->isInt()) {
700 isConstant = false;
701 break;
702 }
703 }
704 IntVar selector = s.arg2IntVar(ce[0]);
705 rel(s, selector > 0);
706 if (isConstant) {
707 IntSharedArray sia = s.arg2intsharedarray(ce[1]);
708 element(s, sia, selector, -1, s.arg2IntVar(ce[2]), s.ann2ipl(ann));
709 } else {
710 IntVarArgs iv = s.arg2intvarargs(ce[1]);
711 element(s, iv, selector, -1, s.arg2IntVar(ce[2]), s.ann2ipl(ann));
712 }
713 }
714 void p_array_int_element_offset(FlatZincSpace& s, const ConExpr& ce,
715 AST::Node* ann) {
716 bool isConstant = true;

Callers

nothing calls this directly

Calls 9

getArrayMethod · 0.80
isIntMethod · 0.80
arg2IntVarMethod · 0.80
arg2intsharedarrayMethod · 0.80
ann2iplMethod · 0.80
arg2intvarargsMethod · 0.80
relFunction · 0.50
elementFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected