- refactor

Sun, 22 Jun 2014 21:13:50 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 22 Jun 2014 21:13:50 +0300
changeset 813
987f35e96467
parent 812
b7e0d08becac
child 814
c8ef30fd0e54

- refactor

src/misc/ringFinder.cc file | annotate | diff | comparison | revisions
--- 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

mercurial