From 7706648481f9687eecc070b4678cc792d7811da7 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Mon, 21 Jan 2019 19:35:21 +0300 Subject: Used member references for the FLEXPositionParser interface --- src/org/traccar/protocol/NavisProtocolDecoder.java | 40 +++------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index ec1a1324b..39e3bdc0f 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -661,46 +661,16 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { switch (buf.readShortLE()) { // FLEX 1.0 case 0x417E: // "~A" - return processFLEXArray(new FLEXPositionParser() { - @Override - public ParseResult parsePosition(DeviceSession deviceSession, ByteBuf buf) { - return NavisProtocolDecoder.this.parseFLEXPosition(deviceSession, buf); - } - }, - "~A", deviceSession, channel, buf); + return processFLEXArray(this::parseFLEXPosition, "~A", deviceSession, channel, buf); case 0x547E: // "~T" - return processFLEXSingle(new FLEXPositionParser() { - @Override - public ParseResult parsePosition(DeviceSession deviceSession, ByteBuf buf) { - return NavisProtocolDecoder.this.parseFLEXPosition(deviceSession, buf); - } - }, - "~T", deviceSession, channel, buf); + return processFLEXSingle(this::parseFLEXPosition, "~T", deviceSession, channel, buf); case 0x437E: // "~C" - return processFLEXSingle(new FLEXPositionParser() { - @Override - public ParseResult parsePosition(DeviceSession deviceSession, ByteBuf buf) { - return NavisProtocolDecoder.this.parseFLEXPosition(deviceSession, buf); - } - }, - "~C", deviceSession, channel, buf); + return processFLEXSingle(this::parseFLEXPosition, "~C", deviceSession, channel, buf); // FLEX 2.0 (Extra packages) case 0x457E: // "~E" - return processFLEXArray(new FLEXPositionParser() { - @Override - public ParseResult parsePosition(DeviceSession deviceSession, ByteBuf buf) { - return NavisProtocolDecoder.this.parseFLEX20Position(deviceSession, buf); - } - }, - "~E", deviceSession, channel, buf); + return processFLEXArray(this::parseFLEX20Position, "~E", deviceSession, channel, buf); case 0x587E: // "~X" - return processFLEXSingle(new FLEXPositionParser() { - @Override - public ParseResult parsePosition(DeviceSession deviceSession, ByteBuf buf) { - return NavisProtocolDecoder.this.parseFLEX20Position(deviceSession, buf); - } - }, - "~X", deviceSession, channel, buf); + return processFLEXSingle(this::parseFLEX20Position, "~X", deviceSession, channel, buf); default: break; } -- cgit v1.2.3