gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Don't assume that the default maps are reference maps (in Elevator)
0 1 0
default
1 file changed with 19 insertions and 17 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -74,7 +74,7 @@
74 74

	
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)
80 80
    {
... ...
@@ -82,15 +82,15 @@
82 82
        {
83 83
          Item i=*s;
84 84
          *p=i;
85
          _where[i]=p;
85
          _where.set(i,p);
86 86
        }
87 87
    }
88 88
    void swap(Vit i, Vit j)
89 89
    {
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
    }
96 96

	
... ...
@@ -227,7 +227,8 @@
227 227
    ///
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];
233 234
    }
... ...
@@ -250,7 +251,7 @@
250 251
          --_last_active[l];
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
    }
256 257

	
... ...
@@ -274,7 +275,7 @@
274 275
        }
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 &&
280 281
            _last_active[_highest_active]<_first[_highest_active])
... ...
@@ -305,7 +306,8 @@
305 306
    ///by one.
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;
311 313
    }
... ...
@@ -325,7 +327,7 @@
325 327
          copy(--_first[l+1], _last_active[l]--);
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
    }
331 333

	
... ...
@@ -345,7 +347,7 @@
345 347
        }
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) {
351 353
        while(_highest_active>=0 &&
... ...
@@ -376,7 +378,7 @@
376 378
          copy(--_first[l+1],_last_active[l]--);
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
    }
382 384

	
... ...
@@ -387,7 +389,7 @@
387 389
    ///you really know what it is for.
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

	
393 395
    ///Lift all items on and above a level to the top (and deactivate them).
... ...
@@ -399,7 +401,7 @@
399 401
      const Vit f=_first[l];
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
        {
405 407
          _first[i]=f;
... ...
@@ -440,8 +442,8 @@
440 442
      for(typename ItemSetTraits<Graph,Item>::ItemIt i(_g);i!=INVALID;++i)
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
        }
447 449
    }
... ...
@@ -450,8 +452,8 @@
450 452

	
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
    }
457 459

	
0 comments (0 inline)