Skip to content

Commit f430388

Browse files
committed
Merge pull request #15 from mapcode-foundation/dev
Release 2.0.0
2 parents 557d7fa + f9586b3 commit f430388

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1227789
-1173770
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
77
This Java project contains a library to encode latitude/longitude pairs to mapcodes
88
and to decode mapcodes back to latitude/longitude pairs.
99

10-
**Online documentation can be found at: http://mapcode-foundation.github.io/mapcode-java/**
11-
1210
**Release notes can be found at: http://mapcode-foundation.github.io/mapcode-java/ReleaseNotes.html**
1311

12+
**Online documentation can be found at: http://mapcode-foundation.github.io/mapcode-java/**
13+
1414
**An example of how to use this library can be found at: https://github.com/mapcode-foundation/mapcode-java-example**
1515

1616
If you wish to use mapcodes in your own application landscape, consider using running an instance of the

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<artifactId>mapcode</artifactId>
99

1010
<packaging>jar</packaging>
11-
<version>1.50.3</version>
11+
<version>2.0.0-SNAPSHOT</version>
1212

1313
<name>Mapcode Java Library</name>
1414
<description>

src/main/java/com/mapcode/Alphabet.java

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,45 +46,35 @@ public enum Alphabet {
4646
*/
4747
private final int number;
4848

49+
/**
50+
* Private constructor.
51+
*
52+
* @param number Alphabet number, for internal use only.
53+
*/
4954
private Alphabet(final int number) {
5055
this.number = number;
5156
}
5257

53-
public int getNumber() {
54-
return number;
55-
}
56-
5758
/**
58-
* Get an alphabet from a numeric code.
59+
* Get alphabet number. Package private, for internal use only.
5960
*
60-
* @param number Numeric code.
61-
* @return Alphabet.
62-
* @throws UnknownAlphabetException Thrown if code out of range.
61+
* @return Numeric code.
6362
*/
64-
@Nonnull
65-
public static Alphabet fromNumber(final int number) throws UnknownAlphabetException {
66-
if ((number >= 0) && (number < Alphabet.values().length)) {
67-
return Alphabet.values()[number];
68-
}
69-
throw new UnknownAlphabetException(number);
63+
int getNumber() {
64+
return number;
7065
}
7166

7267
/**
7368
* Return alphabet from a string, which can be a numeric or alpha code.
7469
*
75-
* @param numberOrString Alphabet. May be a numeric or alphanumeric code.
70+
* @param alphaCode Alphabet, alphanumeric code.
7671
* @return Alphabet.
7772
* @throws UnknownAlphabetException Thrown if incorrect numeric or alphanumeric code.
7873
*/
7974
@Nonnull
80-
public static Alphabet fromString(@Nonnull final String numberOrString) throws UnknownAlphabetException {
81-
checkNonnull("numberOrString", numberOrString);
82-
final String trimmed = numberOrString.trim().toUpperCase();
83-
try {
84-
return fromNumber(Integer.valueOf(numberOrString));
85-
} catch (final IllegalArgumentException ignored) {
86-
// Ignore. Re-try as alpha code.
87-
}
75+
public static Alphabet fromString(@Nonnull final String alphaCode) throws UnknownAlphabetException {
76+
checkNonnull("alphaCode", alphaCode);
77+
final String trimmed = alphaCode.trim().toUpperCase();
8878
try {
8979
return valueOf(trimmed);
9080
} catch (final IllegalArgumentException ignored) {

src/main/java/com/mapcode/Common.java

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,35 @@
2424
* This class contains common data structures and methods used by the Mapcode implementation.
2525
*/
2626
class Common {
27-
static final int[] nc = {1, 31, 961, 29791, 923521, 28629151, 887503681};
28-
static final int[] xSide = {0, 5, 31, 168, 961, 168 * 31, 29791, 165869, 923521, 5141947};
29-
static final int[] ySide = {0, 6, 31, 176, 961, 176 * 31, 29791, 165869, 923521, 5141947};
30-
private static final int[] xDivider19 = {360, 360, 360, 360, 360, 360, 361, 361, 361, 361, 362, 362, 362, 363,
31-
363, 363, 364, 364, 365, 366, 366, 367, 367, 368, 369, 370, 370, 371, 372, 373, 374, 375, 376, 377, 378,
32-
379, 380, 382, 383, 384, 386, 387, 388, 390, 391, 393, 394, 396, 398, 399, 401, 403, 405, 407, 409, 411, 413,
33-
415, 417, 420, 422, 424, 427, 429, 432, 435, 437, 440, 443, 446, 449, 452, 455, 459, 462, 465, 469, 473,
34-
476, 480, 484, 488, 492, 496, 501, 505, 510, 515, 520, 525, 530, 535, 540, 546, 552, 558, 564, 570, 577, 583,
35-
590, 598, 605, 612, 620, 628, 637, 645, 654, 664, 673, 683, 693, 704, 715, 726, 738, 751, 763, 777, 791,
36-
805, 820, 836, 852, 869, 887, 906, 925, 946, 968, 990, 1014, 1039, 1066, 1094, 1123, 1154, 1187, 1223,
37-
1260, 1300, 1343, 1389, 1438, 1490, 1547, 1609, 1676, 1749, 1828, 1916, 2012, 2118, 2237, 2370, 2521, 2691,
38-
2887, 3114, 3380, 3696, 4077, 4547, 5139, 5910, 6952, 8443, 10747, 14784, 23681, 59485};
27+
static final int[] nc = {
28+
1, 31, 961, 29791, 923521, 28629151, 887503681
29+
};
30+
static final int[] xSide = {
31+
0, 5, 31, 168, 961, 168 * 31, 29791, 165869, 923521, 5141947
32+
};
33+
static final int[] ySide = {
34+
0, 6, 31, 176, 961, 176 * 31, 29791, 165869, 923521, 5141947
35+
};
36+
private static final int[] xDivider19 = {
37+
360, 360, 360, 360, 360, 360, 361, 361, 361, 361,
38+
362, 362, 362, 363, 363, 363, 364, 364, 365, 366,
39+
366, 367, 367, 368, 369, 370, 370, 371, 372, 373,
40+
374, 375, 376, 377, 378, 379, 380, 382, 383, 384,
41+
386, 387, 388, 390, 391, 393, 394, 396, 398, 399,
42+
401, 403, 405, 407, 409, 411, 413, 415, 417, 420,
43+
422, 424, 427, 429, 432, 435, 437, 440, 443, 446,
44+
449, 452, 455, 459, 462, 465, 469, 473, 476, 480,
45+
484, 488, 492, 496, 501, 505, 510, 515, 520, 525,
46+
530, 535, 540, 546, 552, 558, 564, 570, 577, 583,
47+
590, 598, 605, 612, 620, 628, 637, 645, 654, 664,
48+
673, 683, 693, 704, 715, 726, 738, 751, 763, 777,
49+
791, 805, 820, 836, 852, 869, 887, 906, 925, 946,
50+
968, 990, 1014, 1039, 1066, 1094, 1123, 1154, 1187, 1223,
51+
1260, 1300, 1343, 1389, 1438, 1490, 1547, 1609, 1676, 1749,
52+
1828, 1916, 2012, 2118, 2237, 2370, 2521, 2691, 2887, 3114,
53+
3380, 3696, 4077, 4547, 5139, 5910, 6952, 8443, 10747, 14784,
54+
23681, 59485
55+
};
3956

4057
private Common() {
4158
// Prevent instantiation.

src/main/java/com/mapcode/Data.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@
2727
* This class the data class for Mapcode codex items.
2828
*/
2929
class Data {
30-
static final char[] ENCODE_CHARS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C', 'D', 'F',
31-
'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z'};
30+
static final char[] ENCODE_CHARS = {
31+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
32+
'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M',
33+
'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z',
34+
'A', 'E', 'U'
35+
};
3236

3337
private int flags;
3438
private int codex;

src/main/java/com/mapcode/DataAccess.java

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -89,60 +89,61 @@ static int smartDiv(final int i) {
8989
}
9090

9191
private final static int[] DATA_START = {
92-
0, 3, 6, 9, 13, 16, 18, 19, 30, 31,
93-
33, 35, 37, 42, 44, 47, 51, 54, 56, 58,
94-
60, 62, 64, 68, 71, 79, 81, 116, 121, 131,
95-
133, 135, 138, 143, 155, 159, 165, 167, 169, 173,
96-
176, 183, 185, 187, 189, 193, 195, 202, 208, 212,
97-
216, 219, 221, 223, 250, 252, 259, 261, 266, 284,
98-
288, 292, 296, 298, 303, 311, 315, 325, 327, 332,
99-
336, 342, 356, 360, 365, 369, 385, 391, 396, 404,
100-
412, 428, 432, 436, 443, 454, 491, 495, 521, 527,
101-
545, 557, 593, 659, 694, 733, 745, 754, 782, 798,
102-
832, 848, 882, 918, 932, 956, 967, 1022, 1080, 1094,
103-
1155, 1179, 1208, 1276, 1353, 1405, 1484, 1569, 1621, 1696,
104-
1772, 1833, 1875, 1900, 1948, 1991, 2036, 2097, 2183, 2270,
105-
2319, 2382, 2467, 2558, 2643, 2702, 2815, 2912, 3004, 3088,
106-
3186, 3248, 3350, 3416, 3511, 3602, 3688, 3776, 3866, 3973,
107-
4119, 4221, 4325, 4356, 4393, 4468, 4504, 4538, 4574, 4626,
108-
4690, 4741, 4756, 4791, 4931, 5017, 5067, 5143, 5168, 5236,
109-
5293, 5328, 5408, 5459, 5530, 5623, 5658, 5736, 5795, 5861,
110-
5918, 5971, 6028, 6065, 6156, 6285, 6335, 6365, 6417, 6513,
111-
6546, 6627, 6675, 6755, 6798, 6892, 6926, 6971, 7078, 7083,
112-
7155, 7199, 7283, 7323, 7347, 7404, 7490, 7564, 7603, 7690,
113-
7766, 7874, 7952, 8026, 8096, 8153, 8235, 8317, 8376, 8403,
114-
8441, 8495, 8571, 8681, 8761, 8825, 8882, 8936, 9014, 9085,
115-
9171, 9221, 9282, 9426, 9430, 9435, 9440, 9445, 9451, 9456,
116-
9464, 9472, 9483, 9491, 9506, 9515, 9526, 9559, 9568, 9576,
117-
9591, 9601, 9611, 9619, 9627, 9643, 9651, 9661, 9672, 9682,
118-
9692, 9701, 9710, 9721, 9762, 9803, 9821, 9918, 10069, 10160,
119-
10242, 10437, 10440, 10443, 10446, 10456, 10461, 10464, 10476, 10489,
120-
10500, 10516, 10525, 10531, 10565, 10593, 10612, 10680, 10772, 10787,
121-
10791, 10827, 10914, 10925, 10943, 10960, 11024, 11056, 11097, 11117,
122-
11222, 11302, 11366, 11420, 11479, 11535, 11595, 11601, 11643, 11647,
123-
11650, 11660, 11675, 11686, 11724, 11787, 11833, 11838, 11845, 11850,
124-
11869, 11879, 11886, 11894, 11908, 11924, 11931, 11939, 11947, 11995,
125-
12004, 12015, 12065, 12076, 12086, 12105, 12121, 12134, 12146, 12165,
126-
12199, 12208, 12220, 12232, 12236, 12242, 12248, 12260, 12271, 12280,
127-
12286, 12300, 12318, 12329, 12371, 12422, 12472, 12528, 12541, 12554,
128-
12617, 12677, 12738, 12803, 12874, 12939, 13008, 13083, 13150, 13229,
129-
13303, 13317, 13332, 13377, 13390, 13418, 13432, 13445, 13461, 13477,
130-
13489, 13531, 13543, 13554, 13589, 13604, 13616, 13633, 13641, 13679,
131-
13692, 13707, 13827, 13873, 13917, 13957, 13981, 14022, 14061, 14081,
132-
14097, 14115, 14127, 14141, 14149, 14160, 14177, 14190, 14245, 14246,
133-
14247, 14248, 14287, 14293, 14298, 14303, 14308, 14314, 14321, 14327,
134-
14336, 14342, 14350, 14356, 14363, 14372, 14380, 14389, 14401, 14410,
135-
14418, 14429, 14440, 14449, 14459, 14466, 14516, 14550, 14559, 14571,
136-
14582, 14621, 14632, 14646, 14663, 14675, 14688, 14702, 14717, 14730,
137-
14751, 14759, 14778, 14787, 14799, 14810, 14824, 14839, 14852, 14866,
138-
14879, 14893, 14908, 14926, 14946, 14958, 14978, 14991, 15006, 15020,
139-
15038, 15054, 15068, 15081, 15098, 15118, 15135, 15153, 15168, 15182,
140-
15198, 15209, 15225, 15238, 15253, 15268, 15314, 15328, 15337, 15347,
141-
15360, 15374, 15385, 15398, 15414, 15429, 15430, 15457, 15463, 15471,
142-
15477, 15493, 15530, 15547, 15571, 15594, 15611, 15631, 15657, 15683,
143-
15702, 15719, 15772, 15813, 15835, 15862, 15882, 15903, 15921, 15951,
144-
15977, 15997, 16018, 16036, 16054, 16073, 16089, 16105, 16133, 16159,
145-
16166, 16168, 16169, 16201};
92+
0, 3, 6, 10, 14, 17, 19, 20, 31, 32,
93+
34, 36, 38, 43, 45, 48, 52, 59, 63, 65,
94+
67, 71, 73, 81, 87, 95, 97, 132, 139, 149,
95+
151, 153, 156, 161, 173, 181, 188, 190, 192, 197,
96+
200, 207, 212, 214, 216, 220, 222, 229, 235, 239,
97+
243, 246, 250, 252, 281, 283, 290, 292, 297, 317,
98+
325, 329, 333, 335, 340, 348, 353, 364, 368, 373,
99+
377, 386, 400, 404, 409, 413, 429, 435, 440, 448,
100+
456, 472, 476, 480, 487, 498, 535, 539, 565, 571,
101+
589, 601, 637, 703, 738, 777, 789, 798, 826, 842,
102+
876, 892, 926, 962, 991, 1015, 1026, 1081, 1139, 1153,
103+
1215, 1239, 1268, 1336, 1414, 1467, 1546, 1631, 1683, 1758,
104+
1834, 1895, 1937, 1962, 2010, 2053, 2098, 2159, 2245, 2332,
105+
2383, 2446, 2531, 2622, 2707, 2766, 2881, 2984, 3077, 3161,
106+
3259, 3321, 3425, 3491, 3586, 3682, 3768, 3856, 3946, 4053,
107+
4199, 4301, 4405, 4436, 4473, 4550, 4586, 4620, 4656, 4708,
108+
4772, 4823, 4838, 4873, 5020, 5106, 5156, 5232, 5257, 5325,
109+
5382, 5417, 5499, 5550, 5623, 5716, 5751, 5829, 5888, 5954,
110+
6011, 6064, 6121, 6158, 6249, 6380, 6430, 6460, 6512, 6608,
111+
6641, 6722, 6770, 6850, 6893, 6987, 7021, 7066, 7173, 7177,
112+
7249, 7293, 7379, 7419, 7446, 7503, 7589, 7663, 7702, 7789,
113+
7865, 7973, 8051, 8125, 8195, 8252, 8334, 8416, 8475, 8502,
114+
8540, 8594, 8670, 8783, 8863, 8927, 8984, 9038, 9118, 9189,
115+
9275, 9325, 9389, 9533, 9537, 9542, 9547, 9552, 9558, 9563,
116+
9571, 9579, 9590, 9598, 9613, 9622, 9633, 9666, 9675, 9683,
117+
9698, 9708, 9718, 9726, 9734, 9750, 9758, 9768, 9779, 9789,
118+
9799, 9808, 9817, 9828, 9869, 9910, 9928, 10025, 10176, 10267,
119+
10349, 10544, 10547, 10550, 10553, 10563, 10568, 10571, 10583, 10596,
120+
10607, 10623, 10632, 10638, 10672, 10700, 10719, 10787, 10879, 10894,
121+
10898, 10934, 11021, 11032, 11050, 11067, 11131, 11163, 11204, 11224,
122+
11329, 11409, 11473, 11527, 11586, 11642, 11702, 11709, 11751, 11755,
123+
11758, 11768, 11783, 11794, 11832, 11895, 11941, 11946, 11953, 11958,
124+
11977, 11987, 11994, 12002, 12016, 12032, 12039, 12047, 12056, 12104,
125+
12113, 12124, 12174, 12185, 12195, 12214, 12230, 12243, 12255, 12274,
126+
12308, 12317, 12329, 12341, 12345, 12351, 12357, 12369, 12380, 12389,
127+
12395, 12409, 12429, 12440, 12482, 12533, 12583, 12639, 12652, 12665,
128+
12728, 12788, 12849, 12914, 12985, 13050, 13119, 13194, 13262, 13341,
129+
13418, 13432, 13447, 13492, 13505, 13533, 13547, 13560, 13576, 13592,
130+
13604, 13646, 13658, 13669, 13704, 13719, 13731, 13748, 13756, 13794,
131+
13807, 13822, 13942, 13988, 14032, 14072, 14096, 14137, 14176, 14196,
132+
14212, 14230, 14242, 14256, 14264, 14275, 14292, 14305, 14360, 14361,
133+
14362, 14363, 14403, 14409, 14414, 14419, 14424, 14430, 14437, 14443,
134+
14452, 14458, 14466, 14472, 14479, 14488, 14496, 14505, 14517, 14526,
135+
14534, 14545, 14556, 14565, 14575, 14582, 14632, 14666, 14675, 14687,
136+
14698, 14737, 14748, 14762, 14779, 14791, 14804, 14818, 14833, 14846,
137+
14867, 14875, 14894, 14903, 14915, 14926, 14940, 14955, 14968, 14982,
138+
14995, 15009, 15024, 15042, 15062, 15074, 15094, 15107, 15122, 15136,
139+
15154, 15170, 15184, 15197, 15214, 15234, 15251, 15269, 15284, 15298,
140+
15314, 15325, 15341, 15354, 15369, 15384, 15430, 15444, 15453, 15463,
141+
15476, 15490, 15501, 15514, 15530, 15545, 15546, 15573, 15579, 15587,
142+
15593, 15609, 15646, 15663, 15687, 15710, 15727, 15747, 15773, 15799,
143+
15818, 15835, 15888, 15929, 15951, 15978, 15998, 16019, 16037, 16068,
144+
16094, 16114, 16135, 16153, 16171, 16190, 16206, 16222, 16276, 16302,
145+
16309, 16311, 16312, 16344
146+
};
146147

147148
// / low-level routines for data access
148149
static int dataFirstRecord(final int ccode) {

src/main/java/com/mapcode/Decoder.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,23 @@ static Point decode(@Nonnull final String argMapcode,
175175
private static final int CCODE_EARTH = 540;
176176

177177
private final static int[] DECODE_CHARS = {
178-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
179-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
180-
-1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -2, 10, 11, 12, -3, 13, 14, 15,
181-
1, 16, 17, 18, 19, 20, 0, 21, 22, 23, 24, 25, -4, 26, 27, 28, 29, 30, -1, -1, -1, -1, -1, -1, -2, 10, 11,
182-
12, -3, 13, 14, 15, 1, 16, 17, 18, 19, 20, 0, 21, 22, 23, 24, 25, -4, 26, 27, 28, 29, 30, -1, -1, -1, -1,
183-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
184-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
185-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
186-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
187-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
178+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
179+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
180+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
181+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
182+
-1, -2, 10, 11, 12, -3, 13, 14, 15, 1, 16, 17, 18, 19, 20, 0,
183+
21, 22, 23, 24, 25, -4, 26, 27, 28, 29, 30, -1, -1, -1, -1, -1,
184+
-1, -2, 10, 11, 12, -3, 13, 14, 15, 1, 16, 17, 18, 19, 20, 0,
185+
21, 22, 23, 24, 25, -4, 26, 27, 28, 29, 30, -1, -1, -1, -1, -1,
186+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
187+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
188+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
189+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
190+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
191+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
192+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
193+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
194+
};
188195

189196
private static class Unicode2Ascii {
190197

@@ -540,7 +547,7 @@ private static String aeuUnpack(final String argStr) {
540547
if (v2 < 0) {
541548
v2 = 31;
542549
}
543-
String s = String.valueOf(1000 + v1 + (32 * v2));
550+
final String s = String.valueOf(1000 + v1 + (32 * v2));
544551
str = s.charAt(1) + str.substring(1, lastpos - 1) + s.charAt(2) + s.charAt(3);
545552
voweled = true;
546553
} else if (str.charAt(0) == 'U') { // v.1.50 debug decoding of U+alldigitmapcode
@@ -644,7 +651,7 @@ static String decodeUTF16(final String mapcode) {
644651
return result;
645652
}
646653

647-
static String encodeUTF16(final String mapcode, int alphabetCode) throws IllegalArgumentException {
654+
static String encodeUTF16(final String mapcode, final int alphabetCode) throws IllegalArgumentException {
648655
final String mapcodeToEncode;
649656
if (ASCII2LANGUAGE[alphabetCode][4] == MISSCODE) {
650657

src/main/java/com/mapcode/Encoder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ private static List<Mapcode> encode(final double argLatDeg, final double argLonD
6565
argLatDeg, argLonDeg, (territory == null) ? null : territory.name(), isRecursive, limitToOneResult,
6666
allowWorld);
6767

68-
double latDeg = Point.mapToLat(argLatDeg);
69-
double lonDeg = Point.mapToLon(argLonDeg);
68+
final double latDeg = Point.mapToLat(argLatDeg);
69+
final double lonDeg = Point.mapToLon(argLonDeg);
7070
Territory stateOverride = argStateOverride;
7171

7272
final Point pointToEncode = Point.fromDeg(latDeg, lonDeg);

0 commit comments

Comments
 (0)