diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-08 19:20:09 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-08 19:20:09 +1300 |
commit | 2ac31b5ba9de43474aca125260d143283afa9e91 (patch) | |
tree | aed993545698ae2e68988e95abb74fe60a1c3ffb | |
parent | e3a3f06cc07bc5d75d3d670e045abb5d6c91fcad (diff) | |
download | traccar-server-2ac31b5ba9de43474aca125260d143283afa9e91.tar.gz traccar-server-2ac31b5ba9de43474aca125260d143283afa9e91.tar.bz2 traccar-server-2ac31b5ba9de43474aca125260d143283afa9e91.zip |
Minor formatting fixes
-rw-r--r-- | src/org/traccar/model/Position.java | 26 | ||||
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 14 |
2 files changed, 19 insertions, 21 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 82b7e03ce..aeea83773 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -31,19 +31,19 @@ public class Position extends Message { public static final String KEY_EVENT = "event"; public static final String KEY_ALARM = "alarm"; public static final String KEY_STATUS = "status"; - public static final String KEY_ODOMETER = "odometer"; // meters - public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // meters - public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters + public static final String KEY_ODOMETER = "odometer"; // meters + public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // meters + public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters public static final String KEY_HOURS = "hours"; public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; // The units for the below four KEYs currently vary. // The preferred units of measure are specified in the comment for each. - public static final String KEY_POWER = "power"; // volts - public static final String KEY_BATTERY = "battery"; // volts (or percentage appending '%') - public static final String KEY_FUEL_LEVEL = "fuel"; // liters - public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour + public static final String KEY_POWER = "power"; // volts + public static final String KEY_BATTERY = "battery"; // volts (or percentage appending '%') + public static final String KEY_FUEL_LEVEL = "fuel"; // liters + public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour public static final String KEY_RFID = "rfid"; public static final String KEY_VERSION_FW = "versionFw"; @@ -54,8 +54,8 @@ public class Position extends Message { public static final String KEY_CHARGE = "charge"; public static final String KEY_IP = "ip"; public static final String KEY_ARCHIVE = "archive"; - public static final String KEY_DISTANCE = "distance"; // meters - public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // meters + public static final String KEY_DISTANCE = "distance"; // meters + public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // meters public static final String KEY_RPM = "rpm"; public static final String KEY_VIN = "vin"; public static final String KEY_APPROXIMATE = "approximate"; @@ -64,17 +64,17 @@ public class Position extends Message { public static final String KEY_ARMED = "armed"; public static final String KEY_GEOFENCE = "geofence"; public static final String KEY_ACCELERATION = "acceleration"; - public static final String KEY_DEVICE_TEMP = "deviceTemp"; // celsius + public static final String KEY_DEVICE_TEMP = "deviceTemp"; // celsius public static final String KEY_OPERATOR = "operator"; public static final String KEY_COMMAND = "command"; public static final String KEY_DTCS = "dtcs"; - public static final String KEY_OBD_SPEED = "obdSpeed"; // knots - public static final String KEY_OBD_ODOMETER = "obdOdometer"; // meters + public static final String KEY_OBD_SPEED = "obdSpeed"; // knots + public static final String KEY_OBD_ODOMETER = "obdOdometer"; // meters public static final String KEY_RESULT = "result"; - // Starts with 1 not 0 + // Start with 1 not 0 public static final String PREFIX_TEMP = "temp"; public static final String PREFIX_ADC = "adc"; public static final String PREFIX_IO = "io"; diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 9541e1027..1402e10d4 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -61,10 +61,8 @@ public final class ReportUtils { public static double calculateDistance(Position firstPosition, Position lastPosition, boolean useOdometer) { double distance = 0.0; - double firstOdometer = 0.0; - double lastOdometer = 0.0; - firstOdometer = firstPosition.getDouble(Position.KEY_ODOMETER); - lastOdometer = lastPosition.getDouble(Position.KEY_ODOMETER); + double firstOdometer = firstPosition.getDouble(Position.KEY_ODOMETER); + double lastOdometer = lastPosition.getDouble(Position.KEY_ODOMETER); if (useOdometer && (firstOdometer != 0.0 || lastOdometer != 0.0)) { distance = lastOdometer - firstOdometer; @@ -85,10 +83,10 @@ public final class ReportUtils { case "meitrack": case "galileo": case "noran": - BigDecimal v = new BigDecimal(firstPosition.getAttributes() - .get(Position.KEY_FUEL_LEVEL).toString()); - v = v.subtract(new BigDecimal(lastPosition.getAttributes() - .get(Position.KEY_FUEL_LEVEL).toString())); + BigDecimal v = new BigDecimal( + firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL).toString()); + v = v.subtract(new BigDecimal( + lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL).toString())); return v.setScale(2, RoundingMode.HALF_EVEN).toString() + " %"; default: break; |