Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00f2394

Browse files
committed
latest formatter settings applied
1 parent cd08286 commit 00f2394

32 files changed

+818
-794
lines changed

src/main/java/de/taimos/gpsd4java/api/DistanceListener.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,27 +29,28 @@
2929
* @author thoeger
3030
*/
3131
public abstract class DistanceListener extends ObjectListener {
32-
32+
3333
private TPVObject lastPosition;
34-
34+
3535
private final double threshold;
36-
36+
37+
3738
/**
3839
* @param threshold
3940
* the threshold to fire in kilometers
4041
*/
4142
public DistanceListener(final double threshold) {
4243
this.threshold = threshold;
4344
}
44-
45+
4546
@Override
4647
public void handleTPV(final TPVObject tpv) {
4748
if ((this.lastPosition == null) || (GISTool.getDistance(tpv, this.lastPosition) > this.threshold)) {
4849
this.lastPosition = tpv;
4950
this.handleLocation(tpv);
5051
}
5152
}
52-
53+
5354
protected abstract void handleLocation(TPVObject tpv);
54-
55+
5556
}

src/main/java/de/taimos/gpsd4java/api/IObjectListener.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,41 +33,41 @@
3333
* @author thoeger
3434
*/
3535
public interface IObjectListener {
36-
36+
3737
/**
3838
* @param tpv
3939
* the TPV object
4040
*/
4141
void handleTPV(TPVObject tpv);
42-
42+
4343
/**
4444
* @param sky
4545
* the SKY object
4646
*/
4747
void handleSKY(SKYObject sky);
48-
48+
4949
/**
5050
* @param att
5151
* the ATT object
5252
*/
5353
void handleATT(ATTObject att);
54-
54+
5555
/**
5656
* @param subframe
5757
* the SUBFRAME object
5858
*/
5959
void handleSUBFRAME(SUBFRAMEObject subframe);
60-
60+
6161
/**
6262
* @param devices
6363
* the devices object
6464
*/
6565
void handleDevices(DevicesObject devices);
66-
66+
6767
/**
6868
* @param device
6969
* the device object
7070
*/
7171
void handleDevice(DeviceObject device);
72-
72+
7373
}

src/main/java/de/taimos/gpsd4java/api/ObjectListener.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,35 +33,35 @@
3333
* @author thoeger
3434
*/
3535
public class ObjectListener implements IObjectListener {
36-
36+
3737
@Override
3838
public void handleTPV(final TPVObject tpv) {
3939
// implement in subclass if needed
4040
}
41-
41+
4242
@Override
4343
public void handleSKY(final SKYObject sky) {
4444
// implement in subclass if needed
4545
}
46-
46+
4747
@Override
4848
public void handleATT(final ATTObject att) {
4949
// implement in subclass if needed
5050
}
51-
51+
5252
@Override
5353
public void handleSUBFRAME(final SUBFRAMEObject subframe) {
5454
// implement in subclass if needed
5555
}
56-
56+
5757
@Override
5858
public void handleDevices(final DevicesObject devices) {
5959
// implement in subclass if needed
6060
}
61-
61+
6262
@Override
6363
public void handleDevice(final DeviceObject device) {
6464
// implement in subclass if needed
6565
}
66-
66+
6767
}

src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,19 +41,20 @@
4141
* @author irakli, thoeger
4242
*/
4343
public abstract class AbstractResultParser {
44-
44+
4545
protected static final Logger LOG = Logger.getLogger(ResultParser.class.getName());
46-
46+
4747
protected final DateFormat dateFormat; // Don't make this static!
48-
48+
49+
4950
/**
5051
* Create new ResultParser
5152
*/
5253
public AbstractResultParser() {
5354
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
5455
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
5556
}
56-
57+
5758
/**
5859
* Parse a received line into a {@link IGPSObject}
5960
*
@@ -71,18 +72,18 @@ public IGPSObject parse(final String line) throws ParseException {
7172
throw new ParseException("Parsing failed", e);
7273
}
7374
}
74-
75+
7576
/**
7677
* @param json
7778
* @return the parsed {@link IGPSObject}
7879
* @throws ParseException
7980
*/
8081
public abstract IGPSObject parse(final JSONObject json) throws ParseException;
81-
82+
8283
/**
8384
* parse a whole JSONArray into a list of IGPSObjects
8485
*/
85-
@SuppressWarnings({ "unchecked", "unused" })
86+
@SuppressWarnings({"unchecked", "unused"})
8687
protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array, final Class<T> type) throws ParseException {
8788
try {
8889
if (array == null) {
@@ -97,12 +98,12 @@ protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array,
9798
throw new ParseException("Parsing failed", e);
9899
}
99100
}
100-
101+
101102
protected double parseTimestamp(final JSONObject json, final String fieldName) {
102103
try {
103104
final String text = json.optString(fieldName, null);
104105
AbstractResultParser.LOG.log(Level.FINE, fieldName + ": {0}", text);
105-
106+
106107
if (text != null) {
107108
final Date date = this.dateFormat.parse(text);
108109
if (AbstractResultParser.LOG.isLoggable(Level.FINE)) {

src/main/java/de/taimos/gpsd4java/backend/GISTool.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -28,13 +28,14 @@
2828
* @author thoeger
2929
*/
3030
public final class GISTool {
31-
31+
3232
private static final int EARTH_RADIUS_KILOMETERS = 6371;
33-
33+
34+
3435
private GISTool() {
3536
//
3637
}
37-
38+
3839
/**
3940
* calculates the distance between two {@link TPVObject} in kilometers<br>
4041
* the method used is the great-circle-distance with hypersine formula
@@ -48,7 +49,7 @@ private GISTool() {
4849
public static double getDistance(final TPVObject tpv1, final TPVObject tpv2) {
4950
return GISTool.getDistance(tpv1.getLongitude(), tpv2.getLongitude(), tpv1.getLatitude(), tpv2.getLatitude());
5051
}
51-
52+
5253
/**
5354
* calculates the distance between two locations, which are given as coordinates, in kilometers<br>
5455
* the method used is the great-circle-distance with hypersine formula
@@ -66,19 +67,19 @@ public static double getDistance(final TPVObject tpv1, final TPVObject tpv2) {
6667
public static double getDistance(final double x1, final double x2, final double y1, final double y2) {
6768
// transform to radian
6869
final double deg2rad = Math.PI / 180;
69-
70+
7071
final double x1rad = x1 * deg2rad;
7172
final double x2rad = x2 * deg2rad;
7273
final double y1rad = y1 * deg2rad;
7374
final double y2rad = y2 * deg2rad;
74-
75+
7576
// great-circle-distance with hypersine formula
7677
final double dlong = x1rad - x2rad;
7778
final double dlat = y1rad - y2rad;
7879
final double a = Math.pow(Math.sin(dlat / 2), 2) + (Math.cos(y1rad) * Math.cos(y2rad) * Math.pow(Math.sin(dlong / 2), 2));
7980
final double c = 2 * Math.asin(Math.sqrt(a));
80-
81+
8182
return GISTool.EARTH_RADIUS_KILOMETERS * c;
8283
}
83-
84+
8485
}

0 commit comments

Comments
 (0)