aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/helper/LocationTree.java19
-rwxr-xr-xsrc/org/traccar/protocol/AppelloProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java1
3 files changed, 21 insertions, 11 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;
}
}
diff --git a/src/org/traccar/protocol/AppelloProtocolDecoder.java b/src/org/traccar/protocol/AppelloProtocolDecoder.java
index 437b588a4..f04623759 100755
--- a/src/org/traccar/protocol/AppelloProtocolDecoder.java
+++ b/src/org/traccar/protocol/AppelloProtocolDecoder.java
@@ -33,17 +33,17 @@ public class AppelloProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN = new PatternBuilder()
- .text("FOLLOWIT,") // brand
- .number("(d+),") // imei
+ .text("FOLLOWIT,") // brand
+ .number("(d+),") // imei
.number("(dd)(dd)(dd)") // date
.number("(dd)(dd)(dd).?d*,") // time
.number("(-?d+.d+),") // latitude
.number("(-?d+.d+),") // longitude
.number("(d+),") // speed
- .number("(d+),") // course
- .number("(d+),") // satellites
- .number("(d+),") // altitude
- .expression("([FL]),") // gps state
+ .number("(d+),") // course
+ .number("(d+),") // satellites
+ .number("(d+),") // altitude
+ .expression("([FL]),") // gps state
.any()
.compile();
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index d34868b6a..4592ccdab 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -27,7 +27,6 @@ import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
-import org.traccar.helper.PatternUtil;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
import org.traccar.model.Position;