lemon/bits/map_extender.h
changeset 209 765619b7cbb2
parent 107 31a2e6d28f61
child 263 be8a861d3bb7
     1.1 --- a/lemon/bits/map_extender.h	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/lemon/bits/map_extender.h	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -32,7 +32,7 @@
    1.13  namespace lemon {
    1.14  
    1.15    /// \ingroup graphbits
    1.16 -  /// 
    1.17 +  ///
    1.18    /// \brief Extender for maps
    1.19    template <typename _Map>
    1.20    class MapExtender : public _Map {
    1.21 @@ -56,10 +56,10 @@
    1.22  
    1.23    public:
    1.24  
    1.25 -    MapExtender(const Graph& graph) 
    1.26 +    MapExtender(const Graph& graph)
    1.27        : Parent(graph) {}
    1.28  
    1.29 -    MapExtender(const Graph& graph, const Value& value) 
    1.30 +    MapExtender(const Graph& graph, const Value& value)
    1.31        : Parent(graph, value) {}
    1.32  
    1.33      MapExtender& operator=(const MapExtender& cmap) {
    1.34 @@ -70,14 +70,14 @@
    1.35      MapExtender& operator=(const CMap& cmap) {
    1.36        Parent::operator=(cmap);
    1.37        return *this;
    1.38 -    } 
    1.39 +    }
    1.40  
    1.41      class MapIt : public Item {
    1.42      public:
    1.43 -      
    1.44 +
    1.45        typedef Item Parent;
    1.46        typedef typename Map::Value Value;
    1.47 -      
    1.48 +
    1.49        MapIt() {}
    1.50  
    1.51        MapIt(Invalid i) : Parent(i) { }
    1.52 @@ -86,29 +86,29 @@
    1.53          map.notifier()->first(*this);
    1.54        }
    1.55  
    1.56 -      MapIt(const Map& _map, const Item& item) 
    1.57 -	: Parent(item), map(_map) {}
    1.58 +      MapIt(const Map& _map, const Item& item)
    1.59 +        : Parent(item), map(_map) {}
    1.60  
    1.61 -      MapIt& operator++() { 
    1.62 -	map.notifier()->next(*this);
    1.63 -	return *this; 
    1.64 +      MapIt& operator++() {
    1.65 +        map.notifier()->next(*this);
    1.66 +        return *this;
    1.67        }
    1.68 -      
    1.69 +
    1.70        typename MapTraits<Map>::ConstReturnValue operator*() const {
    1.71 -	return map[*this];
    1.72 +        return map[*this];
    1.73        }
    1.74  
    1.75        typename MapTraits<Map>::ReturnValue operator*() {
    1.76 -	return map[*this];
    1.77 +        return map[*this];
    1.78        }
    1.79 -      
    1.80 +
    1.81        void set(const Value& value) {
    1.82 -	map.set(*this, value);
    1.83 +        map.set(*this, value);
    1.84        }
    1.85 -      
    1.86 +
    1.87      protected:
    1.88        Map& map;
    1.89 -      
    1.90 +
    1.91      };
    1.92  
    1.93      class ConstMapIt : public Item {
    1.94 @@ -117,7 +117,7 @@
    1.95        typedef Item Parent;
    1.96  
    1.97        typedef typename Map::Value Value;
    1.98 -      
    1.99 +
   1.100        ConstMapIt() {}
   1.101  
   1.102        ConstMapIt(Invalid i) : Parent(i) { }
   1.103 @@ -126,16 +126,16 @@
   1.104          map.notifier()->first(*this);
   1.105        }
   1.106  
   1.107 -      ConstMapIt(const Map& _map, const Item& item) 
   1.108 -	: Parent(item), map(_map) {}
   1.109 +      ConstMapIt(const Map& _map, const Item& item)
   1.110 +        : Parent(item), map(_map) {}
   1.111  
   1.112 -      ConstMapIt& operator++() { 
   1.113 -	map.notifier()->next(*this);
   1.114 -	return *this; 
   1.115 +      ConstMapIt& operator++() {
   1.116 +        map.notifier()->next(*this);
   1.117 +        return *this;
   1.118        }
   1.119  
   1.120        typename MapTraits<Map>::ConstReturnValue operator*() const {
   1.121 -	return map[*this];
   1.122 +        return map[*this];
   1.123        }
   1.124  
   1.125      protected:
   1.126 @@ -144,9 +144,9 @@
   1.127  
   1.128      class ItemIt : public Item {
   1.129      public:
   1.130 -      
   1.131 +
   1.132        typedef Item Parent;
   1.133 -      
   1.134 +
   1.135        ItemIt() {}
   1.136  
   1.137        ItemIt(Invalid i) : Parent(i) { }
   1.138 @@ -155,22 +155,22 @@
   1.139          map.notifier()->first(*this);
   1.140        }
   1.141  
   1.142 -      ItemIt(const Map& _map, const Item& item) 
   1.143 -	: Parent(item), map(_map) {}
   1.144 +      ItemIt(const Map& _map, const Item& item)
   1.145 +        : Parent(item), map(_map) {}
   1.146  
   1.147 -      ItemIt& operator++() { 
   1.148 -	map.notifier()->next(*this);
   1.149 -	return *this; 
   1.150 +      ItemIt& operator++() {
   1.151 +        map.notifier()->next(*this);
   1.152 +        return *this;
   1.153        }
   1.154  
   1.155      protected:
   1.156        const Map& map;
   1.157 -      
   1.158 +
   1.159      };
   1.160    };
   1.161  
   1.162    /// \ingroup graphbits
   1.163 -  /// 
   1.164 +  ///
   1.165    /// \brief Extender for maps which use a subset of the items.
   1.166    template <typename _Graph, typename _Map>
   1.167    class SubMapExtender : public _Map {
   1.168 @@ -194,10 +194,10 @@
   1.169  
   1.170    public:
   1.171  
   1.172 -    SubMapExtender(const Graph& _graph) 
   1.173 +    SubMapExtender(const Graph& _graph)
   1.174        : Parent(_graph), graph(_graph) {}
   1.175  
   1.176 -    SubMapExtender(const Graph& _graph, const Value& _value) 
   1.177 +    SubMapExtender(const Graph& _graph, const Value& _value)
   1.178        : Parent(_graph, _value), graph(_graph) {}
   1.179  
   1.180      SubMapExtender& operator=(const SubMapExtender& cmap) {
   1.181 @@ -212,14 +212,14 @@
   1.182          Parent::set(it, cmap[it]);
   1.183        }
   1.184        return *this;
   1.185 -    } 
   1.186 +    }
   1.187  
   1.188      class MapIt : public Item {
   1.189      public:
   1.190 -      
   1.191 +
   1.192        typedef Item Parent;
   1.193        typedef typename Map::Value Value;
   1.194 -      
   1.195 +
   1.196        MapIt() {}
   1.197  
   1.198        MapIt(Invalid i) : Parent(i) { }
   1.199 @@ -228,29 +228,29 @@
   1.200          map.graph.first(*this);
   1.201        }
   1.202  
   1.203 -      MapIt(const Map& _map, const Item& item) 
   1.204 -	: Parent(item), map(_map) {}
   1.205 +      MapIt(const Map& _map, const Item& item)
   1.206 +        : Parent(item), map(_map) {}
   1.207  
   1.208 -      MapIt& operator++() { 
   1.209 -	map.graph.next(*this);
   1.210 -	return *this; 
   1.211 +      MapIt& operator++() {
   1.212 +        map.graph.next(*this);
   1.213 +        return *this;
   1.214        }
   1.215 -      
   1.216 +
   1.217        typename MapTraits<Map>::ConstReturnValue operator*() const {
   1.218 -	return map[*this];
   1.219 +        return map[*this];
   1.220        }
   1.221  
   1.222        typename MapTraits<Map>::ReturnValue operator*() {
   1.223 -	return map[*this];
   1.224 +        return map[*this];
   1.225        }
   1.226 -      
   1.227 +
   1.228        void set(const Value& value) {
   1.229 -	map.set(*this, value);
   1.230 +        map.set(*this, value);
   1.231        }
   1.232 -      
   1.233 +
   1.234      protected:
   1.235        Map& map;
   1.236 -      
   1.237 +
   1.238      };
   1.239  
   1.240      class ConstMapIt : public Item {
   1.241 @@ -259,7 +259,7 @@
   1.242        typedef Item Parent;
   1.243  
   1.244        typedef typename Map::Value Value;
   1.245 -      
   1.246 +
   1.247        ConstMapIt() {}
   1.248  
   1.249        ConstMapIt(Invalid i) : Parent(i) { }
   1.250 @@ -268,16 +268,16 @@
   1.251          map.graph.first(*this);
   1.252        }
   1.253  
   1.254 -      ConstMapIt(const Map& _map, const Item& item) 
   1.255 -	: Parent(item), map(_map) {}
   1.256 +      ConstMapIt(const Map& _map, const Item& item)
   1.257 +        : Parent(item), map(_map) {}
   1.258  
   1.259 -      ConstMapIt& operator++() { 
   1.260 -	map.graph.next(*this);
   1.261 -	return *this; 
   1.262 +      ConstMapIt& operator++() {
   1.263 +        map.graph.next(*this);
   1.264 +        return *this;
   1.265        }
   1.266  
   1.267        typename MapTraits<Map>::ConstReturnValue operator*() const {
   1.268 -	return map[*this];
   1.269 +        return map[*this];
   1.270        }
   1.271  
   1.272      protected:
   1.273 @@ -286,9 +286,9 @@
   1.274  
   1.275      class ItemIt : public Item {
   1.276      public:
   1.277 -      
   1.278 +
   1.279        typedef Item Parent;
   1.280 -      
   1.281 +
   1.282        ItemIt() {}
   1.283  
   1.284        ItemIt(Invalid i) : Parent(i) { }
   1.285 @@ -297,23 +297,23 @@
   1.286          map.graph.first(*this);
   1.287        }
   1.288  
   1.289 -      ItemIt(const Map& _map, const Item& item) 
   1.290 -	: Parent(item), map(_map) {}
   1.291 +      ItemIt(const Map& _map, const Item& item)
   1.292 +        : Parent(item), map(_map) {}
   1.293  
   1.294 -      ItemIt& operator++() { 
   1.295 -	map.graph.next(*this);
   1.296 -	return *this; 
   1.297 +      ItemIt& operator++() {
   1.298 +        map.graph.next(*this);
   1.299 +        return *this;
   1.300        }
   1.301  
   1.302      protected:
   1.303        const Map& map;
   1.304 -      
   1.305 +
   1.306      };
   1.307 -    
   1.308 +
   1.309    private:
   1.310  
   1.311      const Graph& graph;
   1.312 -    
   1.313 +
   1.314    };
   1.315  
   1.316  }