lemon/bits/base_extender.h
changeset 2386 81b47fc5c444
parent 2260 4274224f8a7d
child 2391 14a343be7a5a
     1.1 --- a/lemon/bits/base_extender.h	Fri Mar 02 17:56:22 2007 +0000
     1.2 +++ b/lemon/bits/base_extender.h	Fri Mar 02 18:04:28 2007 +0000
     1.3 @@ -193,16 +193,16 @@
     1.4        }
     1.5      }
     1.6  
     1.7 -    Node nodeFromId(int id) const {
     1.8 -      return Parent::nodeFromId(id);
     1.9 +    Node nodeFromId(int ix) const {
    1.10 +      return Parent::nodeFromId(ix);
    1.11      }
    1.12  
    1.13 -    Edge edgeFromId(int id) const {
    1.14 -      return direct(Parent::edgeFromId(id >> 1), bool(id & 1));
    1.15 +    Edge edgeFromId(int ix) const {
    1.16 +      return direct(Parent::edgeFromId(ix >> 1), bool(ix & 1));
    1.17      }
    1.18  
    1.19 -    UEdge uEdgeFromId(int id) const {
    1.20 -      return Parent::edgeFromId(id);
    1.21 +    UEdge uEdgeFromId(int ix) const {
    1.22 +      return Parent::edgeFromId(ix);
    1.23      }
    1.24  
    1.25      int id(const Node &n) const {
    1.26 @@ -238,42 +238,42 @@
    1.27        return Parent::edgeNum();
    1.28      }
    1.29  
    1.30 -    Edge findEdge(Node source, Node target, Edge prev = INVALID) const {
    1.31 -      if (prev == INVALID) {
    1.32 -	UEdge edge = Parent::findEdge(source, target);
    1.33 +    Edge findEdge(Node s, Node t, Edge p = INVALID) const {
    1.34 +      if (p == INVALID) {
    1.35 +	UEdge edge = Parent::findEdge(s, t);
    1.36  	if (edge != INVALID) return direct(edge, true);
    1.37 -	edge = Parent::findEdge(target, source);
    1.38 +	edge = Parent::findEdge(t, s);
    1.39  	if (edge != INVALID) return direct(edge, false);
    1.40 -      } else if (direction(prev)) {
    1.41 -	UEdge edge = Parent::findEdge(source, target, prev);
    1.42 +      } else if (direction(p)) {
    1.43 +	UEdge edge = Parent::findEdge(s, t, p);
    1.44  	if (edge != INVALID) return direct(edge, true);
    1.45 -	edge = Parent::findEdge(target, source);
    1.46 +	edge = Parent::findEdge(t, s);
    1.47  	if (edge != INVALID) return direct(edge, false);	
    1.48        } else {
    1.49 -	UEdge edge = Parent::findEdge(target, source, prev);
    1.50 +	UEdge edge = Parent::findEdge(t, s, p);
    1.51  	if (edge != INVALID) return direct(edge, false);	      
    1.52        }
    1.53        return INVALID;
    1.54      }
    1.55  
    1.56 -    UEdge findUEdge(Node source, Node target, UEdge prev = INVALID) const {
    1.57 -      if (source != target) {
    1.58 -        if (prev == INVALID) {
    1.59 -          UEdge edge = Parent::findEdge(source, target);
    1.60 +    UEdge findUEdge(Node s, Node t, UEdge p = INVALID) const {
    1.61 +      if (s != t) {
    1.62 +        if (p == INVALID) {
    1.63 +          UEdge edge = Parent::findEdge(s, t);
    1.64            if (edge != INVALID) return edge;
    1.65 -          edge = Parent::findEdge(target, source);
    1.66 +          edge = Parent::findEdge(t, s);
    1.67            if (edge != INVALID) return edge;
    1.68 -        } else if (Parent::source(prev) == source) {
    1.69 -          UEdge edge = Parent::findEdge(source, target, prev);
    1.70 +        } else if (Parent::s(p) == s) {
    1.71 +          UEdge edge = Parent::findEdge(s, t, p);
    1.72            if (edge != INVALID) return edge;
    1.73 -          edge = Parent::findEdge(target, source);
    1.74 +          edge = Parent::findEdge(t, s);
    1.75            if (edge != INVALID) return edge;	
    1.76          } else {
    1.77 -          UEdge edge = Parent::findEdge(target, source, prev);
    1.78 +          UEdge edge = Parent::findEdge(t, s, p);
    1.79            if (edge != INVALID) return edge;	      
    1.80          }
    1.81        } else {
    1.82 -        return Parent::findEdge(source, target, prev);
    1.83 +        return Parent::findEdge(s, t, p);
    1.84        }
    1.85        return INVALID;
    1.86      }
    1.87 @@ -357,21 +357,21 @@
    1.88        return bNode(edge);
    1.89      }
    1.90  
    1.91 -    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
    1.92 +    void firstInc(UEdge& edge, bool& dir, const Node& node) const {
    1.93        if (Parent::aNode(node)) {
    1.94  	Parent::firstFromANode(edge, node);
    1.95 -	direction = true;
    1.96 +	dir = true;
    1.97        } else {
    1.98  	Parent::firstFromBNode(edge, node);
    1.99 -	direction = static_cast<UEdge&>(edge) == INVALID;
   1.100 +	dir = static_cast<UEdge&>(edge) == INVALID;
   1.101        }
   1.102      }
   1.103 -    void nextInc(UEdge& edge, bool& direction) const {
   1.104 -      if (direction) {
   1.105 +    void nextInc(UEdge& edge, bool& dir) const {
   1.106 +      if (dir) {
   1.107  	Parent::nextFromANode(edge);
   1.108        } else {
   1.109  	Parent::nextFromBNode(edge);
   1.110 -	if (edge == INVALID) direction = true;
   1.111 +	if (edge == INVALID) dir = true;
   1.112        }
   1.113      }
   1.114  
   1.115 @@ -457,8 +457,8 @@
   1.116        return (Parent::id(static_cast<const UEdge&>(edge)) << 1) + 
   1.117          (edge.forward ? 0 : 1);
   1.118      }
   1.119 -    Edge edgeFromId(int id) const {
   1.120 -      return Edge(Parent::fromUEdgeId(id >> 1), (id & 1) == 0);
   1.121 +    Edge edgeFromId(int ix) const {
   1.122 +      return Edge(Parent::fromUEdgeId(ix >> 1), (ix & 1) == 0);
   1.123      }
   1.124      int maxEdgeId() const {
   1.125        return (Parent::maxUEdgeId() << 1) + 1;
   1.126 @@ -468,8 +468,8 @@
   1.127        return edge.forward;
   1.128      }
   1.129  
   1.130 -    Edge direct(const UEdge& edge, bool direction) const {
   1.131 -      return Edge(edge, direction);
   1.132 +    Edge direct(const UEdge& edge, bool dir) const {
   1.133 +      return Edge(edge, dir);
   1.134      }
   1.135  
   1.136      int edgeNum() const {