lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject [lucene-solr] branch branch_8x updated: LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.
Date Thu, 17 Jan 2019 14:07:18 GMT
This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 28f2f2d  LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.
     new 3ff05fe  Merge remote-tracking branch 'origin/branch_8x' into branch_8x
28f2f2d is described below

commit 28f2f2d5340db84da8ce4e265726685ca7740095
Author: David Smiley <dsmiley@apache.org>
AuthorDate: Thu Jan 17 09:00:18 2019 -0500

    LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.
    
    (cherry picked from commit 70dd3ee06a49261da1c9d2c220f59ac9e73fc4c8)
---
 .../sandbox/src/java/org/apache/lucene/document/LatLonShape.java   | 2 +-
 lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java     | 5 ++---
 lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java | 7 +++----
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java b/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java
index 30b4819..ee41ffa 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java
@@ -55,7 +55,7 @@ import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;
  * @lucene.experimental
  */
 public class LatLonShape {
-  public static final int BYTES = LatLonPoint.BYTES;
+  static final int BYTES = Integer.BYTES;
 
   protected static final FieldType TYPE = new FieldType();
   static {
diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java
index 7f7def5..430f77b 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java
@@ -19,12 +19,11 @@ package org.apache.lucene.geo;
 
 import java.util.Arrays;
 
-import org.apache.lucene.document.LatLonShape;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.util.FutureArrays;
 import org.apache.lucene.util.NumericUtils;
 
-import static org.apache.lucene.document.LatLonShape.BYTES;
+import static java.lang.Integer.BYTES;
 import static org.apache.lucene.geo.GeoEncodingUtils.MAX_LON_ENCODED;
 import static org.apache.lucene.geo.GeoEncodingUtils.MIN_LON_ENCODED;
 import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
@@ -184,7 +183,7 @@ public class Rectangle2D {
    */
   private static void encode(final int minX, final int maxX, final int minY, final int maxY,
byte[] b) {
     if (b == null) {
-      b = new byte[4 * LatLonShape.BYTES];
+      b = new byte[4 * BYTES];
     }
     NumericUtils.intToSortableBytes(minY, b, 0);
     NumericUtils.intToSortableBytes(minX, b, BYTES);
diff --git a/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java b/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java
index 01a50e9..ef90c33 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java
@@ -17,12 +17,11 @@
 
 package org.apache.lucene.geo;
 
-import org.apache.lucene.document.LatLonShape;
 import org.apache.lucene.index.PointValues;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.NumericUtils;
 
-import static org.apache.lucene.document.LatLonShape.BYTES;
+import static java.lang.Integer.BYTES;
 
 public class TestRectangle2D extends LuceneTestCase {
 
@@ -82,13 +81,13 @@ public class TestRectangle2D extends LuceneTestCase {
       int tMinY = StrictMath.min(StrictMath.min(ay, by), cy);
       int tMaxY = StrictMath.max(StrictMath.max(ay, by), cy);
 
-      byte[] triangle = new byte[4 * LatLonShape.BYTES];
+      byte[] triangle = new byte[4 * BYTES];
       NumericUtils.intToSortableBytes(tMinY, triangle, 0);
       NumericUtils.intToSortableBytes(tMinX, triangle, BYTES);
       NumericUtils.intToSortableBytes(tMaxY, triangle, 2 * BYTES);
       NumericUtils.intToSortableBytes(tMaxX, triangle, 3 * BYTES);
 
-      PointValues.Relation r = rectangle2D.relateRangeBBox(LatLonShape.BYTES, 0, triangle,
3 * LatLonShape.BYTES, 2 * LatLonShape.BYTES, triangle);
+      PointValues.Relation r = rectangle2D.relateRangeBBox(BYTES, 0, triangle, 3 * BYTES,
2 * BYTES, triangle);
       if (r == PointValues.Relation.CELL_OUTSIDE_QUERY) {
         assertFalse(rectangle2D.intersectsTriangle(ax, ay, bx, by , cx, cy));
         assertFalse(rectangle2D.containsTriangle(ax, ay, bx, by , cx, cy));


Mime
View raw message