From d0536ccbc1b7234784c5e48288bbac00a60ef821 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jul 2024 07:33:16 -0700 Subject: Update switch statements --- .../org/traccar/protocol/Pt502ProtocolDecoder.java | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java index 2a6a81a65..2e88186b8 100644 --- a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -66,28 +66,18 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { .compile(); private String decodeAlarm(String value) { - switch (value) { - case "IN1": - return Position.ALARM_SOS; - case "GOF": - return Position.ALARM_GEOFENCE; - case "TOW": - return Position.ALARM_TOW; - case "HDA": - return Position.ALARM_ACCELERATION; - case "HDB": - return Position.ALARM_BRAKING; - case "FDA": - return Position.ALARM_FATIGUE_DRIVING; - case "SKA": - return Position.ALARM_VIBRATION; - case "PMA": - return Position.ALARM_MOVEMENT; - case "CPA": - return Position.ALARM_POWER_CUT; - default: - return null; - } + return switch (value) { + case "IN1" -> Position.ALARM_SOS; + case "GOF" -> Position.ALARM_GEOFENCE; + case "TOW" -> Position.ALARM_TOW; + case "HDA" -> Position.ALARM_ACCELERATION; + case "HDB" -> Position.ALARM_BRAKING; + case "FDA" -> Position.ALARM_FATIGUE_DRIVING; + case "SKA" -> Position.ALARM_VIBRATION; + case "PMA" -> Position.ALARM_MOVEMENT; + case "CPA" -> Position.ALARM_POWER_CUT; + default -> null; + }; } private Position decodePosition(Channel channel, SocketAddress remoteAddress, String sentence) { -- cgit v1.2.3