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

Method post

gecode/int/precede/single.hpp:95–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94 template<class View>
95 inline ExecStatus
96 Single<View>::post(Home home, ViewArray<View>& x, int s, int t) {
97 {
98 int alpha = 0;
99 while ((alpha < x.size()) && !x[alpha].in(s))
100 GECODE_ME_CHECK(x[alpha++].nq(home,t));
101 x.drop_fst(alpha);
102 if (x.size() == 0)
103 return ES_OK;
104 }
105 // alpha has been normalized to 0
106 int beta = 0, gamma = 0;
107 GECODE_ME_CHECK(x[0].nq(home,t));
108 do {
109 gamma++;
110 } while ((gamma < x.size()) && !assigned(x[gamma],t));
111 do {
112 beta++;
113 } while ((beta < x.size()) && !x[beta].in(s));
114 if (beta > gamma) {
115 GECODE_ME_CHECK(x[0].eq(home, s));
116 return ES_OK;
117 }
118 if (gamma < x.size())
119 x.drop_lst(gamma);
120 (void) new (home) Single<View>(home, x, s, t, beta, gamma);
121 return ES_OK;
122 }
123
124
125

Callers

nothing calls this directly

Calls 7

assignedFunction · 0.85
drop_fstMethod · 0.80
drop_lstMethod · 0.80
sizeMethod · 0.45
inMethod · 0.45
nqMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected