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

Method post

gecode/int/bool/eqv.cpp:53–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 ExecStatus
54 NaryEqv::post(Home home, ViewArray<BoolView>& x, int pm2) {
55 int n = x.size();
56 for (int i=n; i--; )
57 if (x[i].assigned()) {
58 pm2 ^= x[i].val();
59 x[i] = x[--n];
60 }
61 if (n == 0)
62 return (pm2 == 1) ? ES_OK : ES_FAILED;
63 if (n == 1) {
64 GECODE_ME_CHECK(x[0].eq(home,1^pm2));
65 return ES_OK;
66 }
67 if (n == 2) {
68 if (pm2 == 1) {
69 return Bool::Eq<BoolView,BoolView>::post(home,x[0],x[1]);
70 } else {
71 NegBoolView nx(x[1]);
72 return Bool::Eq<BoolView,NegBoolView>::post(home,x[0],nx);
73 }
74 }
75 x.size(n);
76 (void) new (home) NaryEqv(home,x,pm2);
77 return ES_OK;
78 }
79
80 ExecStatus
81 NaryEqv::propagate(Space& home, const ModEventDelta&) {

Callers

nothing calls this directly

Calls 5

postFunction · 0.50
sizeMethod · 0.45
assignedMethod · 0.45
valMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected