diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-13 22:38:13 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-13 22:38:13 +1200 |
commit | abb2f8614b7fbc25892e277b55fa216c7d81fd54 (patch) | |
tree | fea9e46e90d734c8052d81120c65fd50f492ee30 /src/org/traccar/protocol | |
parent | 8e033d5d4efa6a88f25e86517f858b696b76546c (diff) | |
download | trackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.tar.gz trackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.tar.bz2 trackermap-server-abb2f8614b7fbc25892e277b55fa216c7d81fd54.zip |
Use switch statemens with strings
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/NavisProtocolDecoder.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 02d408575..46d249fe7 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -15,19 +15,16 @@ */ package org.traccar.protocol; +import java.net.SocketAddress; import java.nio.ByteOrder; import java.nio.charset.Charset; -import java.net.SocketAddress; import java.util.Calendar; import java.util.LinkedList; import java.util.List; import java.util.TimeZone; - import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; - import org.traccar.BaseProtocolDecoder; import org.traccar.model.Event; import org.traccar.model.Position; @@ -303,13 +300,14 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { // Read message type String type = buf.toString(buf.readerIndex(), 3, charset); buf.skipBytes(type.length()); - - if (type.equals("*>T")) { - return processSingle(channel, buf); - } else if (type.equals("*>A")) { - return processArray(channel, buf); - } else if (type.equals("*>S")) { - return processHandshake(channel, buf); + + switch (type) { + case "*>T": + return processSingle(channel, buf); + case "*>A": + return processArray(channel, buf); + case "*>S": + return processHandshake(channel, buf); } return null; |