Skip to content

Commit beef8f9

Browse files
committed
Reformatted 2
1 parent de36c39 commit beef8f9

File tree

5 files changed

+83
-84
lines changed

5 files changed

+83
-84
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ limitations under the License.
3030
Original C library created by Pieter Geelen. Work on Java version
3131
of the mapcode library by Rijn Buve and Matthew Lowden.
3232

33+
# Coding Formatting Style
34+
35+
The code formatting style used is the default code formatting style from IntelliJ IDEA (version 14).
36+
it is recommended to always use auto-format on any (Java) files before committing to maintain consistent layout.
37+
3338
# Using Git and `.gitignore`
3439

3540
It's good practice to set up a personal global `.gitignore` file on your machine which filters a number of files

src/test/java/com/mapcode/DecoderTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void highPrecisionUnicodeAthensAcropolis1() throws Exception {
8080
final Point point = MapcodeCodec.decode("\u0397\u03a0.\u03982-\u03a62", Territory.GRC);
8181
assertEquals("decodeUnicode latitude", 37971844, point.getLatMicroDeg());
8282
assertEquals("decodeUnicode longitude", 23726223,
83-
point.getLonMicroDeg());
83+
point.getLonMicroDeg());
8484
}
8585

8686
@Test
@@ -89,7 +89,7 @@ public void highPrecisionUnicodeAthensAcropolis2() throws Exception {
8989
final Point point = MapcodeCodec.decode("GRC \u0397\u03a0.\u03982-\u03a62");
9090
assertEquals("decodeUnicode latitude", 37971844, point.getLatMicroDeg());
9191
assertEquals("decodeUnicode longitude", 23726223,
92-
point.getLonMicroDeg());
92+
point.getLonMicroDeg());
9393
}
9494

9595
@Test
@@ -98,7 +98,7 @@ public void unicodeMapcodeAthensAcropolis1() throws Exception {
9898
final Point point = MapcodeCodec.decode("\u0397\u03a0.\u03982", Territory.GRC);
9999
assertEquals("decodeUnicode latitude", 37971812, point.getLatMicroDeg());
100100
assertEquals("decodeUnicode longitude", 23726247,
101-
point.getLonMicroDeg());
101+
point.getLonMicroDeg());
102102
}
103103

104104
@Test
@@ -107,17 +107,17 @@ public void unicodeMapcodeAthensAcropolis2() throws Exception {
107107
final Point point = MapcodeCodec.decode("GRC \u0397\u03a0.\u03982");
108108
assertEquals("decodeUnicode latitude", 37971812, point.getLatMicroDeg());
109109
assertEquals("decodeUnicode longitude", 23726247,
110-
point.getLonMicroDeg());
110+
point.getLonMicroDeg());
111111
}
112112

113113
@Test
114114
public void unicodeMapcodeTokyoTower1() throws Exception {
115115
LOG.info("unicodeMapcodeTokyoTower1");
116116
final Point point = MapcodeCodec.decode("\u30c1\u30ca.8\u30c1",
117-
Territory.JPN);
117+
Territory.JPN);
118118
assertEquals("decodeUnicode latitude", 35658660, point.getLatMicroDeg());
119119
assertEquals("decodeUnicode longitude", 139745394,
120-
point.getLonMicroDeg());
120+
point.getLonMicroDeg());
121121
}
122122

123123
@Test
@@ -126,7 +126,7 @@ public void unicodeMapcodeTokyoTower2() throws Exception {
126126
final Point point = MapcodeCodec.decode("JPN \u30c1\u30ca.8\u30c1");
127127
assertEquals("decodeUnicode latitude", 35658660, point.getLatMicroDeg());
128128
assertEquals("decodeUnicode longitude", 139745394,
129-
point.getLonMicroDeg());
129+
point.getLonMicroDeg());
130130
}
131131

132132
@Test
@@ -135,7 +135,7 @@ public void mapCodeWithZeroGroitzsch() throws Exception {
135135
final Point point = MapcodeCodec.decode("HMVM.3Q0", Territory.DEU);
136136
assertEquals("decodeUnicode latitude", 51154852, point.getLatMicroDeg());
137137
assertEquals("decodeUnicode longitude", 12278574,
138-
point.getLonMicroDeg());
138+
point.getLonMicroDeg());
139139
}
140140

141141
@Test(expected = IllegalArgumentException.class)

