Author: desruisseaux
Date: Fri Jun 7 15:33:19 2013
New Revision: 1490686
URL: http://svn.apache.org/r1490686
Log:
Moved org.apache.sis.util.GeoHashUtils to org.apache.sis.index.GeoHashCoder as
suggested on the mailing list.
Added:
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java
- copied, changed from r1490682,
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/util/GeoHashUtils.java
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/index/GeoHashCoderTest.java
- copied, changed from r1490682,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/util/TestGeoHashUtils.java
Removed:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/util/
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/util/
Copied:
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java
(from r1490682,
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/util/GeoHashUtils.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java?p2=sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java&p1=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/util/GeoHashUtils.java&r1=1490682&r2=1490686&rev=1490686&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/util/GeoHashUtils.java
[UTF-8] (original)
+++
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java
[UTF-8] Fri Jun 7 15:33:19 2013
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.sis.util;
+package org.apache.sis.index;
//JDK imports
import java.util.HashMap;
@@ -25,7 +25,7 @@ import java.util.Map;
* Utilities for encoding and decoding geohashes. Based on
* http://en.wikipedia.org/wiki/Geohash.
*/
-public class GeoHashUtils {
+public class GeoHashCoder {
private static final char[] BASE_32 = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n',
@@ -42,12 +42,12 @@ public class GeoHashUtils {
}
}
- private GeoHashUtils() {
+ private GeoHashCoder() {
}
/**
* Encodes the given latitude and longitude into a geohash
- *
+ *
* @param latitude
* Latitude to encode
* @param longitude
@@ -100,7 +100,7 @@ public class GeoHashUtils {
/**
* Decodes the given geohash into a latitude and longitude
- *
+ *
* @param geohash
* Geohash to deocde
* @return Array with the latitude at index 0, and longitude at index 1
Copied:
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/index/GeoHashCoderTest.java
(from r1490682,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/util/TestGeoHashUtils.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/index/GeoHashCoderTest.java?p2=sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/index/GeoHashCoderTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/util/TestGeoHashUtils.java&r1=1490682&r2=1490686&rev=1490686&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/util/TestGeoHashUtils.java
[UTF-8] (original)
+++
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/index/GeoHashCoderTest.java
[UTF-8] Fri Jun 7 15:33:19 2013
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.sis.util;
+package org.apache.sis.index;
import junit.framework.TestCase;
@@ -25,10 +25,10 @@ import java.util.HashMap;
/**
* Tests methods from the {@link GeoHashUtils} class.
- *
+ *
* @author rlaidlaw
*/
-public class TestGeoHashUtils extends TestCase
+public class GeoHashCoderTest extends TestCase
{
private static final double EPSILON = 0.000001;
private HashMap<String, HashMap<String, double[]>> places;
@@ -56,7 +56,7 @@ public class TestGeoHashUtils extends Te
places.get("Mount Rushmore").put("9xy3teyv7ke4", new double[]{43.878947,
-103.459825});
places.get("Space Needle").put("c22yzvh0gmfy", new double[]{47.620400,
-122.349100});
}
-
+
/**
* Clears up objects after running tests.
*/
@@ -64,7 +64,7 @@ public class TestGeoHashUtils extends Te
{
places = null;
}
-
+
/**
* Tests the encode() method.
*/
@@ -73,10 +73,10 @@ public class TestGeoHashUtils extends Te
for (Map.Entry<String, HashMap<String, double[]>> place :
places.entrySet())
{
HashMap<String, double[]> geoData = place.getValue();
-
- if (geoData == null)
- {
- fail("incorrect test data");
+
+ if (geoData == null)
+ {
+ fail("incorrect test data");
}
else
{
@@ -84,21 +84,21 @@ public class TestGeoHashUtils extends Te
{
String geoHash = geoInfo.getKey();
double[] point = geoInfo.getValue();
-
- if (geoHash == null || point == null)
- {
- fail("incorrect test data");
+
+ if (geoHash == null || point == null)
+ {
+ fail("incorrect test data");
}
else
{
- String encoded = GeoHashUtils.encode(point[0], point[1]);
+ String encoded = GeoHashCoder.encode(point[0], point[1]);
assertEquals(geoHash, encoded);
}
- }
+ }
}
}
}
-
+
/**
* Tests the decode() method.
*/
@@ -107,10 +107,10 @@ public class TestGeoHashUtils extends Te
for (Map.Entry<String, HashMap<String, double[]>> place :
places.entrySet())
{
HashMap<String, double[]> geoData = place.getValue();
-
- if (geoData == null)
- {
- fail("incorrect test data");
+
+ if (geoData == null)
+ {
+ fail("incorrect test data");
}
else
{
@@ -118,14 +118,14 @@ public class TestGeoHashUtils extends Te
{
String geoHash = geoInfo.getKey();
double[] point = geoInfo.getValue();
-
- if (geoHash == null || point == null)
- {
- fail("incorrect test data");
+
+ if (geoHash == null || point == null)
+ {
+ fail("incorrect test data");
}
else
{
- double[] decoded = GeoHashUtils.decode(geoHash);
+ double[] decoded = GeoHashCoder.decode(geoHash);
assertEquals(point[0], decoded[0], EPSILON);
assertEquals(point[1], decoded[1], EPSILON);
}