aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/CarscopProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 16:53:14 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 16:53:14 +1300
commitc64a77edfdcd6ed4e7cb61bef5e3f2762a607da7 (patch)
tree470f3e9d8ceae5f8fe7eadc69bf82f9ef8368c6e /src/org/traccar/protocol/CarscopProtocolDecoder.java
parent65d2e3b04e3d32245456e7520796cdf7e9def692 (diff)
downloadtrackermap-server-c64a77edfdcd6ed4e7cb61bef5e3f2762a607da7.tar.gz
trackermap-server-c64a77edfdcd6ed4e7cb61bef5e3f2762a607da7.tar.bz2
trackermap-server-c64a77edfdcd6ed4e7cb61bef5e3f2762a607da7.zip
Replace valueOf with parseXxx
Diffstat (limited to 'src/org/traccar/protocol/CarscopProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index b0be91dde..63ed12a2a 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -20,7 +20,6 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
@@ -78,42 +77,42 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
- time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
+ time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++)));
// Validity
- position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false);
+ position.setValid(parser.group(index++).compareTo("A") == 0);
// Latitude
- Double latitude = Double.valueOf(parser.group(index++));
- latitude += Double.valueOf(parser.group(index++)) / 60;
+ double latitude = Double.parseDouble(parser.group(index++));
+ latitude += Double.parseDouble(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("S") == 0) latitude = -latitude;
position.setLatitude(latitude);
// Longitude
- Double longitude = Double.valueOf(parser.group(index++));
- longitude += Double.valueOf(parser.group(index++)) / 60;
+ double longitude = Double.parseDouble(parser.group(index++));
+ longitude += Double.parseDouble(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("W") == 0) longitude = -longitude;
position.setLongitude(longitude);
// Speed
- position.setSpeed(Double.valueOf(parser.group(index++)));
+ position.setSpeed(Double.parseDouble(parser.group(index++)));
// Date
- time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
- time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++)));
+ time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1);
+ time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++)));
position.setTime(time.getTime());
// Course
- position.setCourse(Double.valueOf(parser.group(index++)));
+ position.setCourse(Double.parseDouble(parser.group(index++)));
// State
position.set(Event.KEY_STATUS, parser.group(index++));
// Odometer
- position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_ODOMETER, Integer.parseInt(parser.group(index++)));
return position;
}