lemon/elevator.h
changeset 1328 d51126dc39fa
parent 628 aa1804409f29
equal deleted inserted replaced
8:8347d666473c 9:3ae74e7a0882
   165     int operator[](Item i) const { return _level[i]; }
   165     int operator[](Item i) const { return _level[i]; }
   166 
   166 
   167     ///Return the number of items on level \c l.
   167     ///Return the number of items on level \c l.
   168     int onLevel(int l) const
   168     int onLevel(int l) const
   169     {
   169     {
   170       return _first[l+1]-_first[l];
   170       return static_cast<int>(_first[l+1]-_first[l]);
   171     }
   171     }
   172     ///Return true if level \c l is empty.
   172     ///Return true if level \c l is empty.
   173     bool emptyLevel(int l) const
   173     bool emptyLevel(int l) const
   174     {
   174     {
   175       return _first[l+1]-_first[l]==0;
   175       return _first[l+1]-_first[l]==0;
   176     }
   176     }
   177     ///Return the number of items above level \c l.
   177     ///Return the number of items above level \c l.
   178     int aboveLevel(int l) const
   178     int aboveLevel(int l) const
   179     {
   179     {
   180       return _first[_max_level+1]-_first[l+1];
   180       return static_cast<int>(_first[_max_level+1]-_first[l+1]);
   181     }
   181     }
   182     ///Return the number of active items on level \c l.
   182     ///Return the number of active items on level \c l.
   183     int activesOnLevel(int l) const
   183     int activesOnLevel(int l) const
   184     {
   184     {
   185       return _last_active[l]-_first[l]+1;
   185       return static_cast<int>(_last_active[l]-_first[l]+1);
   186     }
   186     }
   187     ///Return true if there is no active item on level \c l.
   187     ///Return true if there is no active item on level \c l.
   188     bool activeFree(int l) const
   188     bool activeFree(int l) const
   189     {
   189     {
   190       return _last_active[l]<_first[l];
   190       return _last_active[l]<_first[l];