diff -r 70b199792735 -r ad40f7d32846 lemon/bits/edge_set_extender.h --- a/lemon/bits/edge_set_extender.h Fri Aug 09 11:07:27 2013 +0200 +++ b/lemon/bits/edge_set_extender.h Sun Aug 11 15:28:12 2013 +0200 @@ -1,8 +1,8 @@ -/* -*- C++ -*- +/* -*- mode: C++; indent-tabs-mode: nil; -*- * - * This file is a part of LEMON, a generic C++ optimization library + * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2008 + * Copyright (C) 2003-2010 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -63,11 +63,11 @@ Node oppositeNode(const Node &n, const Arc &e) const { if (n == Parent::source(e)) - return Parent::target(e); + return Parent::target(e); else if(n==Parent::target(e)) - return Parent::source(e); + return Parent::source(e); else - return INVALID; + return INVALID; } @@ -91,7 +91,7 @@ // Iterable extensions - class NodeIt : public Node { + class NodeIt : public Node { const Digraph* digraph; public: @@ -100,21 +100,21 @@ NodeIt(Invalid i) : Node(i) { } explicit NodeIt(const Digraph& _graph) : digraph(&_graph) { - _graph.first(static_cast(*this)); + _graph.first(static_cast(*this)); } - NodeIt(const Digraph& _graph, const Node& node) - : Node(node), digraph(&_graph) {} + NodeIt(const Digraph& _graph, const Node& node) + : Node(node), digraph(&_graph) {} - NodeIt& operator++() { - digraph->next(*this); - return *this; + NodeIt& operator++() { + digraph->next(*this); + return *this; } }; - class ArcIt : public Arc { + class ArcIt : public Arc { const Digraph* digraph; public: @@ -123,21 +123,21 @@ ArcIt(Invalid i) : Arc(i) { } explicit ArcIt(const Digraph& _graph) : digraph(&_graph) { - _graph.first(static_cast(*this)); + _graph.first(static_cast(*this)); } - ArcIt(const Digraph& _graph, const Arc& e) : - Arc(e), digraph(&_graph) { } + ArcIt(const Digraph& _graph, const Arc& e) : + Arc(e), digraph(&_graph) { } - ArcIt& operator++() { - digraph->next(*this); - return *this; + ArcIt& operator++() { + digraph->next(*this); + return *this; } }; - class OutArcIt : public Arc { + class OutArcIt : public Arc { const Digraph* digraph; public: @@ -145,23 +145,23 @@ OutArcIt(Invalid i) : Arc(i) { } - OutArcIt(const Digraph& _graph, const Node& node) - : digraph(&_graph) { - _graph.firstOut(*this, node); + OutArcIt(const Digraph& _graph, const Node& node) + : digraph(&_graph) { + _graph.firstOut(*this, node); } - OutArcIt(const Digraph& _graph, const Arc& arc) - : Arc(arc), digraph(&_graph) {} + OutArcIt(const Digraph& _graph, const Arc& arc) + : Arc(arc), digraph(&_graph) {} - OutArcIt& operator++() { - digraph->nextOut(*this); - return *this; + OutArcIt& operator++() { + digraph->nextOut(*this); + return *this; } }; - class InArcIt : public Arc { + class InArcIt : public Arc { const Digraph* digraph; public: @@ -169,17 +169,17 @@ InArcIt(Invalid i) : Arc(i) { } - InArcIt(const Digraph& _graph, const Node& node) - : digraph(&_graph) { - _graph.firstIn(*this, node); + InArcIt(const Digraph& _graph, const Node& node) + : digraph(&_graph) { + _graph.firstIn(*this, node); } - InArcIt(const Digraph& _graph, const Arc& arc) : - Arc(arc), digraph(&_graph) {} + InArcIt(const Digraph& _graph, const Arc& arc) : + Arc(arc), digraph(&_graph) {} - InArcIt& operator++() { - digraph->nextIn(*this); - return *this; + InArcIt& operator++() { + digraph->nextIn(*this); + return *this; } }; @@ -215,26 +215,26 @@ using Parent::first; // Mappable extension - + template - class ArcMap + class ArcMap : public MapExtender > { typedef MapExtender > Parent; public: - explicit ArcMap(const Digraph& _g) - : Parent(_g) {} - ArcMap(const Digraph& _g, const _Value& _v) - : Parent(_g, _v) {} + explicit ArcMap(const Digraph& _g) + : Parent(_g) {} + ArcMap(const Digraph& _g, const _Value& _v) + : Parent(_g, _v) {} ArcMap& operator=(const ArcMap& cmap) { - return operator=(cmap); + return operator=(cmap); } template ArcMap& operator=(const CMap& cmap) { Parent::operator=(cmap); - return *this; + return *this; } }; @@ -247,7 +247,7 @@ notifier(Arc()).add(arc); return arc; } - + void clear() { notifier(Arc()).clear(); Parent::clear(); @@ -312,11 +312,11 @@ Node oppositeNode(const Node &n, const Edge &e) const { if( n == Parent::u(e)) - return Parent::v(e); + return Parent::v(e); else if( n == Parent::v(e)) - return Parent::u(e); + return Parent::u(e); else - return INVALID; + return INVALID; } Arc oppositeArc(const Arc &e) const { @@ -340,7 +340,7 @@ public: using Parent::notifier; - + ArcNotifier& notifier(Arc) const { return arc_notifier; } @@ -350,7 +350,7 @@ } - class NodeIt : public Node { + class NodeIt : public Node { const Graph* graph; public: @@ -359,21 +359,21 @@ NodeIt(Invalid i) : Node(i) { } explicit NodeIt(const Graph& _graph) : graph(&_graph) { - _graph.first(static_cast(*this)); + _graph.first(static_cast(*this)); } - NodeIt(const Graph& _graph, const Node& node) - : Node(node), graph(&_graph) {} + NodeIt(const Graph& _graph, const Node& node) + : Node(node), graph(&_graph) {} - NodeIt& operator++() { - graph->next(*this); - return *this; + NodeIt& operator++() { + graph->next(*this); + return *this; } }; - class ArcIt : public Arc { + class ArcIt : public Arc { const Graph* graph; public: @@ -382,21 +382,21 @@ ArcIt(Invalid i) : Arc(i) { } explicit ArcIt(const Graph& _graph) : graph(&_graph) { - _graph.first(static_cast(*this)); + _graph.first(static_cast(*this)); } - ArcIt(const Graph& _graph, const Arc& e) : - Arc(e), graph(&_graph) { } + ArcIt(const Graph& _graph, const Arc& e) : + Arc(e), graph(&_graph) { } - ArcIt& operator++() { - graph->next(*this); - return *this; + ArcIt& operator++() { + graph->next(*this); + return *this; } }; - class OutArcIt : public Arc { + class OutArcIt : public Arc { const Graph* graph; public: @@ -404,23 +404,23 @@ OutArcIt(Invalid i) : Arc(i) { } - OutArcIt(const Graph& _graph, const Node& node) - : graph(&_graph) { - _graph.firstOut(*this, node); + OutArcIt(const Graph& _graph, const Node& node) + : graph(&_graph) { + _graph.firstOut(*this, node); } - OutArcIt(const Graph& _graph, const Arc& arc) - : Arc(arc), graph(&_graph) {} + OutArcIt(const Graph& _graph, const Arc& arc) + : Arc(arc), graph(&_graph) {} - OutArcIt& operator++() { - graph->nextOut(*this); - return *this; + OutArcIt& operator++() { + graph->nextOut(*this); + return *this; } }; - class InArcIt : public Arc { + class InArcIt : public Arc { const Graph* graph; public: @@ -428,23 +428,23 @@ InArcIt(Invalid i) : Arc(i) { } - InArcIt(const Graph& _graph, const Node& node) - : graph(&_graph) { - _graph.firstIn(*this, node); + InArcIt(const Graph& _graph, const Node& node) + : graph(&_graph) { + _graph.firstIn(*this, node); } - InArcIt(const Graph& _graph, const Arc& arc) : - Arc(arc), graph(&_graph) {} + InArcIt(const Graph& _graph, const Arc& arc) : + Arc(arc), graph(&_graph) {} - InArcIt& operator++() { - graph->nextIn(*this); - return *this; + InArcIt& operator++() { + graph->nextIn(*this); + return *this; } }; - class EdgeIt : public Parent::Edge { + class EdgeIt : public Parent::Edge { const Graph* graph; public: @@ -453,15 +453,15 @@ EdgeIt(Invalid i) : Edge(i) { } explicit EdgeIt(const Graph& _graph) : graph(&_graph) { - _graph.first(static_cast(*this)); + _graph.first(static_cast(*this)); } - EdgeIt(const Graph& _graph, const Edge& e) : - Edge(e), graph(&_graph) { } + EdgeIt(const Graph& _graph, const Edge& e) : + Edge(e), graph(&_graph) { } - EdgeIt& operator++() { - graph->next(*this); - return *this; + EdgeIt& operator++() { + graph->next(*this); + return *this; } }; @@ -477,17 +477,17 @@ IncEdgeIt(Invalid i) : Edge(i), direction(false) { } IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { - _graph.firstInc(*this, direction, n); + _graph.firstInc(*this, direction, n); } IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) - : graph(&_graph), Edge(ue) { - direction = (_graph.source(ue) == n); + : graph(&_graph), Edge(ue) { + direction = (_graph.source(ue) == n); } IncEdgeIt& operator++() { - graph->nextInc(*this, direction); - return *this; + graph->nextInc(*this, direction); + return *this; } }; @@ -534,49 +534,49 @@ template - class ArcMap + class ArcMap : public MapExtender > { typedef MapExtender > Parent; public: - explicit ArcMap(const Graph& _g) - : Parent(_g) {} - ArcMap(const Graph& _g, const _Value& _v) - : Parent(_g, _v) {} + explicit ArcMap(const Graph& _g) + : Parent(_g) {} + ArcMap(const Graph& _g, const _Value& _v) + : Parent(_g, _v) {} ArcMap& operator=(const ArcMap& cmap) { - return operator=(cmap); + return operator=(cmap); } template ArcMap& operator=(const CMap& cmap) { Parent::operator=(cmap); - return *this; + return *this; } }; template - class EdgeMap + class EdgeMap : public MapExtender > { typedef MapExtender > Parent; public: - explicit EdgeMap(const Graph& _g) - : Parent(_g) {} + explicit EdgeMap(const Graph& _g) + : Parent(_g) {} - EdgeMap(const Graph& _g, const _Value& _v) - : Parent(_g, _v) {} + EdgeMap(const Graph& _g, const _Value& _v) + : Parent(_g, _v) {} EdgeMap& operator=(const EdgeMap& cmap) { - return operator=(cmap); + return operator=(cmap); } template EdgeMap& operator=(const CMap& cmap) { Parent::operator=(cmap); - return *this; + return *this; } }; @@ -593,7 +593,7 @@ notifier(Arc()).add(arcs); return edge; } - + void clear() { notifier(Arc()).clear(); notifier(Edge()).clear(); @@ -619,7 +619,7 @@ edge_notifier.clear(); arc_notifier.clear(); } - + }; }