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

Method check

gecode/int/sequence/int.hpp:108–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107 template<class View, class Val>
108 forceinline ExecStatus
109 Sequence<View,Val>::check(ViewArray<View>& x, Val s, int q, int l, int u) {
110 Region r;
111 // could do this with an array of length q...
112 int* upper = r.alloc<int>(x.size()+1);
113 int* lower = r.alloc<int>(x.size()+1);
114 upper[0] = 0;
115 lower[0] = 0;
116 for ( int j=0; j<x.size(); j++ ) {
117 upper[j+1] = upper[j];
118 lower[j+1] = lower[j];
119 if (includes(x[j],s)) {
120 upper[j+1] += 1;
121 } else if (excludes(x[j],s)) {
122 lower[j+1] += 1;
123 }
124 if ( j+1 >= q && (q - l < lower[j+1] - lower[j+1-q] || upper[j+1] - upper[j+1-q] > u) ) {
125 return ES_FAILED;
126 }
127 }
128 return ES_OK;
129 }
130
131 template<class View, class Val>
132 ExecStatus

Callers

nothing calls this directly

Calls 3

includesFunction · 0.85
excludesFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected