1.1 --- a/lemon/bits/path_dump.h Wed Feb 07 18:07:10 2007 +0000
1.2 +++ b/lemon/bits/path_dump.h Sun Feb 11 16:34:51 2007 +0000
1.3 @@ -1,3 +1,4 @@
1.4 +
1.5 /* -*- C++ -*-
1.6 *
1.7 * This file is a part of LEMON, a generic C++ optimization library
1.8 @@ -49,32 +50,32 @@
1.9 return predMap[target] != INVALID;
1.10 }
1.11
1.12 - class RevIt {
1.13 + class RevEdgeIt {
1.14 public:
1.15 - RevIt() {}
1.16 - RevIt(Invalid) : path(0), current(INVALID) {}
1.17 - RevIt(const PredMapPath& _path)
1.18 + RevEdgeIt() {}
1.19 + RevEdgeIt(Invalid) : path(0), current(INVALID) {}
1.20 + RevEdgeIt(const PredMapPath& _path)
1.21 : path(&_path), current(_path.target) {}
1.22
1.23 operator const typename Graph::Edge() const {
1.24 return path->predMap[current];
1.25 }
1.26
1.27 - RevIt& operator++() {
1.28 + RevEdgeIt& operator++() {
1.29 current = path->graph.source(path->predMap[current]);
1.30 if (path->predMap[current] == INVALID) current = INVALID;
1.31 return *this;
1.32 }
1.33
1.34 - bool operator==(const RevIt& e) const {
1.35 + bool operator==(const RevEdgeIt& e) const {
1.36 return current == e.current;
1.37 }
1.38
1.39 - bool operator!=(const RevIt& e) const {
1.40 + bool operator!=(const RevEdgeIt& e) const {
1.41 return current != e.current;
1.42 }
1.43
1.44 - bool operator<(const RevIt& e) const {
1.45 + bool operator<(const RevEdgeIt& e) const {
1.46 return current < e.current;
1.47 }
1.48
1.49 @@ -121,18 +122,18 @@
1.50 return source != target;
1.51 }
1.52
1.53 - class RevIt {
1.54 + class RevEdgeIt {
1.55 public:
1.56 - RevIt() {}
1.57 - RevIt(Invalid) : path(0), current(INVALID) {}
1.58 - RevIt(const PredMatrixMapPath& _path)
1.59 + RevEdgeIt() {}
1.60 + RevEdgeIt(Invalid) : path(0), current(INVALID) {}
1.61 + RevEdgeIt(const PredMatrixMapPath& _path)
1.62 : path(&_path), current(_path.target) {}
1.63
1.64 operator const typename Graph::Edge() const {
1.65 return path->predMatrixMap(path->source, current);
1.66 }
1.67
1.68 - RevIt& operator++() {
1.69 + RevEdgeIt& operator++() {
1.70 current =
1.71 path->graph.source(path->predMatrixMap(path->source, current));
1.72 if (path->predMatrixMap(path->source, current) == INVALID)
1.73 @@ -140,15 +141,15 @@
1.74 return *this;
1.75 }
1.76
1.77 - bool operator==(const RevIt& e) const {
1.78 + bool operator==(const RevEdgeIt& e) const {
1.79 return current == e.current;
1.80 }
1.81
1.82 - bool operator!=(const RevIt& e) const {
1.83 + bool operator!=(const RevEdgeIt& e) const {
1.84 return current != e.current;
1.85 }
1.86
1.87 - bool operator<(const RevIt& e) const {
1.88 + bool operator<(const RevEdgeIt& e) const {
1.89 return current < e.current;
1.90 }
1.91
2.1 --- a/lemon/concepts/path.h Wed Feb 07 18:07:10 2007 +0000
2.2 +++ b/lemon/concepts/path.h Sun Feb 11 16:34:51 2007 +0000
2.3 @@ -171,7 +171,7 @@
2.4 int l = p.length();
2.5 int e = p.empty();
2.6
2.7 - typename _Path::RevIt id, ii(INVALID), i(p);
2.8 + typename _Path::RevEdgeIt id, ii(INVALID), i(p);
2.9
2.10 ++i;
2.11 typename _Graph::Edge ed = i;
2.12 @@ -232,9 +232,9 @@
2.13 /// \brief Forward or reverse dumping
2.14 ///
2.15 /// If the RevPathTag is defined and true then reverse dumping
2.16 - /// is provided in the path proxy. In this case instead of the
2.17 - /// EdgeIt the RevIt iterator should be implemented in the
2.18 - /// proxy.
2.19 + /// is provided in the path dumper. In this case instead of the
2.20 + /// EdgeIt the RevEdgeIt iterator should be implemented in the
2.21 + /// dumper.
2.22 typedef False RevPathTag;
2.23
2.24 /// \brief Lemon style iterator for path edges
2.25 @@ -268,27 +268,27 @@
2.26 ///
2.27 /// This class is used to iterate on the edges of the paths in
2.28 /// reverse direction.
2.29 - class RevIt {
2.30 + class RevEdgeIt {
2.31 public:
2.32 /// Default constructor
2.33 - RevIt() {}
2.34 + RevEdgeIt() {}
2.35 /// Invalid constructor
2.36 - RevIt(Invalid) {}
2.37 + RevEdgeIt(Invalid) {}
2.38 /// Constructor for first edge
2.39 - RevIt(const PathDumper &) {}
2.40 + RevEdgeIt(const PathDumper &) {}
2.41
2.42 /// Conversion to Edge
2.43 operator Edge() const { return INVALID; }
2.44
2.45 /// Next edge
2.46 - RevIt& operator++() {return *this;}
2.47 + RevEdgeIt& operator++() {return *this;}
2.48
2.49 /// Comparison operator
2.50 - bool operator==(const RevIt&) const {return true;}
2.51 + bool operator==(const RevEdgeIt&) const {return true;}
2.52 /// Comparison operator
2.53 - bool operator!=(const RevIt&) const {return true;}
2.54 + bool operator!=(const RevEdgeIt&) const {return true;}
2.55 /// Comparison operator
2.56 - bool operator<(const RevIt&) const {return false;}
2.57 + bool operator<(const RevEdgeIt&) const {return false;}
2.58
2.59 };
2.60
3.1 --- a/lemon/path.h Wed Feb 07 18:07:10 2007 +0000
3.2 +++ b/lemon/path.h Sun Feb 11 16:34:51 2007 +0000
3.3 @@ -217,7 +217,7 @@
3.4 void buildRev(const CPath& path) {
3.5 int len = path.length();
3.6 head.reserve(len);
3.7 - for (typename CPath::RevIt it(path); it != INVALID; ++it) {
3.8 + for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) {
3.9 head.push_back(it);
3.10 }
3.11 }
3.12 @@ -375,7 +375,7 @@
3.13 int len = path.length();
3.14 data.resize(len);
3.15 int index = len;
3.16 - for (typename CPath::RevIt it(path); it != INVALID; ++it) {
3.17 + for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) {
3.18 --index;
3.19 data[index] = it;;
3.20 }
3.21 @@ -720,7 +720,7 @@
3.22
3.23 template <typename CPath>
3.24 void buildRev(const CPath& path) {
3.25 - for (typename CPath::RevIt it(path); it != INVALID; ++it) {
3.26 + for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) {
3.27 addFront(it);
3.28 }
3.29 }
3.30 @@ -881,7 +881,7 @@
3.31 len = path.length();
3.32 edges = new Edge[len];
3.33 int index = len;
3.34 - for (typename CPath::RevIt it(path); it != INVALID; ++it) {
3.35 + for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) {
3.36 --index;
3.37 edges[index] = it;
3.38 }
4.1 --- a/lemon/path_utils.h Wed Feb 07 18:07:10 2007 +0000
4.2 +++ b/lemon/path_utils.h Sun Feb 11 16:34:51 2007 +0000
4.3 @@ -48,7 +48,7 @@
4.4 typename BuildEnable = void, typename RevEnable = void>
4.5 struct PathCopySelector {
4.6 static void copy(Target& target, const Source& source) {
4.7 - source.clear();
4.8 + target.clear();
4.9 for (typename Source::EdgeIt it(source); it != INVALID; ++it) {
4.10 target.addBack(it);
4.11 }
4.12 @@ -60,8 +60,8 @@
4.13 Target, Source, BuildEnable,
4.14 typename enable_if<typename Source::RevPathTag, void>::type> {
4.15 static void copy(Target& target, const Source& source) {
4.16 - source.clear();
4.17 - for (typename Source::RevIt it(source); it != INVALID; ++it) {
4.18 + target.clear();
4.19 + for (typename Source::RevEdgeIt it(source); it != INVALID; ++it) {
4.20 target.addFront(it);
4.21 }
4.22 }