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