Formatting

This commit is contained in:
Roman Inflianskas 2016-06-02 21:57:32 +03:00
parent 6c3f66bf92
commit 58d83cf2ee

View file

@ -16,17 +16,17 @@ import net.sf.junidecode.Junidecode;
public abstract class MapObject implements Comparable<MapObject> { public abstract class MapObject implements Comparable<MapObject> {
public static final MapObjectComparator BY_NAME_COMPARATOR = new MapObjectComparator(); public static final MapObjectComparator BY_NAME_COMPARATOR = new MapObjectComparator();
protected String name = null; protected String name = null;
protected String enName = null; protected String enName = null;
protected Map<String, String> names = null; protected Map<String, String> names = null;
protected LatLon location = null; protected LatLon location = null;
protected int fileOffset = 0; protected int fileOffset = 0;
protected Long id = null; protected Long id = null;
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
@ -162,7 +162,7 @@ public abstract class MapObject implements Comparable<MapObject> {
public void setLocation(double latitude, double longitude) { public void setLocation(double latitude, double longitude) {
location = new LatLon(latitude, longitude); location = new LatLon(latitude, longitude);
} }
@Override @Override
public int compareTo(MapObject o) { public int compareTo(MapObject o) {
return OsmAndCollator.primaryCollator().compare(getName(), o.getName()); return OsmAndCollator.primaryCollator().compare(getName(), o.getName());
@ -171,14 +171,14 @@ public abstract class MapObject implements Comparable<MapObject> {
public int getFileOffset() { public int getFileOffset() {
return fileOffset; return fileOffset;
} }
public void setFileOffset(int fileOffset) { public void setFileOffset(int fileOffset) {
this.fileOffset = fileOffset; this.fileOffset = fileOffset;
} }
@Override @Override
public String toString() { public String toString() {
return getClass().getSimpleName() + " " + name +"("+id+")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return getClass().getSimpleName() + " " + name + "(" + id + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} }
@Override @Override
@ -205,7 +205,7 @@ public abstract class MapObject implements Comparable<MapObject> {
return false; return false;
return true; return true;
} }
public static class MapObjectComparator implements Comparator<MapObject> { public static class MapObjectComparator implements Comparator<MapObject> {
private final String l; private final String l;
Collator collator = OsmAndCollator.primaryCollator(); Collator collator = OsmAndCollator.primaryCollator();
@ -217,7 +217,7 @@ public abstract class MapObject implements Comparable<MapObject> {
public MapObjectComparator(String lang) { public MapObjectComparator(String lang) {
this.l = lang; this.l = lang;
} }
@Override @Override
public int compare(MapObject o1, MapObject o2) { public int compare(MapObject o1, MapObject o2) {
if (o1 == null ^ o2 == null) { if (o1 == null ^ o2 == null) {
@ -238,6 +238,6 @@ public abstract class MapObject implements Comparable<MapObject> {
return collator.equals(o1.getName(l), o2.getName(l)); return collator.equals(o1.getName(l), o2.getName(l));
} }
} }
} }
} }