2010-09-19 12:42:16 +02:00
|
|
|
package net.osmand.data;
|
|
|
|
|
|
|
|
import java.text.Collator;
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
2010-11-02 22:59:47 +01:00
|
|
|
public class MapObjectComparator implements Comparator<MapObject>{
|
2010-09-19 12:42:16 +02:00
|
|
|
private final boolean en;
|
|
|
|
Collator collator = Collator.getInstance();
|
2010-11-02 22:59:47 +01:00
|
|
|
public MapObjectComparator(boolean en){
|
2010-09-19 12:42:16 +02:00
|
|
|
this.en = en;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2010-11-02 22:59:47 +01:00
|
|
|
public int compare(MapObject o1, MapObject o2) {
|
2010-09-19 12:42:16 +02:00
|
|
|
if(en){
|
|
|
|
return collator.compare(o1.getEnName(), o2.getEnName());
|
|
|
|
} else {
|
|
|
|
return collator.compare(o1.getName(), o2.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|