5
5
import java .util .Map ;
6
6
7
7
/**
8
- * Representation of open location code.
9
- * https://github.com/google/open-location-code
10
- * The OpenLocationCode class is a wrapper around String value {@code code}, which guarantees that
11
- * the value is a valid Open Location Code.
8
+ * Representation of open location code. https://github.com/google/open-location-code The
9
+ * OpenLocationCode class is a wrapper around String value {@code code}, which guarantees that the
10
+ * value is a valid Open Location Code.
12
11
*
13
12
* @author Jiri Semecky
14
13
*/
@@ -38,9 +37,7 @@ public class OpenLocationCode {
38
37
private static final char SEPARATOR_POSITION = 8 ;
39
38
private static final char SUFFIX_PADDING = '0' ;
40
39
41
- /**
42
- * Class providing information about area covered by Open Location Code.
43
- */
40
+ /** Class providing information about area covered by Open Location Code. */
44
41
public class CodeArea {
45
42
46
43
private final BigDecimal southLatitude ;
@@ -93,14 +90,10 @@ public double getEastLongitude() {
93
90
}
94
91
95
92
96
- /**
97
- * The state of the OpenLocationCode.
98
- */
93
+ /** The state of the OpenLocationCode. */
99
94
private final String code ;
100
95
101
- /**
102
- * Creates Open Location Code for the provided code.
103
- */
96
+ /** Creates Open Location Code for the provided code. */
104
97
public OpenLocationCode (String code ) {
105
98
if (!isValidCode (code )) {
106
99
throw new IllegalArgumentException (
@@ -109,9 +102,7 @@ public OpenLocationCode(String code) {
109
102
this .code = code .toUpperCase ();
110
103
}
111
104
112
- /**
113
- * Creates Open Location Code from the provided latitude, longitude and desired code length.
114
- */
105
+ /** Creates Open Location Code from the provided latitude, longitude and desired code length. */
115
106
public OpenLocationCode (double latitude , double longitude , int codeLength )
116
107
throws IllegalArgumentException {
117
108
if (codeLength < 4 || (codeLength < 10 & codeLength % 2 == 1 )) {
@@ -178,9 +169,7 @@ public OpenLocationCode(double latitude, double longitude, int codeLength)
178
169
this .code = codeBuilder .toString ();
179
170
}
180
171
181
- /**
182
- * Creates Open Location Code with code length 10 from the provided latitude, longitude.
183
- */
172
+ /** Creates Open Location Code with code length 10 from the provided latitude, longitude. */
184
173
public OpenLocationCode (double latitude , double longitude ) {
185
174
this (latitude , longitude , 10 );
186
175
}
@@ -267,30 +256,22 @@ public static CodeArea decode(String code) throws IllegalArgumentException {
267
256
return new OpenLocationCode (code ).decode ();
268
257
}
269
258
270
- /**
271
- * Returns whether this {@link OpenLocationCode} is a full Open Location Code.
272
- */
259
+ /** Returns whether this {@link OpenLocationCode} is a full Open Location Code. */
273
260
public boolean isFull () {
274
261
return code .indexOf (SEPARATOR ) == SEPARATOR_POSITION ;
275
262
}
276
263
277
- /**
278
- * Returns whether the provided Open Location Code is a full Open Location Code.
279
- */
264
+ /** Returns whether the provided Open Location Code is a full Open Location Code. */
280
265
public static boolean isFull (String code ) throws IllegalArgumentException {
281
266
return new OpenLocationCode (code ).isFull ();
282
267
}
283
268
284
- /**
285
- * Returns whether this {@link OpenLocationCode} is a short Open Location Code.
286
- */
269
+ /** Returns whether this {@link OpenLocationCode} is a short Open Location Code. */
287
270
public boolean isShort () {
288
271
return code .indexOf (SEPARATOR ) >= 0 && code .indexOf (SEPARATOR ) < SEPARATOR_POSITION ;
289
272
}
290
273
291
- /**
292
- * Returns whether the provided Open Location Code is a short Open Location Code.
293
- */
274
+ /** Returns whether the provided Open Location Code is a short Open Location Code. */
294
275
public static boolean isShort (String code ) throws IllegalArgumentException {
295
276
return new OpenLocationCode (code ).isShort ();
296
277
}
@@ -423,9 +404,7 @@ public String toString() {
423
404
424
405
// Exposed static helper methods.
425
406
426
- /**
427
- * Returns whether the provided string is a valid Open Location code.
428
- */
407
+ /** Returns whether the provided string is a valid Open Location code. */
429
408
public static boolean isValidCode (String code ) {
430
409
if (code == null || code .length () < 2 ) {
431
410
return false ;
@@ -502,9 +481,7 @@ public static boolean isValidCode(String code) {
502
481
return true ;
503
482
}
504
483
505
- /**
506
- * Returns if the code is a valid full Open Location Code.
507
- */
484
+ /** Returns if the code is a valid full Open Location Code. */
508
485
public static boolean isFullCode (String code ) {
509
486
try {
510
487
return new OpenLocationCode (code ).isFull ();
@@ -513,9 +490,7 @@ public static boolean isFullCode(String code) {
513
490
}
514
491
}
515
492
516
- /**
517
- * Returns if the code is a valid short Open Location Code.
518
- */
493
+ /** Returns if the code is a valid short Open Location Code. */
519
494
public static boolean isShortCode (String code ) {
520
495
try {
521
496
return new OpenLocationCode (code ).isShort ();
0 commit comments