diff -r 4317d277ba21 -r 765619b7cbb2 lemon/bits/base_extender.h --- a/lemon/bits/base_extender.h Sun Jul 13 16:46:56 2008 +0100 +++ b/lemon/bits/base_extender.h Sun Jul 13 19:51:02 2008 +0100 @@ -1,6 +1,6 @@ -/* -*- C++ -*- +/* -*- mode: C++; indent-tabs-mode: nil; -*- * - * This file is a part of LEMON, a generic C++ optimization library + * This file is a part of LEMON, a generic C++ optimization library. * * Copyright (C) 2003-2008 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport @@ -63,14 +63,14 @@ Arc(Invalid i) : Edge(i), forward(true) {} bool operator==(const Arc &that) const { - return forward==that.forward && Edge(*this)==Edge(that); + return forward==that.forward && Edge(*this)==Edge(that); } bool operator!=(const Arc &that) const { - return forward!=that.forward || Edge(*this)!=Edge(that); + return forward!=that.forward || Edge(*this)!=Edge(that); } bool operator<(const Arc &that) const { - return forward(node)); } - + int id(const Blue& node) const { return Parent::redId(node); } @@ -367,19 +367,19 @@ void firstInc(Edge& arc, bool& dir, const Node& node) const { if (Parent::red(node)) { - Parent::firstFromRed(arc, node); - dir = true; + Parent::firstFromRed(arc, node); + dir = true; } else { - Parent::firstFromBlue(arc, node); - dir = static_cast(arc) == INVALID; + Parent::firstFromBlue(arc, node); + dir = static_cast(arc) == INVALID; } } void nextInc(Edge& arc, bool& dir) const { if (dir) { - Parent::nextFromRed(arc); + Parent::nextFromRed(arc); } else { - Parent::nextFromBlue(arc); - if (arc == INVALID) dir = true; + Parent::nextFromBlue(arc); + if (arc == INVALID) dir = true; } } @@ -389,20 +389,20 @@ bool forward; Arc(const Edge& arc, bool _forward) - : Edge(arc), forward(_forward) {} + : Edge(arc), forward(_forward) {} public: Arc() {} Arc (Invalid) : Edge(INVALID), forward(true) {} bool operator==(const Arc& i) const { - return Edge::operator==(i) && forward == i.forward; + return Edge::operator==(i) && forward == i.forward; } bool operator!=(const Arc& i) const { - return Edge::operator!=(i) || forward != i.forward; + return Edge::operator!=(i) || forward != i.forward; } bool operator<(const Arc& i) const { - return Edge::operator<(i) || - (!(i.forward(arc)); + Parent::next(static_cast(arc)); } arc.forward = !arc.forward; } void firstOut(Arc& arc, const Node& node) const { if (Parent::red(node)) { - Parent::firstFromRed(arc, node); - arc.forward = true; + Parent::firstFromRed(arc, node); + arc.forward = true; } else { - Parent::firstFromBlue(arc, node); - arc.forward = static_cast(arc) == INVALID; + Parent::firstFromBlue(arc, node); + arc.forward = static_cast(arc) == INVALID; } } void nextOut(Arc& arc) const { if (arc.forward) { - Parent::nextFromRed(arc); + Parent::nextFromRed(arc); } else { - Parent::nextFromBlue(arc); + Parent::nextFromBlue(arc); arc.forward = static_cast(arc) == INVALID; } } void firstIn(Arc& arc, const Node& node) const { if (Parent::blue(node)) { - Parent::firstFromBlue(arc, node); - arc.forward = true; + Parent::firstFromBlue(arc, node); + arc.forward = true; } else { - Parent::firstFromRed(arc, node); - arc.forward = static_cast(arc) == INVALID; + Parent::firstFromRed(arc, node); + arc.forward = static_cast(arc) == INVALID; } } void nextIn(Arc& arc) const { if (arc.forward) { - Parent::nextFromBlue(arc); + Parent::nextFromBlue(arc); } else { - Parent::nextFromRed(arc); - arc.forward = static_cast(arc) == INVALID; + Parent::nextFromRed(arc); + arc.forward = static_cast(arc) == INVALID; } } @@ -462,7 +462,7 @@ } int id(const Arc& arc) const { - return (Parent::id(static_cast(arc)) << 1) + + return (Parent::id(static_cast(arc)) << 1) + (arc.forward ? 0 : 1); } Arc arcFromId(int ix) const {