aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-15 10:15:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-15 10:15:56 +1200
commited7fe94f1da3b333a1ffff4f9238bab7484a81ca (patch)
tree7a1f3d49123710bfb0763b162beb8c924ba50953 /src/org/traccar/helper
parent409f9ce7f9e10213ed65fb24b685d1a58777b9f2 (diff)
downloadtrackermap-server-ed7fe94f1da3b333a1ffff4f9238bab7484a81ca.tar.gz
trackermap-server-ed7fe94f1da3b333a1ffff4f9238bab7484a81ca.tar.bz2
trackermap-server-ed7fe94f1da3b333a1ffff4f9238bab7484a81ca.zip
Fix check style code issues
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/LocationTree.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/org/traccar/helper/LocationTree.java b/src/org/traccar/helper/LocationTree.java
index 1d7d8ab25..90e5fe8c2 100644
--- a/src/org/traccar/helper/LocationTree.java
+++ b/src/org/traccar/helper/LocationTree.java
@@ -95,16 +95,27 @@ public class LocationTree {
private Item findNearest(Item current, Item search, int depth) {
int direction = comparators.get(depth % 2).compare(search, current);
- Item next = (direction < 0) ? current.left : current.right;
- Item other = (direction < 0) ? current.right : current.left;
- Item best = (next == null) ? current : findNearest(next, search, depth + 1);
+ Item next, other;
+ if (direction < 0) {
+ next = current.left;
+ other = current.right;
+ } else {
+ next = current.right;
+ other = current.left;
+ }
+
+ Item best = current;
+ if (next != null) {
+ findNearest(next, search, depth + 1);
+ }
+
if (current.squaredDistance(search) < best.squaredDistance(search)) {
best = current;
}
if (other != null) {
if (current.axisSquaredDistance(search, depth % 2) < best.squaredDistance(search)) {
Item possibleBest = findNearest(other, search, depth + 1);
- if (possibleBest.squaredDistance(search) < best.squaredDistance(search) ) {
+ if (possibleBest.squaredDistance(search) < best.squaredDistance(search)) {
best = possibleBest;
}
}