Skip to content

Commit de36c39

Browse files
committed
Reformatted 1
1 parent b17e248 commit de36c39

14 files changed

+289
-300
lines changed

src/main/java/com/mapcode/CheckArgs.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ private CheckArgs() {
2929
}
3030

3131
static void checkRange(@Nonnull final String param, final double value,
32-
final double min, final double max) throws IllegalArgumentException {
32+
final double min, final double max) throws IllegalArgumentException {
3333
if ((value < min) || (value > max)) {
3434
throw new IllegalArgumentException("Parameter " + param +
35-
" should be in range [" + min + ", " + max + "], but is: " + value);
35+
" should be in range [" + min + ", " + max + "], but is: " + value);
3636
}
3737
}
3838

3939
static void checkNonnull(@Nonnull final String param, @Nullable final Object obj)
40-
throws IllegalArgumentException {
40+
throws IllegalArgumentException {
4141
if (obj == null) {
4242
throw new IllegalArgumentException("Parameter " + param + " should not be null");
4343
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020
* ----------------------------------------------------------------------------------------------
2121
* Package private implementation class. For internal use within the Mapcode implementation only.
2222
* ----------------------------------------------------------------------------------------------
23-
*
23+
* <p/>
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};
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};
3030
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};
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};
3939

4040
private Common() {
4141
// Prevent instantiation.

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,28 @@
2323
* ----------------------------------------------------------------------------------------------
2424
* Package private implementation class. For internal use within the Mapcode implementation only.
2525
* ----------------------------------------------------------------------------------------------
26-
*
26+
* <p/>
2727
* This class the data class for Mapcode codex items.
2828
*/
2929
class Data {
3030
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'};
32-
33-
private int flags;
34-
private int codex;
35-
private int codexLo;
36-
private int codexHi;
37-
private int codexLen;
38-
private boolean nameless;
39-
private boolean useless;
40-
private boolean specialShape;
41-
private int pipeType;
42-
@Nullable private String pipeLetter;
43-
private boolean starPipe;
44-
@Nullable private SubArea mapcoderRect;
45-
private boolean initialized;
31+
'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z'};
32+
33+
private int flags;
34+
private int codex;
35+
private int codexLo;
36+
private int codexHi;
37+
private int codexLen;
38+
private boolean nameless;
39+
private boolean useless;
40+
private boolean specialShape;
41+
private int pipeType;
42+
@Nullable
43+
private String pipeLetter;
44+
private boolean starPipe;
45+
@Nullable
46+
private SubArea mapcoderRect;
47+
private boolean initialized;
4648

4749
int getFlags() {
4850
assert initialized;
@@ -128,8 +130,7 @@ void dataSetup(final int i) {
128130
pipeType = (flags >> 5) & 12; // 4=pipe 8=plus 12=star
129131
if (pipeType == 4) {
130132
pipeLetter = Character.toString(ENCODE_CHARS[(flags >> 11) & 31]);
131-
}
132-
else {
133+
} else {
133134
pipeLetter = "";
134135
}
135136
if ((codex == 21) && !nameless) {

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

Lines changed: 62 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* ----------------------------------------------------------------------------------------------
2525
* Package private implementation class. For internal use within the Mapcode implementation only.
2626
* ----------------------------------------------------------------------------------------------
27-
*
27+
* <p/>
2828
* This class contains the module that reads the Mapcode areas into memory and processes them.
2929
*/
3030
class DataAccess {
@@ -46,17 +46,14 @@ class DataAccess {
4646
inputStream.close();
4747
outputStream.close();
4848
initialized = true;
49-
}
50-
catch (final IOException e) {
49+
} catch (final IOException e) {
5150
throw new ExceptionInInitializerError(e);
52-
}
53-
finally {
51+
} finally {
5452
try {
5553
if (inputStream != null) {
5654
inputStream.close();
5755
}
58-
}
59-
catch (final IOException ignored) {
56+
} catch (final IOException ignored) {
6057
// Ignore.
6158
}
6259
}
@@ -83,71 +80,71 @@ static int dataFlags(final int i) {
8380

8481
static int asLong(final int i) {
8582
return asUnsignedByte(i) +
86-
(asUnsignedByte(i + 1) << 8) +
87-
(asUnsignedByte(i + 2) << 16) +
88-
(asUnsignedByte(i + 3) << 24);
83+
(asUnsignedByte(i + 1) << 8) +
84+
(asUnsignedByte(i + 2) << 16) +
85+
(asUnsignedByte(i + 3) << 24);
8986
}
9087

9188
static int smartDiv(final int i) {
9289
return asUnsignedByte((i * 20) + 18) + (asUnsignedByte((i * 20) + 19) * 256);
9390
}
9491

9592
private final static int[] DATA_START = {
96-
0, 3, 6, 9, 13, 16, 18, 19, 30, 31,
97-
33, 35, 37, 42, 44, 47, 51, 54, 56, 58,
98-
60, 62, 64, 68, 71, 79, 81, 116, 121, 131,
99-
133, 135, 138, 143, 155, 159, 165, 167, 169, 173,
100-
176, 183, 185, 187, 189, 193, 195, 202, 208, 212,
101-
216, 219, 221, 223, 250, 252, 259, 261, 266, 284,
102-
288, 292, 296, 298, 303, 311, 315, 325, 327, 332,
103-
336, 342, 356, 360, 365, 369, 385, 391, 396, 404,
104-
412, 428, 432, 436, 443, 454, 491, 495, 521, 527,
105-
545, 557, 593, 659, 694, 733, 745, 754, 782, 798,
106-
832, 848, 882, 918, 932, 956, 967, 1022, 1080, 1094,
107-
1155, 1179, 1208, 1276, 1353, 1405, 1484, 1569, 1621, 1696,
108-
1772, 1833, 1875, 1900, 1948, 1991, 2036, 2097, 2183, 2270,
109-
2319, 2382, 2467, 2558, 2643, 2702, 2815, 2912, 3004, 3088,
110-
3186, 3248, 3350, 3416, 3511, 3602, 3688, 3776, 3866, 3973,
111-
4119, 4221, 4325, 4356, 4393, 4468, 4504, 4538, 4574, 4626,
112-
4690, 4741, 4756, 4791, 4931, 5017, 5067, 5143, 5168, 5236,
113-
5293, 5328, 5408, 5459, 5530, 5623, 5658, 5736, 5795, 5861,
114-
5918, 5971, 6028, 6065, 6156, 6285, 6335, 6365, 6417, 6513,
115-
6546, 6627, 6675, 6755, 6798, 6892, 6926, 6971, 7078, 7083,
116-
7155, 7199, 7283, 7323, 7347, 7404, 7490, 7564, 7603, 7690,
117-
7766, 7874, 7952, 8026, 8096, 8153, 8235, 8317, 8376, 8403,
118-
8441, 8495, 8571, 8681, 8761, 8825, 8882, 8936, 9014, 9085,
119-
9171, 9221, 9282, 9426, 9430, 9435, 9440, 9445, 9451, 9456,
120-
9464, 9472, 9483, 9491, 9506, 9515, 9526, 9559, 9568, 9576,
121-
9591, 9601, 9611, 9619, 9627, 9643, 9651, 9661, 9672, 9682,
122-
9692, 9701, 9710, 9721, 9762, 9803, 9821, 9918, 10069, 10160,
123-
10242, 10437, 10440, 10443, 10446, 10456, 10461, 10464, 10476, 10489,
124-
10500, 10516, 10525, 10531, 10565, 10593, 10612, 10680, 10772, 10787,
125-
10791, 10827, 10914, 10925, 10943, 10960, 11024, 11056, 11097, 11117,
126-
11222, 11302, 11366, 11420, 11479, 11535, 11595, 11601, 11643, 11647,
127-
11650, 11660, 11675, 11686, 11724, 11787, 11833, 11838, 11845, 11850,
128-
11869, 11879, 11886, 11894, 11908, 11924, 11931, 11939, 11947, 11995,
129-
12004, 12015, 12065, 12076, 12086, 12105, 12121, 12134, 12146, 12165,
130-
12199, 12208, 12220, 12232, 12236, 12242, 12248, 12260, 12271, 12280,
131-
12286, 12300, 12318, 12329, 12371, 12422, 12472, 12528, 12541, 12554,
132-
12617, 12677, 12738, 12803, 12874, 12939, 13008, 13083, 13150, 13229,
133-
13303, 13317, 13332, 13377, 13390, 13418, 13432, 13445, 13461, 13477,
134-
13489, 13531, 13543, 13554, 13589, 13604, 13616, 13633, 13641, 13679,
135-
13692, 13707, 13827, 13873, 13917, 13957, 13981, 14022, 14061, 14081,
136-
14097, 14115, 14127, 14141, 14149, 14160, 14177, 14190, 14245, 14246,
137-
14247, 14248, 14287, 14293, 14298, 14303, 14308, 14314, 14321, 14327,
138-
14336, 14342, 14350, 14356, 14363, 14372, 14380, 14389, 14401, 14410,
139-
14418, 14429, 14440, 14449, 14459, 14466, 14516, 14550, 14559, 14571,
140-
14582, 14621, 14632, 14646, 14663, 14675, 14688, 14702, 14717, 14730,
141-
14751, 14759, 14778, 14787, 14799, 14810, 14824, 14839, 14852, 14866,
142-
14879, 14893, 14908, 14926, 14946, 14958, 14978, 14991, 15006, 15020,
143-
15038, 15054, 15068, 15081, 15098, 15118, 15135, 15153, 15168, 15182,
144-
15198, 15209, 15225, 15238, 15253, 15268, 15314, 15328, 15337, 15347,
145-
15360, 15374, 15385, 15398, 15414, 15429, 15430, 15457, 15463, 15471,
146-
15477, 15493, 15530, 15547, 15571, 15594, 15611, 15631, 15657, 15683,
147-
15702, 15719, 15772, 15813, 15835, 15862, 15882, 15903, 15921, 15951,
148-
15977, 15997, 16018, 16036, 16054, 16073, 16089, 16105, 16133, 16159,
149-
16166, 16168, 16169, 16171, 16172, 16174, 16176, 16178, 16180, 16182,
150-
16183, 16184, 16216};
93+
0, 3, 6, 9, 13, 16, 18, 19, 30, 31,
94+
33, 35, 37, 42, 44, 47, 51, 54, 56, 58,
95+
60, 62, 64, 68, 71, 79, 81, 116, 121, 131,
96+
133, 135, 138, 143, 155, 159, 165, 167, 169, 173,
97+
176, 183, 185, 187, 189, 193, 195, 202, 208, 212,
98+
216, 219, 221, 223, 250, 252, 259, 261, 266, 284,
99+
288, 292, 296, 298, 303, 311, 315, 325, 327, 332,
100+
336, 342, 356, 360, 365, 369, 385, 391, 396, 404,
101+
412, 428, 432, 436, 443, 454, 491, 495, 521, 527,
102+
545, 557, 593, 659, 694, 733, 745, 754, 782, 798,
103+
832, 848, 882, 918, 932, 956, 967, 1022, 1080, 1094,
104+
1155, 1179, 1208, 1276, 1353, 1405, 1484, 1569, 1621, 1696,
105+
1772, 1833, 1875, 1900, 1948, 1991, 2036, 2097, 2183, 2270,
106+
2319, 2382, 2467, 2558, 2643, 2702, 2815, 2912, 3004, 3088,
107+
3186, 3248, 3350, 3416, 3511, 3602, 3688, 3776, 3866, 3973,
108+
4119, 4221, 4325, 4356, 4393, 4468, 4504, 4538, 4574, 4626,
109+
4690, 4741, 4756, 4791, 4931, 5017, 5067, 5143, 5168, 5236,
110+
5293, 5328, 5408, 5459, 5530, 5623, 5658, 5736, 5795, 5861,
111+
5918, 5971, 6028, 6065, 6156, 6285, 6335, 6365, 6417, 6513,
112+
6546, 6627, 6675, 6755, 6798, 6892, 6926, 6971, 7078, 7083,
113+
7155, 7199, 7283, 7323, 7347, 7404, 7490, 7564, 7603, 7690,
114+
7766, 7874, 7952, 8026, 8096, 8153, 8235, 8317, 8376, 8403,
115+
8441, 8495, 8571, 8681, 8761, 8825, 8882, 8936, 9014, 9085,
116+
9171, 9221, 9282, 9426, 9430, 9435, 9440, 9445, 9451, 9456,
117+
9464, 9472, 9483, 9491, 9506, 9515, 9526, 9559, 9568, 9576,
118+
9591, 9601, 9611, 9619, 9627, 9643, 9651, 9661, 9672, 9682,
119+
9692, 9701, 9710, 9721, 9762, 9803, 9821, 9918, 10069, 10160,
120+
10242, 10437, 10440, 10443, 10446, 10456, 10461, 10464, 10476, 10489,
121+
10500, 10516, 10525, 10531, 10565, 10593, 10612, 10680, 10772, 10787,
122+
10791, 10827, 10914, 10925, 10943, 10960, 11024, 11056, 11097, 11117,
123+
11222, 11302, 11366, 11420, 11479, 11535, 11595, 11601, 11643, 11647,
124+
11650, 11660, 11675, 11686, 11724, 11787, 11833, 11838, 11845, 11850,
125+
11869, 11879, 11886, 11894, 11908, 11924, 11931, 11939, 11947, 11995,
126+
12004, 12015, 12065, 12076, 12086, 12105, 12121, 12134, 12146, 12165,
127+
12199, 12208, 12220, 12232, 12236, 12242, 12248, 12260, 12271, 12280,
128+
12286, 12300, 12318, 12329, 12371, 12422, 12472, 12528, 12541, 12554,
129+
12617, 12677, 12738, 12803, 12874, 12939, 13008, 13083, 13150, 13229,
130+
13303, 13317, 13332, 13377, 13390, 13418, 13432, 13445, 13461, 13477,
131+
13489, 13531, 13543, 13554, 13589, 13604, 13616, 13633, 13641, 13679,
132+
13692, 13707, 13827, 13873, 13917, 13957, 13981, 14022, 14061, 14081,
133+
14097, 14115, 14127, 14141, 14149, 14160, 14177, 14190, 14245, 14246,
134+
14247, 14248, 14287, 14293, 14298, 14303, 14308, 14314, 14321, 14327,
135+
14336, 14342, 14350, 14356, 14363, 14372, 14380, 14389, 14401, 14410,
136+
14418, 14429, 14440, 14449, 14459, 14466, 14516, 14550, 14559, 14571,
137+
14582, 14621, 14632, 14646, 14663, 14675, 14688, 14702, 14717, 14730,
138+
14751, 14759, 14778, 14787, 14799, 14810, 14824, 14839, 14852, 14866,
139+
14879, 14893, 14908, 14926, 14946, 14958, 14978, 14991, 15006, 15020,
140+
15038, 15054, 15068, 15081, 15098, 15118, 15135, 15153, 15168, 15182,
141+
15198, 15209, 15225, 15238, 15253, 15268, 15314, 15328, 15337, 15347,
142+
15360, 15374, 15385, 15398, 15414, 15429, 15430, 15457, 15463, 15471,
143+
15477, 15493, 15530, 15547, 15571, 15594, 15611, 15631, 15657, 15683,
144+
15702, 15719, 15772, 15813, 15835, 15862, 15882, 15903, 15921, 15951,
145+
15977, 15997, 16018, 16036, 16054, 16073, 16089, 16105, 16133, 16159,
146+
16166, 16168, 16169, 16171, 16172, 16174, 16176, 16178, 16180, 16182,
147+
16183, 16184, 16216};
151148

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

0 commit comments

Comments
 (0)