You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2019/01/17 14:11:00 UTC

[lucene-solr] branch branch_7x updated: LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch_7x by this push:
     new 6188128  LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.
6188128 is described below

commit 618812899cb1a6fc8ce7fa917ec4bc569686b0ff
Author: David Smiley <ds...@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));