Changeset 382:61fbd77f0f44 in lemon-1.2
- Timestamp:
- 11/21/08 11:41:36 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/elevator.h
r381 r382 75 75 void copy(Item i, Vit p) 76 76 { 77 _where [*p=i]=p;77 _where.set(*p=i,p); 78 78 } 79 79 void copy(Vit s, Vit p) … … 83 83 Item i=*s; 84 84 *p=i; 85 _where [i]=p;85 _where.set(i,p); 86 86 } 87 87 } … … 90 90 Item ti=*i; 91 91 Vit ct = _where[ti]; 92 _where [ti]=_where[*i=*j];93 _where [*j]=ct;92 _where.set(ti,_where[*i=*j]); 93 _where.set(*j,ct); 94 94 *j=ti; 95 95 } … … 228 228 void liftHighestActive() 229 229 { 230 ++_level[*_last_active[_highest_active]]; 230 Item it = *_last_active[_highest_active]; 231 _level.set(it,_level[it]+1); 231 232 swap(_last_active[_highest_active]--,_last_active[_highest_active+1]); 232 233 --_first[++_highest_active]; … … 251 252 } 252 253 copy(li,_first[new_level]); 253 _level [li]=new_level;254 _level.set(li,new_level); 254 255 _highest_active=new_level; 255 256 } … … 275 276 copy(li,_first[_max_level]); 276 277 --_last_active[_max_level]; 277 _level [li]=_max_level;278 _level.set(li,_max_level); 278 279 279 280 while(_highest_active>=0 && … … 306 307 Item liftActiveOn(int level) 307 308 { 308 ++_level[*_last_active[level]]; 309 Item it =*_last_active[level]; 310 _level.set(it,_level[it]+1); 309 311 swap(_last_active[level]--, --_first[level+1]); 310 312 if (level+1>_highest_active) ++_highest_active; … … 326 328 } 327 329 copy(ai,_first[new_level]); 328 _level [ai]=new_level;330 _level.set(ai,new_level); 329 331 if (new_level>_highest_active) _highest_active=new_level; 330 332 } … … 346 348 copy(ai,_first[_max_level]); 347 349 --_last_active[_max_level]; 348 _level [ai]=_max_level;350 _level.set(ai,_max_level); 349 351 350 352 if (_highest_active==level) { … … 377 379 } 378 380 copy(i,_first[new_level]); 379 _level [i]=new_level;381 _level.set(i,new_level); 380 382 if(new_level>_highest_active) _highest_active=new_level; 381 383 } … … 388 390 ///\pre The item is on the top level. 389 391 void dirtyTopButOne(Item i) { 390 _level [i] = _max_level - 1;392 _level.set(i,_max_level - 1); 391 393 } 392 394 … … 400 402 const Vit tl=_first[_max_level]; 401 403 for(Vit i=f;i!=tl;++i) 402 _level [*i]=_max_level;404 _level.set(*i,_max_level); 403 405 for(int i=l;i<=_max_level;i++) 404 406 { … … 441 443 { 442 444 *n=i; 443 _where [i]=n;444 _level [i]=_max_level;445 _where.set(i,n); 446 _level.set(i,_max_level); 445 447 ++n; 446 448 } … … 451 453 void initAddItem(Item i) 452 454 { 453 swap(_where[i],_init_num);454 _level [i]=_init_lev;455 swap(_where[i],_init_num); 456 _level.set(i,_init_lev); 455 457 ++_init_num; 456 458 }
Note: See TracChangeset
for help on using the changeset viewer.