| 301 | |
| 302 | template<class View,class Val,bool iss> |
| 303 | forceinline bool |
| 304 | ViewValSupport<View,Val,iss>::pushup(ViewArray<View>& a,Val s,int i,int q,int idx, int v) { |
| 305 | if ( !retired() ) { |
| 306 | int n = a.size() + 1; |
| 307 | |
| 308 | set(idx,y[idx]+v,q,n); |
| 309 | |
| 310 | if ( y[idx] > idx ) { |
| 311 | return false; |
| 312 | } |
| 313 | |
| 314 | int t = idx; |
| 315 | |
| 316 | // repair y on the left |
| 317 | while ( idx > 0 && ((y[idx]-y[idx-1]>1) || ((y[idx]-y[idx-1]==1 && s_not_possible(a,s,i,idx)))) ) { |
| 318 | if ( s_not_possible(a,s,i,idx) ) { |
| 319 | set(idx-1,y[idx],q,n); |
| 320 | } else { |
| 321 | set(idx-1,y[idx]-1,q,n); |
| 322 | } |
| 323 | if ( y[idx-1]>idx-1 ) { |
| 324 | return false; |
| 325 | } |
| 326 | idx -= 1; |
| 327 | } |
| 328 | |
| 329 | idx = t; |
| 330 | |
| 331 | // repair y on the right |
| 332 | while ( idx < a.size() && ((y[idx]-y[idx+1]>0) || ((y[idx]-y[idx+1]==0) && alternative_not_possible(a,s,i,idx+1))) ) { |
| 333 | if ( alternative_not_possible(a,s,i,idx+1) ) { |
| 334 | set(idx+1,y[idx]+1,q,n); |
| 335 | } else { |
| 336 | set(idx+1,y[idx],q,n); |
| 337 | } |
| 338 | idx += 1; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | template<class View,class Val,bool iss> |
| 346 | forceinline ExecStatus |