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

Function p_array_bool_element_offset

gecode/flatzinc/registry.cpp:783–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781 }
782 }
783 void p_array_bool_element_offset(FlatZincSpace& s, const ConExpr& ce,
784 AST::Node* ann) {
785 bool isConstant = true;
786 AST::Array* a = ce[2]->getArray();
787 for (int i=a->a.size(); i--;) {
788 if (!a->a[i]->isBool()) {
789 isConstant = false;
790 break;
791 }
792 }
793 IntVar selector = s.arg2IntVar(ce[0]);
794 int offset = ce[1]->getInt();
795 rel(s, selector >= offset);
796 if (isConstant) {
797 IntSharedArray sia = s.arg2boolsharedarray(ce[2]);
798 element(s, sia, selector, -offset, s.arg2BoolVar(ce[3]), s.ann2ipl(ann));
799 } else {
800 BoolVarArgs iv = s.arg2boolvarargs(ce[2]);
801 element(s, iv, selector, -offset, s.arg2BoolVar(ce[3]), s.ann2ipl(ann));
802 }
803 }
804 void p_array_bool_element2d(FlatZincSpace& s, const ConExpr& ce,
805 AST::Node* ann) {
806 bool isConstant = true;

Callers

nothing calls this directly

Calls 11

getArrayMethod · 0.80
isBoolMethod · 0.80
arg2IntVarMethod · 0.80
getIntMethod · 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