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

Function p_array_bool_element

gecode/flatzinc/registry.cpp:763–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761 }
762 }
763 void p_array_bool_element(FlatZincSpace& s, const ConExpr& ce,
764 AST::Node* ann) {
765 bool isConstant = true;
766 AST::Array* a = ce[1]->getArray();
767 for (int i=a->a.size(); i--;) {
768 if (!a->a[i]->isBool()) {
769 isConstant = false;
770 break;
771 }
772 }
773 IntVar selector = s.arg2IntVar(ce[0]);
774 rel(s, selector > 0);
775 if (isConstant) {
776 IntSharedArray sia = s.arg2boolsharedarray(ce[1], 1);
777 element(s, sia, selector, s.arg2BoolVar(ce[2]), s.ann2ipl(ann));
778 } else {
779 BoolVarArgs iv = s.arg2boolvarargs(ce[1], 1);
780 element(s, iv, selector, s.arg2BoolVar(ce[2]), s.ann2ipl(ann));
781 }
782 }
783 void p_array_bool_element_offset(FlatZincSpace& s, const ConExpr& ce,
784 AST::Node* ann) {
785 bool isConstant = true;

Callers

nothing calls this directly

Calls 10

getArrayMethod · 0.80
isBoolMethod · 0.80
arg2IntVarMethod · 0.80
arg2boolsharedarrayMethod · 0.80
arg2BoolVarMethod · 0.80
ann2iplMethod · 0.80
arg2boolvarargsMethod · 0.80
relFunction · 0.50
elementFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected