aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-14 17:00:57 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-14 17:00:57 -0700
commit0bd4c493e9003449457e87ebad6c7016ded71c8d (patch)
tree4beefd16bdc7665154d73fc07967ac45b1a06a49 /src/main/java/org/traccar/model
parent34fefbffa49925a5d337ff388fb9db400d707f8b (diff)
downloadtrackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.tar.gz
trackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.tar.bz2
trackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.zip
Add LBS location caching (fix #3790)
Diffstat (limited to 'src/main/java/org/traccar/model')
-rw-r--r--src/main/java/org/traccar/model/CellTower.java20
-rw-r--r--src/main/java/org/traccar/model/Network.java22
-rw-r--r--src/main/java/org/traccar/model/WifiAccessPoint.java19
3 files changed, 59 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/model/CellTower.java b/src/main/java/org/traccar/model/CellTower.java
index 16a28ea79..bebbb2432 100644
--- a/src/main/java/org/traccar/model/CellTower.java
+++ b/src/main/java/org/traccar/model/CellTower.java
@@ -19,6 +19,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import org.traccar.config.Config;
import org.traccar.config.Keys;
+import java.util.Objects;
+
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CellTower {
@@ -111,4 +113,22 @@ public class CellTower {
mobileNetworkCode = Integer.parseInt(operatorString.substring(3));
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CellTower cellTower = (CellTower) o;
+ return Objects.equals(radioType, cellTower.radioType)
+ && Objects.equals(cellId, cellTower.cellId)
+ && Objects.equals(locationAreaCode, cellTower.locationAreaCode)
+ && Objects.equals(mobileCountryCode, cellTower.mobileCountryCode)
+ && Objects.equals(mobileNetworkCode, cellTower.mobileNetworkCode)
+ && Objects.equals(signalStrength, cellTower.signalStrength);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(radioType, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode, signalStrength);
+ }
+
}
diff --git a/src/main/java/org/traccar/model/Network.java b/src/main/java/org/traccar/model/Network.java
index 4d67fc5d8..e565f4f59 100644
--- a/src/main/java/org/traccar/model/Network.java
+++ b/src/main/java/org/traccar/model/Network.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Network {
@@ -118,4 +119,23 @@ public class Network {
wifiAccessPoints.add(wifiAccessPoint);
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Network network = (Network) o;
+ return Objects.equals(homeMobileCountryCode, network.homeMobileCountryCode)
+ && Objects.equals(homeMobileNetworkCode, network.homeMobileNetworkCode)
+ && Objects.equals(radioType, network.radioType)
+ && Objects.equals(carrier, network.carrier)
+ && Objects.equals(cellTowers, network.cellTowers)
+ && Objects.equals(wifiAccessPoints, network.wifiAccessPoints);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ homeMobileCountryCode, homeMobileNetworkCode, radioType, carrier, cellTowers, wifiAccessPoints);
+ }
+
}
diff --git a/src/main/java/org/traccar/model/WifiAccessPoint.java b/src/main/java/org/traccar/model/WifiAccessPoint.java
index 87a77f3c0..fa7be8700 100644
--- a/src/main/java/org/traccar/model/WifiAccessPoint.java
+++ b/src/main/java/org/traccar/model/WifiAccessPoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@ package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.Objects;
+
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WifiAccessPoint {
@@ -63,4 +65,19 @@ public class WifiAccessPoint {
this.channel = channel;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ WifiAccessPoint that = (WifiAccessPoint) o;
+ return Objects.equals(macAddress, that.macAddress)
+ && Objects.equals(signalStrength, that.signalStrength)
+ && Objects.equals(channel, that.channel);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(macAddress, signalStrength, channel);
+ }
+
}