Rename convenience functions in subgraph adaptors (#67)
authorPeter Kovacs <kpeter@inf.elte.hu>
Fri, 09 Jan 2009 14:03:25 +0100
changeset 452aea2dc0518ce
parent 451 fbd6e04acf44
child 453 c246659c8b19
Rename convenience functions in subgraph adaptors (#67)

- Rename hide(), unHide() to disable(), enable().
- Add new set function status(Item, bool).
- Remove hidden() and add status() instead
(which returns the opposite value).
lemon/adaptors.h
     1.1 --- a/lemon/adaptors.h	Fri Jan 09 12:54:27 2009 +0100
     1.2 +++ b/lemon/adaptors.h	Fri Jan 09 14:03:25 2009 +0100
     1.3 @@ -474,14 +474,11 @@
     1.4          Parent::nextOut(i);
     1.5      }
     1.6  
     1.7 -    void hide(const Node& n) const { _node_filter->set(n, false); }
     1.8 -    void hide(const Arc& a) const { _arc_filter->set(a, false); }
     1.9 -
    1.10 -    void unHide(const Node& n) const { _node_filter->set(n, true); }
    1.11 -    void unHide(const Arc& a) const { _arc_filter->set(a, true); }
    1.12 -
    1.13 -    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
    1.14 -    bool hidden(const Arc& a) const { return !(*_arc_filter)[a]; }
    1.15 +    void status(const Node& n, bool v) const { _node_filter->set(n, v); }
    1.16 +    void status(const Arc& a, bool v) const { _arc_filter->set(a, v); }
    1.17 +
    1.18 +    bool status(const Node& n) const { return (*_node_filter)[n]; }
    1.19 +    bool status(const Arc& a) const { return (*_arc_filter)[a]; }
    1.20  
    1.21      typedef False NodeNumTag;
    1.22      typedef False ArcNumTag;
    1.23 @@ -617,14 +614,11 @@
    1.24        while (i!=INVALID && !(*_arc_filter)[i]) Parent::nextOut(i);
    1.25      }
    1.26  
    1.27 -    void hide(const Node& n) const { _node_filter->set(n, false); }
    1.28 -    void hide(const Arc& e) const { _arc_filter->set(e, false); }
    1.29 -
    1.30 -    void unHide(const Node& n) const { _node_filter->set(n, true); }
    1.31 -    void unHide(const Arc& e) const { _arc_filter->set(e, true); }
    1.32 -
    1.33 -    bool hidden(const Node& n) const { return !(*_node_filter)[n]; }
    1.34 -    bool hidden(const Arc& e) const { return !(*_arc_filter)[e]; }
    1.35 +    void status(const Node& n, bool v) const { _node_filter->set(n, v); }
    1.36 +    void status(const Arc& a, bool v) const { _arc_filter->set(a, v); }
    1.37 +
    1.38 +    bool status(const Node& n) const { return (*_node_filter)[n]; }
    1.39 +    bool status(const Arc& a) const { return (*_arc_filter)[a]; }
    1.40  
    1.41      typedef False NodeNumTag;
    1.42      typedef False ArcNumTag;
    1.43 @@ -774,45 +768,57 @@
    1.44        setArcFilterMap(arc_filter);
    1.45      }
    1.46  
    1.47 -    /// \brief Hides the given node
    1.48 +    /// \brief Sets the status of the given node
    1.49      ///
    1.50 -    /// This function hides the given node in the subdigraph,
    1.51 -    /// i.e. the iteration jumps over it.
    1.52 +    /// This function sets the status of the given node.
    1.53      /// It is done by simply setting the assigned value of \c n
    1.54 -    /// to be \c false in the node filter map.
    1.55 -    void hide(const Node& n) const { Parent::hide(n); }
    1.56 -
    1.57 -    /// \brief Hides the given arc
    1.58 +    /// to \c v in the node filter map.
    1.59 +    void status(const Node& n, bool v) const { Parent::status(n, v); }
    1.60 +
    1.61 +    /// \brief Sets the status of the given arc
    1.62      ///
    1.63 -    /// This function hides the given arc in the subdigraph,
    1.64 -    /// i.e. the iteration jumps over it.
    1.65 +    /// This function sets the status of the given arc.
    1.66      /// It is done by simply setting the assigned value of \c a
    1.67 -    /// to be \c false in the arc filter map.
    1.68 -    void hide(const Arc& a) const { Parent::hide(a); }
    1.69 -
    1.70 -    /// \brief Shows the given node
    1.71 +    /// to \c v in the arc filter map.
    1.72 +    void status(const Arc& a, bool v) const { Parent::status(a, v); }
    1.73 +
    1.74 +    /// \brief Returns the status of the given node
    1.75      ///
    1.76 -    /// This function shows the given node in the subdigraph.
    1.77 -    /// It is done by simply setting the assigned value of \c n
    1.78 -    /// to be \c true in the node filter map.
    1.79 -    void unHide(const Node& n) const { Parent::unHide(n); }
    1.80 -
    1.81 -    /// \brief Shows the given arc
    1.82 +    /// This function returns the status of the given node.
    1.83 +    /// It is \c true if the given node is enabled (i.e. not hidden).
    1.84 +    bool status(const Node& n) const { return Parent::status(n); }
    1.85 +
    1.86 +    /// \brief Returns the status of the given arc
    1.87      ///
    1.88 -    /// This function shows the given arc in the subdigraph.
    1.89 -    /// It is done by simply setting the assigned value of \c a
    1.90 -    /// to be \c true in the arc filter map.
    1.91 -    void unHide(const Arc& a) const { Parent::unHide(a); }
    1.92 -
    1.93 -    /// \brief Returns \c true if the given node is hidden.
    1.94 +    /// This function returns the status of the given arc.
    1.95 +    /// It is \c true if the given arc is enabled (i.e. not hidden).
    1.96 +    bool status(const Arc& a) const { return Parent::status(a); }
    1.97 +
    1.98 +    /// \brief Disables the given node
    1.99      ///
   1.100 -    /// This function returns \c true if the given node is hidden.
   1.101 -    bool hidden(const Node& n) const { return Parent::hidden(n); }
   1.102 -
   1.103 -    /// \brief Returns \c true if the given arc is hidden.
   1.104 +    /// This function disables the given node in the subdigraph,
   1.105 +    /// so the iteration jumps over it.
   1.106 +    /// It is the same as \ref status() "status(n, false)".
   1.107 +    void disable(const Node& n) const { Parent::status(n, false); }
   1.108 +
   1.109 +    /// \brief Disables the given arc
   1.110      ///
   1.111 -    /// This function returns \c true if the given arc is hidden.
   1.112 -    bool hidden(const Arc& a) const { return Parent::hidden(a); }
   1.113 +    /// This function disables the given arc in the subdigraph,
   1.114 +    /// so the iteration jumps over it.
   1.115 +    /// It is the same as \ref status() "status(a, false)".
   1.116 +    void disable(const Arc& a) const { Parent::status(a, false); }
   1.117 +
   1.118 +    /// \brief Enables the given node
   1.119 +    ///
   1.120 +    /// This function enables the given node in the subdigraph.
   1.121 +    /// It is the same as \ref status() "status(n, true)".
   1.122 +    void enable(const Node& n) const { Parent::status(n, true); }
   1.123 +
   1.124 +    /// \brief Enables the given arc
   1.125 +    ///
   1.126 +    /// This function enables the given arc in the subdigraph.
   1.127 +    /// It is the same as \ref status() "status(a, true)".
   1.128 +    void enable(const Arc& a) const { Parent::status(a, true); }
   1.129  
   1.130    };
   1.131  
   1.132 @@ -970,14 +976,11 @@
   1.133          Parent::nextInc(i, d);
   1.134      }
   1.135  
   1.136 -    void hide(const Node& n) const { _node_filter_map->set(n, false); }
   1.137 -    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
   1.138 -
   1.139 -    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
   1.140 -    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
   1.141 -
   1.142 -    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
   1.143 -    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
   1.144 +    void status(const Node& n, bool v) const { _node_filter_map->set(n, v); }
   1.145 +    void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); }
   1.146 +
   1.147 +    bool status(const Node& n) const { return (*_node_filter_map)[n]; }
   1.148 +    bool status(const Edge& e) const { return (*_edge_filter_map)[e]; }
   1.149  
   1.150      typedef False NodeNumTag;
   1.151      typedef False ArcNumTag;
   1.152 @@ -1172,14 +1175,11 @@
   1.153        while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d);
   1.154      }
   1.155  
   1.156 -    void hide(const Node& n) const { _node_filter_map->set(n, false); }
   1.157 -    void hide(const Edge& e) const { _edge_filter_map->set(e, false); }
   1.158 -
   1.159 -    void unHide(const Node& n) const { _node_filter_map->set(n, true); }
   1.160 -    void unHide(const Edge& e) const { _edge_filter_map->set(e, true); }
   1.161 -
   1.162 -    bool hidden(const Node& n) const { return !(*_node_filter_map)[n]; }
   1.163 -    bool hidden(const Edge& e) const { return !(*_edge_filter_map)[e]; }
   1.164 +    void status(const Node& n, bool v) const { _node_filter_map->set(n, v); }
   1.165 +    void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); }
   1.166 +
   1.167 +    bool status(const Node& n) const { return (*_node_filter_map)[n]; }
   1.168 +    bool status(const Edge& e) const { return (*_edge_filter_map)[e]; }
   1.169  
   1.170      typedef False NodeNumTag;
   1.171      typedef False ArcNumTag;
   1.172 @@ -1363,45 +1363,58 @@
   1.173        setEdgeFilterMap(edge_filter_map);
   1.174      }
   1.175  
   1.176 -    /// \brief Hides the given node
   1.177 +    /// \brief Sets the status of the given node
   1.178      ///
   1.179 -    /// This function hides the given node in the subgraph,
   1.180 -    /// i.e. the iteration jumps over it.
   1.181 +    /// This function sets the status of the given node.
   1.182      /// It is done by simply setting the assigned value of \c n
   1.183 -    /// to be \c false in the node filter map.
   1.184 -    void hide(const Node& n) const { Parent::hide(n); }
   1.185 -
   1.186 -    /// \brief Hides the given edge
   1.187 +    /// to \c v in the node filter map.
   1.188 +    void status(const Node& n, bool v) const { Parent::status(n, v); }
   1.189 +
   1.190 +    /// \brief Sets the status of the given edge
   1.191      ///
   1.192 -    /// This function hides the given edge in the subgraph,
   1.193 -    /// i.e. the iteration jumps over it.
   1.194 +    /// This function sets the status of the given edge.
   1.195      /// It is done by simply setting the assigned value of \c e
   1.196 -    /// to be \c false in the edge filter map.
   1.197 -    void hide(const Edge& e) const { Parent::hide(e); }
   1.198 -
   1.199 -    /// \brief Shows the given node
   1.200 +    /// to \c v in the edge filter map.
   1.201 +    void status(const Edge& e, bool v) const { Parent::status(e, v); }
   1.202 +
   1.203 +    /// \brief Returns the status of the given node
   1.204      ///
   1.205 -    /// This function shows the given node in the subgraph.
   1.206 -    /// It is done by simply setting the assigned value of \c n
   1.207 -    /// to be \c true in the node filter map.
   1.208 -    void unHide(const Node& n) const { Parent::unHide(n); }
   1.209 -
   1.210 -    /// \brief Shows the given edge
   1.211 +    /// This function returns the status of the given node.
   1.212 +    /// It is \c true if the given node is enabled (i.e. not hidden).
   1.213 +    bool status(const Node& n) const { return Parent::status(n); }
   1.214 +
   1.215 +    /// \brief Returns the status of the given edge
   1.216      ///
   1.217 -    /// This function shows the given edge in the subgraph.
   1.218 -    /// It is done by simply setting the assigned value of \c e
   1.219 -    /// to be \c true in the edge filter map.
   1.220 -    void unHide(const Edge& e) const { Parent::unHide(e); }
   1.221 -
   1.222 -    /// \brief Returns \c true if the given node is hidden.
   1.223 +    /// This function returns the status of the given edge.
   1.224 +    /// It is \c true if the given edge is enabled (i.e. not hidden).
   1.225 +    bool status(const Edge& e) const { return Parent::status(e); }
   1.226 +
   1.227 +    /// \brief Disables the given node
   1.228      ///
   1.229 -    /// This function returns \c true if the given node is hidden.
   1.230 -    bool hidden(const Node& n) const { return Parent::hidden(n); }
   1.231 -
   1.232 -    /// \brief Returns \c true if the given edge is hidden.
   1.233 +    /// This function disables the given node in the subdigraph,
   1.234 +    /// so the iteration jumps over it.
   1.235 +    /// It is the same as \ref status() "status(n, false)".
   1.236 +    void disable(const Node& n) const { Parent::status(n, false); }
   1.237 +
   1.238 +    /// \brief Disables the given edge
   1.239      ///
   1.240 -    /// This function returns \c true if the given edge is hidden.
   1.241 -    bool hidden(const Edge& e) const { return Parent::hidden(e); }
   1.242 +    /// This function disables the given edge in the subgraph,
   1.243 +    /// so the iteration jumps over it.
   1.244 +    /// It is the same as \ref status() "status(e, false)".
   1.245 +    void disable(const Edge& e) const { Parent::status(e, false); }
   1.246 +
   1.247 +    /// \brief Enables the given node
   1.248 +    ///
   1.249 +    /// This function enables the given node in the subdigraph.
   1.250 +    /// It is the same as \ref status() "status(n, true)".
   1.251 +    void enable(const Node& n) const { Parent::status(n, true); }
   1.252 +
   1.253 +    /// \brief Enables the given edge
   1.254 +    ///
   1.255 +    /// This function enables the given edge in the subgraph.
   1.256 +    /// It is the same as \ref status() "status(e, true)".
   1.257 +    void enable(const Edge& e) const { Parent::status(e, true); }
   1.258 +
   1.259    };
   1.260  
   1.261    /// \brief Returns a read-only SubGraph adaptor
   1.262 @@ -1519,25 +1532,31 @@
   1.263        Parent::setArcFilterMap(const_true_map);
   1.264      }
   1.265  
   1.266 -    /// \brief Hides the given node
   1.267 +    /// \brief Sets the status of the given node
   1.268      ///
   1.269 -    /// This function hides the given node in the subgraph,
   1.270 -    /// i.e. the iteration jumps over it.
   1.271 +    /// This function sets the status of the given node.
   1.272      /// It is done by simply setting the assigned value of \c n
   1.273 -    /// to be \c false in the node filter map.
   1.274 -    void hide(const Node& n) const { Parent::hide(n); }
   1.275 -
   1.276 -    /// \brief Shows the given node
   1.277 +    /// to \c v in the node filter map.
   1.278 +    void status(const Node& n, bool v) const { Parent::status(n, v); }
   1.279 +
   1.280 +    /// \brief Returns the status of the given node
   1.281      ///
   1.282 -    /// This function shows the given node in the subgraph.
   1.283 -    /// It is done by simply setting the assigned value of \c n
   1.284 -    /// to be \c true in the node filter map.
   1.285 -    void unHide(const Node& n) const { Parent::unHide(n); }
   1.286 -
   1.287 -    /// \brief Returns \c true if the given node is hidden.
   1.288 +    /// This function returns the status of the given node.
   1.289 +    /// It is \c true if the given node is enabled (i.e. not hidden).
   1.290 +    bool status(const Node& n) const { return Parent::status(n); }
   1.291 +
   1.292 +    /// \brief Disables the given node
   1.293      ///
   1.294 -    /// This function returns \c true if the given node is hidden.
   1.295 -    bool hidden(const Node& n) const { return Parent::hidden(n); }
   1.296 +    /// This function disables the given node, so the iteration
   1.297 +    /// jumps over it.
   1.298 +    /// It is the same as \ref status() "status(n, false)".
   1.299 +    void disable(const Node& n) const { Parent::status(n, false); }
   1.300 +
   1.301 +    /// \brief Enables the given node
   1.302 +    ///
   1.303 +    /// This function enables the given node.
   1.304 +    /// It is the same as \ref status() "status(n, true)".
   1.305 +    void enable(const Node& n) const { Parent::status(n, true); }
   1.306  
   1.307    };
   1.308  
   1.309 @@ -1569,9 +1588,10 @@
   1.310        Parent::setEdgeFilterMap(const_true_map);
   1.311      }
   1.312  
   1.313 -    void hide(const Node& n) const { Parent::hide(n); }
   1.314 -    void unHide(const Node& n) const { Parent::unHide(n); }
   1.315 -    bool hidden(const Node& n) const { return Parent::hidden(n); }
   1.316 +    void status(const Node& n, bool v) const { Parent::status(n, v); }
   1.317 +    bool status(const Node& n) const { return Parent::status(n); }
   1.318 +    void disable(const Node& n) const { Parent::status(n, false); }
   1.319 +    void enable(const Node& n) const { Parent::status(n, true); }
   1.320  
   1.321    };
   1.322  
   1.323 @@ -1656,25 +1676,31 @@
   1.324        Parent::setArcFilterMap(arc_filter);
   1.325      }
   1.326  
   1.327 -    /// \brief Hides the given arc
   1.328 +    /// \brief Sets the status of the given arc
   1.329      ///
   1.330 -    /// This function hides the given arc in the subdigraph,
   1.331 -    /// i.e. the iteration jumps over it.
   1.332 +    /// This function sets the status of the given arc.
   1.333      /// It is done by simply setting the assigned value of \c a
   1.334 -    /// to be \c false in the arc filter map.
   1.335 -    void hide(const Arc& a) const { Parent::hide(a); }
   1.336 -
   1.337 -    /// \brief Shows the given arc
   1.338 +    /// to \c v in the arc filter map.
   1.339 +    void status(const Arc& a, bool v) const { Parent::status(a, v); }
   1.340 +
   1.341 +    /// \brief Returns the status of the given arc
   1.342      ///
   1.343 -    /// This function shows the given arc in the subdigraph.
   1.344 -    /// It is done by simply setting the assigned value of \c a
   1.345 -    /// to be \c true in the arc filter map.
   1.346 -    void unHide(const Arc& a) const { Parent::unHide(a); }
   1.347 -
   1.348 -    /// \brief Returns \c true if the given arc is hidden.
   1.349 +    /// This function returns the status of the given arc.
   1.350 +    /// It is \c true if the given arc is enabled (i.e. not hidden).
   1.351 +    bool status(const Arc& a) const { return Parent::status(a); }
   1.352 +
   1.353 +    /// \brief Disables the given arc
   1.354      ///
   1.355 -    /// This function returns \c true if the given arc is hidden.
   1.356 -    bool hidden(const Arc& a) const { return Parent::hidden(a); }
   1.357 +    /// This function disables the given arc in the subdigraph,
   1.358 +    /// so the iteration jumps over it.
   1.359 +    /// It is the same as \ref status() "status(a, false)".
   1.360 +    void disable(const Arc& a) const { Parent::status(a, false); }
   1.361 +
   1.362 +    /// \brief Enables the given arc
   1.363 +    ///
   1.364 +    /// This function enables the given arc in the subdigraph.
   1.365 +    /// It is the same as \ref status() "status(a, true)".
   1.366 +    void enable(const Arc& a) const { Parent::status(a, true); }
   1.367  
   1.368    };
   1.369  
   1.370 @@ -1754,25 +1780,31 @@
   1.371        Parent::setEdgeFilterMap(edge_filter_map);
   1.372      }
   1.373  
   1.374 -    /// \brief Hides the given edge
   1.375 +    /// \brief Sets the status of the given edge
   1.376      ///
   1.377 -    /// This function hides the given edge in the subgraph,
   1.378 -    /// i.e. the iteration jumps over it.
   1.379 +    /// This function sets the status of the given edge.
   1.380      /// It is done by simply setting the assigned value of \c e
   1.381 -    /// to be \c false in the edge filter map.
   1.382 -    void hide(const Edge& e) const { Parent::hide(e); }
   1.383 -
   1.384 -    /// \brief Shows the given edge
   1.385 +    /// to \c v in the edge filter map.
   1.386 +    void status(const Edge& e, bool v) const { Parent::status(e, v); }
   1.387 +
   1.388 +    /// \brief Returns the status of the given edge
   1.389      ///
   1.390 -    /// This function shows the given edge in the subgraph.
   1.391 -    /// It is done by simply setting the assigned value of \c e
   1.392 -    /// to be \c true in the edge filter map.
   1.393 -    void unHide(const Edge& e) const { Parent::unHide(e); }
   1.394 -
   1.395 -    /// \brief Returns \c true if the given edge is hidden.
   1.396 +    /// This function returns the status of the given edge.
   1.397 +    /// It is \c true if the given edge is enabled (i.e. not hidden).
   1.398 +    bool status(const Edge& e) const { return Parent::status(e); }
   1.399 +
   1.400 +    /// \brief Disables the given edge
   1.401      ///
   1.402 -    /// This function returns \c true if the given edge is hidden.
   1.403 -    bool hidden(const Edge& e) const { return Parent::hidden(e); }
   1.404 +    /// This function disables the given edge in the subgraph,
   1.405 +    /// so the iteration jumps over it.
   1.406 +    /// It is the same as \ref status() "status(e, false)".
   1.407 +    void disable(const Edge& e) const { Parent::status(e, false); }
   1.408 +
   1.409 +    /// \brief Enables the given edge
   1.410 +    ///
   1.411 +    /// This function enables the given edge in the subgraph.
   1.412 +    /// It is the same as \ref status() "status(e, true)".
   1.413 +    void enable(const Edge& e) const { Parent::status(e, true); }
   1.414  
   1.415    };
   1.416  
   1.417 @@ -2767,9 +2799,9 @@
   1.418        }
   1.419      }
   1.420  
   1.421 -    /// \brief Augment on the given arc in the residual digraph.
   1.422 +    /// \brief Augments on the given arc in the residual digraph.
   1.423      ///
   1.424 -    /// Augment on the given arc in the residual digraph. It increases
   1.425 +    /// Augments on the given arc in the residual digraph. It increases
   1.426      /// or decreases the flow value on the original arc according to the
   1.427      /// direction of the residual arc.
   1.428      void augment(const Arc& a, const Value& v) const {