Changeset 2357:5365600a7a5c in lemon-0.x
- Timestamp:
- 02/11/07 17:34:51 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3160
- Location:
- lemon
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/path_dump.h
r2335 r2357 1 1 2 /* -*- C++ -*- 2 3 * … … 50 51 } 51 52 52 class Rev It {53 class RevEdgeIt { 53 54 public: 54 Rev It() {}55 Rev It(Invalid) : path(0), current(INVALID) {}56 Rev It(const PredMapPath& _path)55 RevEdgeIt() {} 56 RevEdgeIt(Invalid) : path(0), current(INVALID) {} 57 RevEdgeIt(const PredMapPath& _path) 57 58 : path(&_path), current(_path.target) {} 58 59 … … 61 62 } 62 63 63 Rev It& operator++() {64 RevEdgeIt& operator++() { 64 65 current = path->graph.source(path->predMap[current]); 65 66 if (path->predMap[current] == INVALID) current = INVALID; … … 67 68 } 68 69 69 bool operator==(const Rev It& e) const {70 bool operator==(const RevEdgeIt& e) const { 70 71 return current == e.current; 71 72 } 72 73 73 bool operator!=(const Rev It& e) const {74 bool operator!=(const RevEdgeIt& e) const { 74 75 return current != e.current; 75 76 } 76 77 77 bool operator<(const Rev It& e) const {78 bool operator<(const RevEdgeIt& e) const { 78 79 return current < e.current; 79 80 } … … 122 123 } 123 124 124 class Rev It {125 class RevEdgeIt { 125 126 public: 126 Rev It() {}127 Rev It(Invalid) : path(0), current(INVALID) {}128 Rev It(const PredMatrixMapPath& _path)127 RevEdgeIt() {} 128 RevEdgeIt(Invalid) : path(0), current(INVALID) {} 129 RevEdgeIt(const PredMatrixMapPath& _path) 129 130 : path(&_path), current(_path.target) {} 130 131 … … 133 134 } 134 135 135 Rev It& operator++() {136 RevEdgeIt& operator++() { 136 137 current = 137 138 path->graph.source(path->predMatrixMap(path->source, current)); … … 141 142 } 142 143 143 bool operator==(const Rev It& e) const {144 bool operator==(const RevEdgeIt& e) const { 144 145 return current == e.current; 145 146 } 146 147 147 bool operator!=(const Rev It& e) const {148 bool operator!=(const RevEdgeIt& e) const { 148 149 return current != e.current; 149 150 } 150 151 151 bool operator<(const Rev It& e) const {152 bool operator<(const RevEdgeIt& e) const { 152 153 return current < e.current; 153 154 } -
lemon/concepts/path.h
r2335 r2357 172 172 int e = p.empty(); 173 173 174 typename _Path::Rev It id, ii(INVALID), i(p);174 typename _Path::RevEdgeIt id, ii(INVALID), i(p); 175 175 176 176 ++i; … … 233 233 /// 234 234 /// If the RevPathTag is defined and true then reverse dumping 235 /// is provided in the path proxy. In this case instead of the236 /// EdgeIt the Rev It iterator should be implemented in the237 /// proxy.235 /// is provided in the path dumper. In this case instead of the 236 /// EdgeIt the RevEdgeIt iterator should be implemented in the 237 /// dumper. 238 238 typedef False RevPathTag; 239 239 … … 269 269 /// This class is used to iterate on the edges of the paths in 270 270 /// reverse direction. 271 class Rev It {271 class RevEdgeIt { 272 272 public: 273 273 /// Default constructor 274 Rev It() {}274 RevEdgeIt() {} 275 275 /// Invalid constructor 276 Rev It(Invalid) {}276 RevEdgeIt(Invalid) {} 277 277 /// Constructor for first edge 278 Rev It(const PathDumper &) {}278 RevEdgeIt(const PathDumper &) {} 279 279 280 280 /// Conversion to Edge … … 282 282 283 283 /// Next edge 284 Rev It& operator++() {return *this;}285 286 /// Comparison operator 287 bool operator==(const Rev It&) const {return true;}288 /// Comparison operator 289 bool operator!=(const Rev It&) const {return true;}284 RevEdgeIt& operator++() {return *this;} 285 286 /// Comparison operator 287 bool operator==(const RevEdgeIt&) const {return true;} 288 /// Comparison operator 289 bool operator!=(const RevEdgeIt&) const {return true;} 290 290 /// Comparison operator 291 bool operator<(const Rev It&) const {return false;}291 bool operator<(const RevEdgeIt&) const {return false;} 292 292 293 293 }; -
lemon/path.h
r2336 r2357 218 218 int len = path.length(); 219 219 head.reserve(len); 220 for (typename CPath::Rev It it(path); it != INVALID; ++it) {220 for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) { 221 221 head.push_back(it); 222 222 } … … 376 376 data.resize(len); 377 377 int index = len; 378 for (typename CPath::Rev It it(path); it != INVALID; ++it) {378 for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) { 379 379 --index; 380 380 data[index] = it;; … … 721 721 template <typename CPath> 722 722 void buildRev(const CPath& path) { 723 for (typename CPath::Rev It it(path); it != INVALID; ++it) {723 for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) { 724 724 addFront(it); 725 725 } … … 882 882 edges = new Edge[len]; 883 883 int index = len; 884 for (typename CPath::Rev It it(path); it != INVALID; ++it) {884 for (typename CPath::RevEdgeIt it(path); it != INVALID; ++it) { 885 885 --index; 886 886 edges[index] = it; -
lemon/path_utils.h
r2350 r2357 49 49 struct PathCopySelector { 50 50 static void copy(Target& target, const Source& source) { 51 source.clear();51 target.clear(); 52 52 for (typename Source::EdgeIt it(source); it != INVALID; ++it) { 53 53 target.addBack(it); … … 61 61 typename enable_if<typename Source::RevPathTag, void>::type> { 62 62 static void copy(Target& target, const Source& source) { 63 source.clear();64 for (typename Source::Rev It it(source); it != INVALID; ++it) {63 target.clear(); 64 for (typename Source::RevEdgeIt it(source); it != INVALID; ++it) { 65 65 target.addFront(it); 66 66 }
Note: See TracChangeset
for help on using the changeset viewer.