# HG changeset patch # User Santeri Piippo # Date 1403460830 -10800 # Node ID 987f35e96467fbe4735103aff8db6f8e5689f33e # Parent b7e0d08becac2372d399cf8b1245e1416e5ef57b - refactor diff -r b7e0d08becac -r 987f35e96467 src/misc/ringFinder.cc --- a/src/misc/ringFinder.cc Sun Jun 22 18:33:26 2014 +0300 +++ b/src/misc/ringFinder.cc Sun Jun 22 21:13:50 2014 +0300 @@ -180,14 +180,10 @@ // bool RingFinder::Solution::isSuperiorTo (const Solution* other) const { - // If this solution has less components than the other one, this one - // is definitely better. - if (getComponents().size() < other->getComponents().size()) - return true; - - // vice versa - if (other->getComponents().size() < getComponents().size()) - return false; + // If one solution has less components than the other one, it is definitely + // better. + if (getComponents().size() != other->getComponents().size()) + return getComponents().size() < other->getComponents().size(); // Calculate the maximum ring number. Since the solutions have equal // ring counts, the solutions with lesser maximum rings should result @@ -201,11 +197,8 @@ maxB = max (other->getComponents()[i].num, maxB); } - if (maxA < maxB) - return true; - - if (maxB < maxA) - return false; + if (maxA != maxB) + return maxA < maxB; // Solutions have equal rings and equal maximum ring numbers. Let's // just say this one is better, at this point it does not matter which