Changeset 2386:81b47fc5c444 in lemon0.x for lemon/bits/base_extender.h
 Timestamp:
 03/02/07 19:04:28 (13 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@3217
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/bits/base_extender.h
r2260 r2386 194 194 } 195 195 196 Node nodeFromId(int i d) const {197 return Parent::nodeFromId(i d);198 } 199 200 Edge edgeFromId(int i d) const {201 return direct(Parent::edgeFromId(i d >> 1), bool(id& 1));202 } 203 204 UEdge uEdgeFromId(int i d) const {205 return Parent::edgeFromId(i d);196 Node nodeFromId(int ix) const { 197 return Parent::nodeFromId(ix); 198 } 199 200 Edge edgeFromId(int ix) const { 201 return direct(Parent::edgeFromId(ix >> 1), bool(ix & 1)); 202 } 203 204 UEdge uEdgeFromId(int ix) const { 205 return Parent::edgeFromId(ix); 206 206 } 207 207 … … 239 239 } 240 240 241 Edge findEdge(Node s ource, Node target, Edge prev= INVALID) const {242 if (p rev== INVALID) {243 UEdge edge = Parent::findEdge(s ource, target);241 Edge findEdge(Node s, Node t, Edge p = INVALID) const { 242 if (p == INVALID) { 243 UEdge edge = Parent::findEdge(s, t); 244 244 if (edge != INVALID) return direct(edge, true); 245 edge = Parent::findEdge(t arget, source);245 edge = Parent::findEdge(t, s); 246 246 if (edge != INVALID) return direct(edge, false); 247 } else if (direction(p rev)) {248 UEdge edge = Parent::findEdge(s ource, target, prev);247 } else if (direction(p)) { 248 UEdge edge = Parent::findEdge(s, t, p); 249 249 if (edge != INVALID) return direct(edge, true); 250 edge = Parent::findEdge(t arget, source);250 edge = Parent::findEdge(t, s); 251 251 if (edge != INVALID) return direct(edge, false); 252 252 } else { 253 UEdge edge = Parent::findEdge(t arget, source, prev);253 UEdge edge = Parent::findEdge(t, s, p); 254 254 if (edge != INVALID) return direct(edge, false); 255 255 } … … 257 257 } 258 258 259 UEdge findUEdge(Node s ource, Node target, UEdge prev= INVALID) const {260 if (s ource != target) {261 if (p rev== INVALID) {262 UEdge edge = Parent::findEdge(s ource, target);259 UEdge findUEdge(Node s, Node t, UEdge p = INVALID) const { 260 if (s != t) { 261 if (p == INVALID) { 262 UEdge edge = Parent::findEdge(s, t); 263 263 if (edge != INVALID) return edge; 264 edge = Parent::findEdge(t arget, source);264 edge = Parent::findEdge(t, s); 265 265 if (edge != INVALID) return edge; 266 } else if (Parent::s ource(prev) == source) {267 UEdge edge = Parent::findEdge(s ource, target, prev);266 } else if (Parent::s(p) == s) { 267 UEdge edge = Parent::findEdge(s, t, p); 268 268 if (edge != INVALID) return edge; 269 edge = Parent::findEdge(t arget, source);269 edge = Parent::findEdge(t, s); 270 270 if (edge != INVALID) return edge; 271 271 } else { 272 UEdge edge = Parent::findEdge(t arget, source, prev);272 UEdge edge = Parent::findEdge(t, s, p); 273 273 if (edge != INVALID) return edge; 274 274 } 275 275 } else { 276 return Parent::findEdge(s ource, target, prev);276 return Parent::findEdge(s, t, p); 277 277 } 278 278 return INVALID; … … 358 358 } 359 359 360 void firstInc(UEdge& edge, bool& dir ection, const Node& node) const {360 void firstInc(UEdge& edge, bool& dir, const Node& node) const { 361 361 if (Parent::aNode(node)) { 362 362 Parent::firstFromANode(edge, node); 363 dir ection= true;363 dir = true; 364 364 } else { 365 365 Parent::firstFromBNode(edge, node); 366 dir ection= static_cast<UEdge&>(edge) == INVALID;367 } 368 } 369 void nextInc(UEdge& edge, bool& dir ection) const {370 if (dir ection) {366 dir = static_cast<UEdge&>(edge) == INVALID; 367 } 368 } 369 void nextInc(UEdge& edge, bool& dir) const { 370 if (dir) { 371 371 Parent::nextFromANode(edge); 372 372 } else { 373 373 Parent::nextFromBNode(edge); 374 if (edge == INVALID) dir ection= true;374 if (edge == INVALID) dir = true; 375 375 } 376 376 } … … 458 458 (edge.forward ? 0 : 1); 459 459 } 460 Edge edgeFromId(int i d) const {461 return Edge(Parent::fromUEdgeId(i d >> 1), (id& 1) == 0);460 Edge edgeFromId(int ix) const { 461 return Edge(Parent::fromUEdgeId(ix >> 1), (ix & 1) == 0); 462 462 } 463 463 int maxEdgeId() const { … … 469 469 } 470 470 471 Edge direct(const UEdge& edge, bool dir ection) const {472 return Edge(edge, dir ection);471 Edge direct(const UEdge& edge, bool dir) const { 472 return Edge(edge, dir); 473 473 } 474 474
Note: See TracChangeset
for help on using the changeset viewer.