src/test/java/com/mapcode/EncodeDecodeTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
public class EncodeDecodeTest {
3333
private static final Logger LOG = LoggerFactory.getLogger(EncodeDecodeTest.class);
3434

35-
private static final int NUMBER_OF_POINTS = 1000;
36-
private static final int LOG_LINE_EVERY = 500;
35+
private static final int NUMBER_OF_POINTS = 1000;
36+
private static final int LOG_LINE_EVERY = 500;
3737
private static final double ALLOWED_DISTANCE_DELTA_METERS = 10.0;
38-
public static final Gson GSON =
39-
new GsonBuilder().serializeSpecialFloatingPointValues().create();
38+
public static final Gson GSON =
39+
new GsonBuilder().serializeSpecialFloatingPointValues().create();
4040

4141
@Test
4242
public void encodeDecodeTestFixedSeed() throws Exception {
@@ -71,7 +71,7 @@ private static void doEncodeDecode(final long seed) throws UnknownMapcodeExcepti
7171
found = true;
7272
if (showLogLine) {
7373
LOG.info("encodeDecodeTest: #{}/{}, encode={}, {} {} --> results={}",
74-
i, NUMBER_OF_POINTS, latDeg, lonDeg, territory, GSON.toJson(results));
74+
i, NUMBER_OF_POINTS, latDeg, lonDeg, territory, GSON.toJson(results));
7575
}
7676

7777
// Decode location, up to '/'.
@@ -85,15 +85,15 @@ private static void doEncodeDecode(final long seed) throws UnknownMapcodeExcepti
8585

8686
if (showLogLine) {
8787
LOG.info("encodeDecodeTest: #{}/{}, result={}, mapcode={}, territory={} --> " +
88-
"lat={}, lon={}; delta={}", i, NUMBER_OF_POINTS,
89-
result, mapcode, territory.getFullName(), decodeLocation.getLatDeg(),
90-
decodeLocation.getLonDeg(), distanceMeters);
88+
"lat={}, lon={}; delta={}", i, NUMBER_OF_POINTS,
89+
result, mapcode, territory.getFullName(), decodeLocation.getLatDeg(),
90+
decodeLocation.getLonDeg(), distanceMeters);
9191
LOG.info("");
9292
}
9393

9494
// Check if the distance is not too great.
9595
assertTrue("distanceMeters=" + distanceMeters + " >= " + ALLOWED_DISTANCE_DELTA_METERS,
96-
distanceMeters < ALLOWED_DISTANCE_DELTA_METERS);
96+
distanceMeters < ALLOWED_DISTANCE_DELTA_METERS);
9797
showLogLine = false;
9898
}
9999
}

src/test/java/com/mapcode/PointTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import static org.junit.Assert.assertEquals;
2525

2626
public class PointTest {
27-
private static final Logger LOG = LoggerFactory.getLogger(PointTest.class);
27+
private static final Logger LOG = LoggerFactory.getLogger(PointTest.class);
2828
private static final double DELTA = 0.000001;
2929

3030
@Test
@@ -75,17 +75,17 @@ public void testDegreesLonToMeters() {
7575

7676
assertEquals(0, Double.compare(0, Point.degreesLonToMetersAtLat(0, 0)));
7777
assertEquals(0,
78-
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR / 2.0, Point.degreesLonToMetersAtLat(0.5, 0)));
78+
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR / 2.0, Point.degreesLonToMetersAtLat(0.5, 0)));
7979
assertEquals(0,
80-
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR, Point.degreesLonToMetersAtLat(1, 0)));
80+
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR, Point.degreesLonToMetersAtLat(1, 0)));
8181
assertEquals(0,
82-
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR * 180, Point.degreesLonToMetersAtLat(180, 0)));
82+
Double.compare(Point.METERS_PER_DEGREE_LON_EQUATOR * 180, Point.degreesLonToMetersAtLat(180, 0)));
8383
assertEquals(0,
84-
Double.compare(-Point.METERS_PER_DEGREE_LON_EQUATOR * 180, Point.degreesLonToMetersAtLat(-180, 0)));
84+
Double.compare(-Point.METERS_PER_DEGREE_LON_EQUATOR * 180, Point.degreesLonToMetersAtLat(-180, 0)));
8585
Assert.assertTrue(Math.abs((Point.METERS_PER_DEGREE_LON_EQUATOR / 2.0) -
86-
Point.degreesLonToMetersAtLat(1, 60)) < DELTA);
86+
Point.degreesLonToMetersAtLat(1, 60)) < DELTA);
8787
Assert.assertTrue(Math.abs((Point.METERS_PER_DEGREE_LON_EQUATOR / 2.0) -
88-
Point.degreesLonToMetersAtLat(1, -60)) < DELTA);
88+
Point.degreesLonToMetersAtLat(1, -60)) < DELTA);
8989
}
9090

