aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:38:13 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:38:13 +1200
commitabb2f8614b7fbc25892e277b55fa216c7d81fd54 (patch)
treefea9e46e90d734c8052d81120c65fd50f492ee30 /src/org/traccar/protocol
parent8e033d5d4efa6a88f25e86517f858b696b76546c (diff)
downloadtrackermap-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.java20
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;