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

Function p_array_int_element_offset

gecode/flatzinc/registry.cpp:714–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712 }
713 }
714 void p_array_int_element_offset(FlatZincSpace& s, const ConExpr& ce,
715 AST::Node* ann) {
716 bool isConstant = true;
717 AST::Array* a = ce[2]->getArray();
718 for (int i=a->a.size(); i--;) {
719 if (!a->a[i]->isInt()) {
720 isConstant = false;
721 break;
722 }
723 }
724 IntVar selector = s.arg2IntVar(ce[0]);
725 int offset = ce[1]->getInt();
726 rel(s, selector >= offset);
727 if (isConstant) {
728 IntSharedArray sia = s.arg2intsharedarray(ce[2]);
729 element(s, sia, selector, -offset, s.arg2IntVar(ce[3]), s.ann2ipl(ann));
730 } else {
731 IntVarArgs iv = s.arg2intvarargs(ce[2]);
732 element(s, iv, selector, -offset, s.arg2IntVar(ce[3]), s.ann2ipl(ann));
733 }
734 }
735 void p_array_int_element2d(FlatZincSpace& s, const ConExpr& ce,
736 AST::Node* ann) {
737 bool isConstant = true;

Callers

nothing calls this directly

Calls 10

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