gravatar
retvari@tmit.bme.hu
retvari@tmit.bme.hu
Fix PredMapPath::empty() (#366)
0 1 0
default
1 file changed with 1 insertions and 1 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -25,49 +25,49 @@
25 25
  class PredMapPath {
26 26
  public:
27 27
    typedef True RevPathTag;
28 28

	
29 29
    typedef _Digraph Digraph;
30 30
    typedef typename Digraph::Arc Arc;
31 31
    typedef _PredMap PredMap;
32 32

	
33 33
    PredMapPath(const Digraph& _digraph, const PredMap& _predMap,
34 34
                typename Digraph::Node _target)
35 35
      : digraph(_digraph), predMap(_predMap), target(_target) {}
36 36

	
37 37
    int length() const {
38 38
      int len = 0;
39 39
      typename Digraph::Node node = target;
40 40
      typename Digraph::Arc arc;
41 41
      while ((arc = predMap[node]) != INVALID) {
42 42
        node = digraph.source(arc);
43 43
        ++len;
44 44
      }
45 45
      return len;
46 46
    }
47 47

	
48 48
    bool empty() const {
49
      return predMap[target] != INVALID;
49
      return predMap[target] == INVALID;
50 50
    }
51 51

	
52 52
    class RevArcIt {
53 53
    public:
54 54
      RevArcIt() {}
55 55
      RevArcIt(Invalid) : path(0), current(INVALID) {}
56 56
      RevArcIt(const PredMapPath& _path)
57 57
        : path(&_path), current(_path.target) {
58 58
        if (path->predMap[current] == INVALID) current = INVALID;
59 59
      }
60 60

	
61 61
      operator const typename Digraph::Arc() const {
62 62
        return path->predMap[current];
63 63
      }
64 64

	
65 65
      RevArcIt& operator++() {
66 66
        current = path->digraph.source(path->predMap[current]);
67 67
        if (path->predMap[current] == INVALID) current = INVALID;
68 68
        return *this;
69 69
      }
70 70

	
71 71
      bool operator==(const RevArcIt& e) const {
72 72
        return current == e.current;
73 73
      }
0 comments (0 inline)