1.1 --- a/lemon/adaptors.h Fri May 08 16:21:06 2009 +0100
1.2 +++ b/lemon/adaptors.h Thu May 07 10:46:49 2009 +0200
1.3 @@ -1839,31 +1839,31 @@
1.4 typedef typename Digraph::Arc Edge;
1.5 typedef typename Digraph::Node Node;
1.6
1.7 - class Arc : public Edge {
1.8 + class Arc {
1.9 friend class UndirectorBase;
1.10 protected:
1.11 + Edge _edge;
1.12 bool _forward;
1.13
1.14 - Arc(const Edge& edge, bool forward) :
1.15 - Edge(edge), _forward(forward) {}
1.16 + Arc(const Edge& edge, bool forward)
1.17 + : _edge(edge), _forward(forward) {}
1.18
1.19 public:
1.20 Arc() {}
1.21
1.22 - Arc(Invalid) : Edge(INVALID), _forward(true) {}
1.23 + Arc(Invalid) : _edge(INVALID), _forward(true) {}
1.24 +
1.25 + operator const Edge&() const { return _edge; }
1.26
1.27 bool operator==(const Arc &other) const {
1.28 - return _forward == other._forward &&
1.29 - static_cast<const Edge&>(*this) == static_cast<const Edge&>(other);
1.30 + return _forward == other._forward && _edge == other._edge;
1.31 }
1.32 bool operator!=(const Arc &other) const {
1.33 - return _forward != other._forward ||
1.34 - static_cast<const Edge&>(*this) != static_cast<const Edge&>(other);
1.35 + return _forward != other._forward || _edge != other._edge;
1.36 }
1.37 bool operator<(const Arc &other) const {
1.38 return _forward < other._forward ||
1.39 - (_forward == other._forward &&
1.40 - static_cast<const Edge&>(*this) < static_cast<const Edge&>(other));
1.41 + (_forward == other._forward && _edge < other._edge);
1.42 }
1.43 };
1.44
1.45 @@ -1876,7 +1876,7 @@
1.46 }
1.47
1.48 void first(Arc& a) const {
1.49 - _digraph->first(a);
1.50 + _digraph->first(a._edge);
1.51 a._forward = true;
1.52 }
1.53
1.54 @@ -1884,7 +1884,7 @@
1.55 if (a._forward) {
1.56 a._forward = false;
1.57 } else {
1.58 - _digraph->next(a);
1.59 + _digraph->next(a._edge);
1.60 a._forward = true;
1.61 }
1.62 }
1.63 @@ -1898,48 +1898,48 @@
1.64 }
1.65
1.66 void firstOut(Arc& a, const Node& n) const {
1.67 - _digraph->firstIn(a, n);
1.68 - if( static_cast<const Edge&>(a) != INVALID ) {
1.69 + _digraph->firstIn(a._edge, n);
1.70 + if (a._edge != INVALID ) {
1.71 a._forward = false;
1.72 } else {
1.73 - _digraph->firstOut(a, n);
1.74 + _digraph->firstOut(a._edge, n);
1.75 a._forward = true;
1.76 }
1.77 }
1.78 void nextOut(Arc &a) const {
1.79 if (!a._forward) {
1.80 - Node n = _digraph->target(a);
1.81 - _digraph->nextIn(a);
1.82 - if (static_cast<const Edge&>(a) == INVALID ) {
1.83 - _digraph->firstOut(a, n);
1.84 + Node n = _digraph->target(a._edge);
1.85 + _digraph->nextIn(a._edge);
1.86 + if (a._edge == INVALID) {
1.87 + _digraph->firstOut(a._edge, n);
1.88 a._forward = true;
1.89 }
1.90 }
1.91 else {
1.92 - _digraph->nextOut(a);
1.93 + _digraph->nextOut(a._edge);
1.94 }
1.95 }
1.96
1.97 void firstIn(Arc &a, const Node &n) const {
1.98 - _digraph->firstOut(a, n);
1.99 - if (static_cast<const Edge&>(a) != INVALID ) {
1.100 + _digraph->firstOut(a._edge, n);
1.101 + if (a._edge != INVALID ) {
1.102 a._forward = false;
1.103 } else {
1.104 - _digraph->firstIn(a, n);
1.105 + _digraph->firstIn(a._edge, n);
1.106 a._forward = true;
1.107 }
1.108 }
1.109 void nextIn(Arc &a) const {
1.110 if (!a._forward) {
1.111 - Node n = _digraph->source(a);
1.112 - _digraph->nextOut(a);
1.113 - if( static_cast<const Edge&>(a) == INVALID ) {
1.114 - _digraph->firstIn(a, n);
1.115 + Node n = _digraph->source(a._edge);
1.116 + _digraph->nextOut(a._edge);
1.117 + if (a._edge == INVALID ) {
1.118 + _digraph->firstIn(a._edge, n);
1.119 a._forward = true;
1.120 }
1.121 }
1.122 else {
1.123 - _digraph->nextIn(a);
1.124 + _digraph->nextIn(a._edge);
1.125 }
1.126 }
1.127
1.128 @@ -1972,19 +1972,16 @@
1.129 }
1.130
1.131 Node source(const Arc &a) const {
1.132 - return a._forward ? _digraph->source(a) : _digraph->target(a);
1.133 + return a._forward ? _digraph->source(a._edge) : _digraph->target(a._edge);
1.134 }
1.135
1.136 Node target(const Arc &a) const {
1.137 - return a._forward ? _digraph->target(a) : _digraph->source(a);
1.138 + return a._forward ? _digraph->target(a._edge) : _digraph->source(a._edge);
1.139 }
1.140
1.141 static Arc direct(const Edge &e, bool d) {
1.142 return Arc(e, d);
1.143 }
1.144 - Arc direct(const Edge &e, const Node& n) const {
1.145 - return Arc(e, _digraph->source(e) == n);
1.146 - }
1.147
1.148 static bool direction(const Arc &a) { return a._forward; }
1.149