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

Method post

gecode/set/precede/single.hpp:99–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98 template<class View>
99 inline ExecStatus
100 Single<View>::post(Home home, ViewArray<View>& x, int s, int t) {
101 {
102 int alpha = 0;
103 while (alpha < x.size()) {
104 if (x[alpha].notContains(s)) {
105 GECODE_ME_CHECK(x[alpha].exclude(home, t));
106 } else if (x[alpha].contains(t)) {
107 GECODE_ME_CHECK(x[alpha].include(home, s));
108 } else {
109 break;
110 }
111 alpha++;
112 }
113 x.drop_fst(alpha);
114 if (x.size() == 0)
115 return ES_OK;
116 }
117 // alpha has been normalized to 0
118 int beta = 0, gamma = 0;
119 do {
120 gamma++;
121 } while ((gamma < x.size()) &&
122 (!x[gamma].notContains(s) || !x[gamma].contains(t)));
123 do {
124 beta++;
125 } while ((beta < x.size()) &&
126 (x[beta].notContains(s) || x[beta].contains(t)));
127 if (beta > gamma) {
128 GECODE_ME_CHECK(x[0].exclude(home, t));
129 GECODE_ME_CHECK(x[0].include(home, s));
130 return ES_OK;
131 }
132 if (gamma < x.size())
133 x.drop_lst(gamma);
134 (void) new (home) Single<View>(home, x, s, t, beta, gamma);
135 return ES_OK;
136 }
137
138
139

Callers

nothing calls this directly

Calls 7

drop_fstMethod · 0.80
drop_lstMethod · 0.80
sizeMethod · 0.45
notContainsMethod · 0.45
excludeMethod · 0.45
containsMethod · 0.45
includeMethod · 0.45

Tested by

no test coverage detected