9191
@Test
@@ -94,44 +94,44 @@ public void testMetersToDegreesLon() {
9494

9595
assertEquals(0, Double.compare(0, Point.metersToDegreesLonAtLat(0, 0)));
9696
assertEquals(0,
97-
Double.compare(0.5, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR / 2, 0)));
97+
Double.compare(0.5, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR / 2, 0)));
9898
assertEquals(0,
99-
Double.compare(1, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, 0)));
99+
Double.compare(1, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, 0)));
100100
assertEquals(0,
101-
Double.compare(180, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR * 180, 0)));
101+
Double.compare(180, Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR * 180, 0)));
102102
assertEquals(0, Double.compare(-180,
103-
Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR * -180, 0)));
103+
Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR * -180, 0)));
104104
Assert.assertTrue(
105-
Math.abs(2.0 - Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, 60)) < DELTA);
105+
Math.abs(2.0 - Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, 60)) < DELTA);
106106
Assert.assertTrue(
107-
Math.abs(2.0 - Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, -60)) < DELTA);
107+
Math.abs(2.0 - Point.metersToDegreesLonAtLat(Point.METERS_PER_DEGREE_LON_EQUATOR, -60)) < DELTA);
108108
}
109109

110110
@Test
111111
public void testDistanceInMeters() {
112112
LOG.info("testDistanceInMeters");
113113

114114
double d = Point.METERS_PER_DEGREE_LAT - Point.distanceInMeters(Point.fromMicroDeg(-500000, 0),
115-
Point.fromMicroDeg(500000, 0));
115+
Point.fromMicroDeg(500000, 0));
116116
Assert.assertTrue(Math.abs(d) <= DELTA);
117117

118118
d = Point.METERS_PER_DEGREE_LAT - Point.distanceInMeters(Point.fromMicroDeg(80000000, 0),
119-
Point.fromMicroDeg(81000000, 0));
119+
Point.fromMicroDeg(81000000, 0));
120120
Assert.assertTrue(Math.abs(d) <= DELTA);
121121

122122
d = (Point.METERS_PER_DEGREE_LAT * 2) - Point.distanceInMeters(Point.fromMicroDeg(59000000, 0),
123-
Point.fromMicroDeg(61000000, 0));
123+
Point.fromMicroDeg(61000000, 0));
124124
Assert.assertTrue(Math.abs(d) <= DELTA);
125125

126126
Assert.assertTrue(Math.abs(Point.METERS_PER_DEGREE_LON_EQUATOR - Point.distanceInMeters(
127-
Point.fromMicroDeg(0, -500000), Point.fromMicroDeg(0, 500000))) <= DELTA);
127+
Point.fromMicroDeg(0, -500000), Point.fromMicroDeg(0, 500000))) <= DELTA);
128128
Assert.assertTrue(Math.abs(Point.METERS_PER_DEGREE_LON_EQUATOR - Point.distanceInMeters(
129-
Point.fromMicroDeg(0, 80000000), Point.fromMicroDeg(0, 81000000))) < DELTA);
129+
Point.fromMicroDeg(0, 80000000), Point.fromMicroDeg(0, 81000000))) < DELTA);
130130
Assert.assertTrue(Math.abs((Point.METERS_PER_DEGREE_LON_EQUATOR / 2.0) - Point.distanceInMeters(
131-
Point.fromMicroDeg(60000000, 80000000), Point.fromMicroDeg(60000000, 81000000))) <= DELTA);
131+
Point.fromMicroDeg(60000000, 80000000), Point.fromMicroDeg(60000000, 81000000))) <= DELTA);
132132

133133
Assert.assertTrue(Math.abs((Point.METERS_PER_DEGREE_LON_EQUATOR * 2) - Point.distanceInMeters(
134-
Point.fromMicroDeg(0, -1000000), Point.fromMicroDeg(0, 1000000))) <= DELTA);
134+
Point.fromMicroDeg(0, -1000000), Point.fromMicroDeg(0, 1000000))) <= DELTA);
135135

136136
Assert.assertTrue(Point.distanceInMeters(Point.fromDeg(0.0, 180.0), Point.fromDeg(0.0, -179.999977)) < 10.0);
137137
Assert.assertTrue(Point.distanceInMeters(Point.fromDeg(0.0, -179.999977), Point.fromDeg(0.0, 180.0)) < 10.0);

0 commit comments

Comments
 (0)