Fix distance search

This commit is contained in:
Victor Shcherb 2018-08-11 16:49:05 +02:00
parent 65a8abe29c
commit e40af714a0
2 changed files with 16 additions and 10 deletions

View file

@ -288,11 +288,14 @@ public class AmenityMenuController extends MenuController {
@Override
public int compare(TransportStopRoute o1, TransportStopRoute o2) {
if (o1.distance != o2.distance) {
return Algorithms.compare(o1.distance, o2.distance);
}
int i1 = Algorithms.extractFirstIntegerNumber(o1.desc);
int i2 = Algorithms.extractFirstIntegerNumber(o2.desc);
// int radEqual = 50;
// int dist1 = o1.distance / radEqual;
// int dist2 = o2.distance / radEqual;
// if (dist1 != dist2) {
// return Algorithms.compare(dist1, dist2);
// }
int i1 = Algorithms.extractFirstIntegerNumber(o1.route.getRef());
int i2 = Algorithms.extractFirstIntegerNumber(o2.route.getRef());
if (i1 != i2) {
return Algorithms.compare(i1, i2);
}

View file

@ -125,11 +125,14 @@ public class TransportStopController extends MenuController {
@Override
public int compare(TransportStopRoute o1, TransportStopRoute o2) {
if (o1.distance != o2.distance) {
return Algorithms.compare(o1.distance, o2.distance);
}
int i1 = Algorithms.extractFirstIntegerNumber(o1.desc);
int i2 = Algorithms.extractFirstIntegerNumber(o2.desc);
// int radEqual = 50;
// int dist1 = o1.distance / radEqual;
// int dist2 = o2.distance / radEqual;
// if (dist1 != dist2) {
// return Algorithms.compare(dist1, dist2);
// }
int i1 = Algorithms.extractFirstIntegerNumber(o1.route.getRef());
int i2 = Algorithms.extractFirstIntegerNumber(o2.route.getRef());
if (i1 != i2) {
return Algorithms.compare(i1, i2);
}