Last change
on this file since 12036 was 9880, checked in by Don-vip, 8 years ago |
findbugs
|
-
Property svn:eol-style
set to
native
|
File size:
715 bytes
|
Rev | Line | |
---|
[3636] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.data.osm;
|
---|
| 3 |
|
---|
[8308] | 4 | import java.io.Serializable;
|
---|
[3636] | 5 | import java.util.Comparator;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Provides some node order , based on coordinates, nodes with equal coordinates are equal.
|
---|
| 9 | *
|
---|
| 10 | * @author viesturs
|
---|
| 11 | */
|
---|
[8308] | 12 | public class NodePositionComparator implements Comparator<Node>, Serializable {
|
---|
| 13 |
|
---|
| 14 | private static final long serialVersionUID = 1L;
|
---|
| 15 |
|
---|
[3636] | 16 | @Override
|
---|
| 17 | public int compare(Node n1, Node n2) {
|
---|
[3650] | 18 |
|
---|
| 19 | if (n1.getCoor().equalsEpsilon(n2.getCoor()))
|
---|
| 20 | return 0;
|
---|
| 21 |
|
---|
[9880] | 22 | int dLat = Double.compare(n1.getCoor().lat(), n2.getCoor().lat());
|
---|
| 23 | return dLat != 0 ? dLat : Double.compare(n1.getCoor().lon(), n2.getCoor().lon());
|
---|
[3636] | 24 | }
|
---|
| 25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.