Changeset 9310 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r9243 r9310 15 15 import org.openstreetmap.josm.data.coor.CoordinateFormat; 16 16 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 17 18 import org.openstreetmap.josm.data.osm.Changeset; 18 19 import org.openstreetmap.josm.data.osm.DataSet; … … 93 94 } 94 95 95 protected static final Comparator<OsmPrimitive> byIdComparator = new Comparator<OsmPrimitive>() { 96 @Override public int compare(OsmPrimitive o1, OsmPrimitive o2) { 97 return o1.getUniqueId() < o2.getUniqueId() ? -1 : (o1.getUniqueId() == o2.getUniqueId() ? 0 : 1); 96 /** 97 * Sorts {@code -1} → {@code -infinity}, then {@code +1} → {@code +infinity} 98 */ 99 protected static final Comparator<AbstractPrimitive> byIdComparator = new Comparator<AbstractPrimitive>() { 100 @Override public int compare(AbstractPrimitive o1, AbstractPrimitive o2) { 101 final long i1 = o1.getUniqueId(); 102 final long i2 = o2.getUniqueId(); 103 if (i1 < 0 && i2 < 0) { 104 return Long.compare(i2, i1); 105 } else { 106 return Long.compare(i1, i2); 107 } 98 108 } 99 109 };
Note:
See TracChangeset
for help on using the changeset viewer.