Archived
0

checking distance on compared routes

This commit is contained in:
iMoHax
2014-08-25 22:22:00 +04:00
parent b3bd22b99d
commit 478dc95c8f

View File

@@ -13,7 +13,13 @@ public class RouteGraph extends Graph<Vendor> {
PathRoute r1 = (PathRoute) p1.getRoot();
PathRoute r2 = (PathRoute) p2.getRoot();
return Double.compare(r2.getProfit()/r2.getLandsCount(), r1.getProfit()/r1.getLandsCount());
int cmp = Double.compare(r2.getProfit()/r2.getLandsCount(), r1.getProfit()/r1.getLandsCount());
if (cmp != 0 ) return cmp;
cmp = Double.compare(r1.getDistance(), r2.getDistance());
if (cmp != 0) return cmp;
cmp = Double.compare(r1.getLandsCount(), r2.getLandsCount());
if (cmp != 0) return cmp;
return cmp;
};