Merge pull request #2570 from osmandapp/obf-merge
OBF combine address index: MapObjectComparator
This commit is contained in:
commit
051c676955
1 changed files with 18 additions and 2 deletions
|
@ -18,7 +18,7 @@ import net.sf.junidecode.Junidecode;
|
||||||
|
|
||||||
public abstract class MapObject implements Comparable<MapObject> {
|
public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
public static final Comparator<MapObject> BY_NAME_COMPARATOR = new MapObjectComparator();
|
public static final MapObjectComparator BY_NAME_COMPARATOR = new MapObjectComparator();
|
||||||
|
|
||||||
|
|
||||||
protected String name = null;
|
protected String name = null;
|
||||||
|
@ -223,8 +223,24 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(MapObject o1, MapObject o2) {
|
public int compare(MapObject o1, MapObject o2) {
|
||||||
|
if (o1 == null ^ o2 == null) {
|
||||||
|
return (o1 == null) ? -1 : 1;
|
||||||
|
} else if (o1 == o2) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
return collator.compare(o1.getName(l), o2.getName(l));
|
return collator.compare(o1.getName(l), o2.getName(l));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean areEqual(MapObject o1, MapObject o2) {
|
||||||
|
if (o1 == null ^ o2 == null) {
|
||||||
|
return false;
|
||||||
|
} else if (o1 == o2) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return collator.equals(o1.getName(l), o2.getName(l));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue