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

Skip to content

Commit 976c1db

Browse files
committed
fix code format
1 parent 07aae6f commit 976c1db

32 files changed

+521
-742
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/**
2727
* Derive this class to implement a listener for location updates which reacts to changes greater a given threshold
28-
*
28+
*
2929
* @author thoeger
3030
*/
3131
public abstract class DistanceListener extends ObjectListener {
@@ -34,10 +34,8 @@ public abstract class DistanceListener extends ObjectListener {
3434

3535
private final double threshold;
3636

37-
3837
/**
39-
* @param threshold
40-
* the threshold to fire in kilometers
38+
* @param threshold the threshold to fire in kilometers
4139
*/
4240
public DistanceListener(final double threshold) {
4341
this.threshold = threshold;

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,38 @@
2929

3030
/**
3131
* Listener to receive response objects
32-
*
32+
*
3333
* @author thoeger
3434
*/
3535
public interface IObjectListener {
3636

3737
/**
38-
* @param tpv
39-
* the TPV object
38+
* @param tpv the TPV object
4039
*/
4140
void handleTPV(TPVObject tpv);
4241

4342
/**
44-
* @param sky
45-
* the SKY object
43+
* @param sky the SKY object
4644
*/
4745
void handleSKY(SKYObject sky);
4846

4947
/**
50-
* @param att
51-
* the ATT object
48+
* @param att the ATT object
5249
*/
5350
void handleATT(ATTObject att);
5451

5552
/**
56-
* @param subframe
57-
* the SUBFRAME object
53+
* @param subframe the SUBFRAME object
5854
*/
5955
void handleSUBFRAME(SUBFRAMEObject subframe);
6056

6157
/**
62-
* @param devices
63-
* the devices object
58+
* @param devices the devices object
6459
*/
6560
void handleDevices(DevicesObject devices);
6661

6762
/**
68-
* @param device
69-
* the device object
63+
* @param device the device object
7064
*/
7165
void handleDevice(DeviceObject device);
7266

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/**
3131
* Adapter class for {@link IObjectListener}
32-
*
32+
*
3333
* @author thoeger
3434
*/
3535
public class ObjectListener implements IObjectListener {

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import de.taimos.gpsd4java.types.ParseException;
3838

3939
/**
40-
*
4140
* @author irakli, thoeger
4241
*/
4342
public abstract class AbstractResultParser {
@@ -46,7 +45,6 @@ public abstract class AbstractResultParser {
4645

4746
protected final DateFormat dateFormat; // Don't make this static!
4847

49-
5048
/**
5149
* Create new ResultParser
5250
*/
@@ -57,12 +55,10 @@ public AbstractResultParser() {
5755

5856
/**
5957
* Parse a received line into a {@link IGPSObject}
60-
*
61-
* @param line
62-
* the line read from GPSd
58+
*
59+
* @param line the line read from GPSd
6360
* @return the parsed object
64-
* @throws ParseException
65-
* if parsing fails
61+
* @throws ParseException if parsing fails
6662
*/
6763
public IGPSObject parse(final String line) throws ParseException {
6864
try {

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

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,23 @@
2424

2525
/**
2626
* This class provides tools to measure the distance between two locations in WGS84 coordinates
27-
*
27+
*
2828
* @author thoeger
2929
*/
3030
public final class GISTool {
3131

3232
private static final int EARTH_RADIUS_KILOMETERS = 6371;
3333

34-
3534
private GISTool() {
3635
//
3736
}
3837

3938
/**
4039
* calculates the distance between two {@link TPVObject} in kilometers<br>
4140
* the method used is the great-circle-distance with hypersine formula
42-
*
43-
* @param tpv1
44-
* - position 1
45-
* @param tpv2
46-
* - position 2
41+
*
42+
* @param tpv1 - position 1
43+
* @param tpv2 - position 2
4744
* @return distance in kilometers
4845
*/
4946
public static double getDistance(final TPVObject tpv1, final TPVObject tpv2) {
@@ -53,15 +50,11 @@ public static double getDistance(final TPVObject tpv1, final TPVObject tpv2) {
5350
/**
5451
* calculates the distance between two locations, which are given as coordinates, in kilometers<br>
5552
* the method used is the great-circle-distance with hypersine formula
56-
*
57-
* @param x1
58-
* - longitude of position 1
59-
* @param x2
60-
* - longitude of position 2
61-
* @param y1
62-
* - latitude of position 1
63-
* @param y2
64-
* - latitude of position 2
53+
*
54+
* @param x1 - longitude of position 1
55+
* @param x2 - longitude of position 2
56+
* @param y1 - latitude of position 1
57+
* @param y2 - latitude of position 2
6558
* @return distance in kilometers
6659
*/
6760
public static double getDistance(final double x1, final double x2, final double y1, final double y2) {

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

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
/**
5252
* GPSd client endpoint
53-
*
53+
*
5454
* @author thoeger
5555
*/
5656
public class GPSdEndpoint {
@@ -74,22 +74,20 @@ public class GPSdEndpoint {
7474
private final Object asyncWaitMutex = new Object();
7575

7676
private final AbstractResultParser resultParser;
77-
77+
7878
private String server;
79-
79+
8080
private int port;
81-
81+
8282
private String lastWatch;
8383

8484
private AtomicLong retryInterval = new AtomicLong(1000);
8585

8686
/**
8787
* Instantiate this class to connect to a GPSd server
88-
*
89-
* @param server
90-
* the server name or IP
91-
* @param port
92-
* the server port
88+
*
89+
* @param server the server name or IP
90+
* @param port the server port
9391
* @param resultParser
9492
* @throws UnknownHostException
9593
* @throws IOException
@@ -151,14 +149,11 @@ public void stop() {
151149

152150
/**
153151
* send WATCH command
154-
*
155-
* @param enable
156-
* enable/disable watch mode
157-
* @param dumpData
158-
* enable/disable dumping of data
152+
*
153+
* @param enable enable/disable watch mode
154+
* @param dumpData enable/disable dumping of data
159155
* @return {@link WatchObject}
160-
* @throws IOException
161-
* on IO error in socket
156+
* @throws IOException on IO error in socket
162157
* @throws JSONException
163158
*/
164159
public WatchObject watch(final boolean enable, final boolean dumpData) throws IOException, JSONException {
@@ -167,16 +162,12 @@ public WatchObject watch(final boolean enable, final boolean dumpData) throws IO
167162

168163
/**
169164
* send WATCH command
170-
*
171-
* @param enable
172-
* enable/disable watch mode
173-
* @param dumpData
174-
* enable/disable dumping of data
175-
* @param device
176-
* If present, enable watching only of the specified device rather than all devices
165+
*
166+
* @param enable enable/disable watch mode
167+
* @param dumpData enable/disable dumping of data
168+
* @param device If present, enable watching only of the specified device rather than all devices
177169
* @return {@link WatchObject}
178-
* @throws IOException
179-
* on IO error in socket
170+
* @throws IOException on IO error in socket
180171
* @throws JSONException
181172
*/
182173
public WatchObject watch(final boolean enable, final boolean dumpData, final String device) throws IOException, JSONException {
@@ -192,39 +183,36 @@ public WatchObject watch(final boolean enable, final boolean dumpData, final Str
192183

193184
/**
194185
* Poll GPSd for Message
195-
*
186+
*
196187
* @return {@link PollObject}
197-
* @throws IOException
198-
* on IO error in socket
188+
* @throws IOException on IO error in socket
199189
*/
200190
public PollObject poll() throws IOException {
201191
return this.syncCommand("?POLL;", PollObject.class);
202192
}
203193

204194
/**
205195
* Poll GPSd version
206-
*
196+
*
207197
* @return {@link VersionObject}
208-
* @throws IOException
209-
* on IO error in socket
198+
* @throws IOException on IO error in socket
210199
*/
211200
public VersionObject version() throws IOException {
212201
return this.syncCommand("?VERSION;", VersionObject.class);
213202
}
214203

215204
// TODO implement rest of commands
216205
// ########################################################
206+
217207
/**
218-
* @param listener
219-
* the listener to add
208+
* @param listener the listener to add
220209
*/
221210
public void addListener(final IObjectListener listener) {
222211
this.listeners.add(listener);
223212
}
224213

225214
/**
226-
* @param listener
227-
* the listener to remove
215+
* @param listener the listener to remove
228216
*/
229217
public void removeListener(final IObjectListener listener) {
230218
this.listeners.remove(listener);
@@ -239,8 +227,8 @@ private <T extends IGPSObject> T syncCommand(final String command, final Class<T
239227
synchronized (this.asyncMutex) {
240228
this.out.write(command + "\n");
241229
this.out.flush();
242-
if( responseClass == WatchObject.class ){
243-
lastWatch=command;
230+
if (responseClass == WatchObject.class) {
231+
lastWatch = command;
244232
}
245233
while (true) {
246234
// wait for awaited message
@@ -320,9 +308,9 @@ void handle(final IGPSObject object) {
320308

321309
/**
322310
* Attempt to kick a failed device back into life on gpsd server.
323-
*
311+
* <p>
324312
* see: https://lists.gnu.org/archive/html/gpsd-dev/2015-06/msg00001.html
325-
*
313+
*
326314
* @param path Path of device known to gpsd
327315
* @throws IOException
328316
* @throws JSONException
@@ -333,16 +321,16 @@ public void kickDevice(String path) throws IOException, JSONException {
333321
d.put("path", path);
334322
this.voidCommand("?DEVICE=" + d);
335323
}
336-
324+
337325
/**
338326
* Our socket thread got disconnect and is exiting.
339327
*/
340-
void handleDisconnected() throws IOException{
328+
void handleDisconnected() throws IOException {
341329
synchronized (this.asyncMutex) {
342330
socket.close();
343331
this.socket = new Socket(server, port);
344332
this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
345-
this.out = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream()));
333+
this.out = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream()));
346334

347335
this.listenThread = new SocketThread(this.in, this, this.resultParser);
348336
this.listenThread.start();
@@ -352,13 +340,14 @@ void handleDisconnected() throws IOException{
352340
}
353341

354342
}
343+
355344
/**
356345
* Set a retry interval for reconnecting to GPSD if the socket closes.
357346
* Default value is 1000ms.
358-
*
347+
*
359348
* @param millis how long to wait between each reconnection attempts.
360349
*/
361-
public void setRetryInterval(long millis){
350+
public void setRetryInterval(long millis) {
362351
retryInterval.set(millis);
363352
}
364353

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848

4949
/**
5050
* This class is used to parse responses from GPSd<br>
51-
*
51+
*
5252
* @author thoeger
5353
*/
5454
public class LegacyResultParser extends AbstractResultParser {
5555

5656
/**
5757
* parse {@link JSONObject} into {@link IGPSObject}
58-
*
59-
* @param json
60-
* the {@link JSONObject} to parse
58+
*
59+
* @param json the {@link JSONObject} to parse
6160
* @return the parsed object
62-
* @throws ParseException
63-
* if parsing fails
61+
* @throws ParseException if parsing fails
6462
*/
6563
@Override
6664
public IGPSObject parse(final JSONObject json) throws ParseException {

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848

4949
/**
5050
* This class is used to parse responses from GPSd<br>
51-
*
51+
*
5252
* @author thoeger
5353
*/
5454
public class ResultParser extends AbstractResultParser {
5555

5656
/**
5757
* parse {@link JSONObject} into {@link IGPSObject}
58-
*
59-
* @param json
60-
* the {@link JSONObject} to parse
58+
*
59+
* @param json the {@link JSONObject} to parse
6160
* @return the parsed object
62-
* @throws ParseException
63-
* if parsing fails
61+
* @throws ParseException if parsing fails
6462
*/
6563
@Override
6664
public IGPSObject parse(final JSONObject json) throws ParseException {

0 commit comments

Comments
 (0)