From 0bd4c493e9003449457e87ebad6c7016ded71c8d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 14 Jul 2022 17:00:57 -0700 Subject: Add LBS location caching (fix #3790) --- src/main/java/org/traccar/model/WifiAccessPoint.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/traccar/model/WifiAccessPoint.java') 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); + } + } -- cgit v1.2.3 From 900601111466aa861db8ae77b71b95aec6c8c82e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 14 Jul 2022 17:04:39 -0700 Subject: Fix code style issues --- src/main/java/org/traccar/model/CellTower.java | 8 ++++++-- src/main/java/org/traccar/model/Network.java | 8 ++++++-- src/main/java/org/traccar/model/WifiAccessPoint.java | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/main/java/org/traccar/model/WifiAccessPoint.java') diff --git a/src/main/java/org/traccar/model/CellTower.java b/src/main/java/org/traccar/model/CellTower.java index bebbb2432..355594c64 100644 --- a/src/main/java/org/traccar/model/CellTower.java +++ b/src/main/java/org/traccar/model/CellTower.java @@ -115,8 +115,12 @@ public class CellTower { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + 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) diff --git a/src/main/java/org/traccar/model/Network.java b/src/main/java/org/traccar/model/Network.java index e565f4f59..b31c53c38 100644 --- a/src/main/java/org/traccar/model/Network.java +++ b/src/main/java/org/traccar/model/Network.java @@ -121,8 +121,12 @@ public class Network { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + 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) diff --git a/src/main/java/org/traccar/model/WifiAccessPoint.java b/src/main/java/org/traccar/model/WifiAccessPoint.java index fa7be8700..e28c1b935 100644 --- a/src/main/java/org/traccar/model/WifiAccessPoint.java +++ b/src/main/java/org/traccar/model/WifiAccessPoint.java @@ -67,8 +67,12 @@ public class WifiAccessPoint { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + 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) -- cgit v1.2.3