Apache Solr open-source search software
LUCENE-7190: Make some methods private in public classes, and make a very few constants public.
Karl Wright5e4777346a7a
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.javaindex a58056fcf0b..144c4a53009 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java@@ -175,7 +175,7 @@ public class GeoPolygonFactory {* @return null if the point is illegal, otherwise false if the point is inside and true if the point is outside* of the polygon.*/- protected static Boolean isInsidePolygon(final GeoPoint point, final List<GeoPoint> polyPoints) {+ private static Boolean isInsidePolygon(final GeoPoint point, final List<GeoPoint> polyPoints) {// First, compute sine and cosine of pole point latitude and longitudefinal double norm = 1.0 / point.magnitude();final double xyDenom = Math.sqrt(point.x * point.x + point.y * point.y);@@ -255,7 +255,7 @@ public class GeoPolygonFactory {* @param cosLongitude the cosine of the longitude* @return the angle of rotation, or null if not computable*/- protected static Double computeAngle(final GeoPoint point,+ private static Double computeAngle(final GeoPoint point,final double sinLatitude,final double cosLatitude,final double sinLongitude,@@ -511,7 +511,7 @@ public class GeoPolygonFactory {* @param testPoint is the optional test point.* @return true unless the testPoint caused failure.*/- protected static boolean makeConcavePolygon(final PlanetModel planetModel,+ private static boolean makeConcavePolygon(final PlanetModel planetModel,final GeoCompositePolygon rval,final EdgeBuffer edgeBuffer,final List<GeoPolygon> holes,@@ -572,7 +572,7 @@ public class GeoPolygonFactory {* @param testPoint is the optional test point.* @return null if the testPoint is within any polygon detected, otherwise true if a convex polygon was created.*/- protected static Boolean findConvexPolygon(final PlanetModel planetModel,+ private static Boolean findConvexPolygon(final PlanetModel planetModel,final Edge currentEdge,final GeoCompositePolygon rval,final EdgeBuffer edgeBuffer,@@ -786,7 +786,7 @@ public class GeoPolygonFactory {* @param returnBoundary is the return edge* @return true if within*/- protected static boolean isWithin(final GeoPoint point, final Set<Edge> edgeSet, final Edge extension, final SidedPlane returnBoundary) {+ private static boolean isWithin(final GeoPoint point, final Set<Edge> edgeSet, final Edge extension, final SidedPlane returnBoundary) {if (!extension.plane.isWithin(point)) {return false;}@@ -801,7 +801,7 @@ public class GeoPolygonFactory {* @param edgeSet is the set of edges* @return true if within*/- protected static boolean isWithin(final GeoPoint point, final Set<Edge> edgeSet) {+ private static boolean isWithin(final GeoPoint point, final Set<Edge> edgeSet) {for (final Edge edge : edgeSet) {if (!edge.plane.isWithin(point)) {return false;@@ -815,7 +815,7 @@ public class GeoPolygonFactory {*@param size is the array size.*@return an updated index.*/- protected static int getLegalIndex(int index, int size) {+ private static int getLegalIndex(int index, int size) {while (index < 0) {index += size;}@@ -827,7 +827,7 @@ public class GeoPolygonFactory {/** Class representing a single (unused) edge.*/- protected static class Edge {+ private static class Edge {/** Plane */public final SidedPlane plane;/** Start point */@@ -863,7 +863,7 @@ public class GeoPolygonFactory {/** Class representing an iterator over an EdgeBuffer.*/- protected static class EdgeBufferIterator implements Iterator<Edge> {+ private static class EdgeBufferIterator implements Iterator<Edge> {/** Edge buffer */protected final EdgeBuffer edgeBuffer;/** First edge */@@ -905,7 +905,7 @@ public class GeoPolygonFactory {/** Class representing a pool of unused edges, all linked together by vertices.*/- protected static class EdgeBuffer {+ private static class EdgeBuffer {/** Starting edge */protected Edge oneEdge;/** Full set of edges */diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/LatLonBounds.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/LatLonBounds.javaindex 627fdaec996..8f57efd5841 100644--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/LatLonBounds.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/LatLonBounds.java@@ -24,16 +24,16 @@ package org.apache.lucene.spatial3d.geom;public class LatLonBounds implements Bounds {/** Set to true if no longitude bounds can be stated */- protected boolean noLongitudeBound = false;+ private boolean noLongitudeBound = false;/** Set to true if no top latitude bound can be stated */- protected boolean noTopLatitudeBound = false;+ private boolean noTopLatitudeBound = false;/** Set to true if no bottom latitude bound can be stated */- protected boolean noBottomLatitudeBound = false;+ private boolean noBottomLatitudeBound = false;/** If non-null, the minimum latitude bound */- protected Double minLatitude = null;+ private Double minLatitude = null;/** If non-null, the maximum latitude bound */- protected Double maxLatitude = null;+ private Double maxLatitude = null;// For longitude bounds, this class needs to worry about keeping track of the distinction// between left-side bounds and right-side bounds. Points are always submitted in pairs@@ -88,9 +88,9 @@ public class LatLonBounds implements Bounds {// and can recognize that, we can set "unconstrained in longitude".)/** If non-null, the left longitude bound */- protected Double leftLongitude = null;+ private Double leftLongitude = null;/** If non-null, the right longitude bound */- protected Double rightLongitude = null;+ private Double rightLongitude = null;/** Construct an empty bounds object */public LatLonBounds() {@@ -252,7 +252,7 @@ public class LatLonBounds implements Bounds {/** Update latitude bound.*@param latitude is the latitude.*/- protected void addLatitudeBound(double latitude) {+ private void addLatitudeBound(double latitude) {if (!noTopLatitudeBound && (maxLatitude == null || latitude > maxLatitude))maxLatitude = latitude;if (!noBottomLatitudeBound && (minLatitude == null || latitude < minLatitude))@@ -262,7 +262,7 @@ public class LatLonBounds implements Bounds {/** Update longitude bound.*@param longitude is the new longitude value.*/- protected void addLongitudeBound(double longitude) {+ private void addLongitudeBound(double longitude) {// If this point is within the current bounds, we're done; otherwise// expand one side or the other.if (leftLongitude == null && rightLongitude == null) {diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.javaindex 1f2c054791b..29c400a3f16 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java@@ -24,15 +24,15 @@ package org.apache.lucene.spatial3d.geom;*/public class Plane extends Vector {/** An array with no points in it */- protected final static GeoPoint[] NO_POINTS = new GeoPoint[0];+ public final static GeoPoint[] NO_POINTS = new GeoPoint[0];/** An array with no bounds in it */- protected final static Membership[] NO_BOUNDS = new Membership[0];+ public final static Membership[] NO_BOUNDS = new Membership[0];/** A vertical plane normal to the Y axis */- protected final static Plane normalYPlane = new Plane(0.0,1.0,0.0,0.0);+ public final static Plane normalYPlane = new Plane(0.0,1.0,0.0,0.0);/** A vertical plane normal to the X axis */- protected final static Plane normalXPlane = new Plane(1.0,0.0,0.0,0.0);+ public final static Plane normalXPlane = new Plane(1.0,0.0,0.0,0.0);/** A vertical plane normal to the Z axis */- protected final static Plane normalZPlane = new Plane(0.0,0.0,1.0,0.0);+ public final static Plane normalZPlane = new Plane(0.0,0.0,1.0,0.0);/** Ax + By + Cz + D = 0 */public final double D;@@ -1463,7 +1463,7 @@ public class Plane extends Vector {* @param bounds is the area that the point must be within.* @param point is the point.*/- protected static void addPoint(final Bounds boundsInfo, final Membership[] bounds, final GeoPoint point) {+ private static void addPoint(final Bounds boundsInfo, final Membership[] bounds, final GeoPoint point) {// Make sure the discovered point is within the boundsfor (Membership bound : bounds) {if (!bound.isWithin(point))@@ -1473,28 +1473,6 @@ public class Plane extends Vector {boundsInfo.addPoint(point);}- /** Add a point to boundsInfo if within a specifically bounded area.- * @param boundsInfo is the object to be modified.- * @param bounds is the area that the point must be within.- * @param x is the x value.- * @param y is the y value.- * @param z is the z value.- */- /*- protected static void addPoint(final Bounds boundsInfo, final Membership[] bounds, final double x, final double y, final double z) {- //System.err.println(" Want to add point x="+x+" y="+y+" z="+z);- // Make sure the discovered point is within the bounds- for (Membership bound : bounds) {- if (!bound.isWithin(x, y, z))- return;- }- // Add the point- //System.err.println(" point added");- //System.out.println("Adding point x="+x+" y="+y+" z="+z);- boundsInfo.addPoint(x, y, z);- }- */-/*** Determine whether the plane intersects another plane within the* bounds provided.@@ -1540,7 +1518,7 @@ public class Plane extends Vector {* @param p is the plane to compare against.* @return true if the planes are numerically identical.*/- protected boolean isNumericallyIdentical(final Plane p) {+ public boolean isNumericallyIdentical(final Plane p) {// We can get the correlation by just doing a parallel plane check. If that passes, then compute a point on the plane// (using D) and see if it also on the other plane.if (Math.abs(this.y * p.z - this.z * p.y) >= MINIMUM_RESOLUTION)@@ -1573,7 +1551,7 @@ public class Plane extends Vector {* @param bounds are the bounds.* @return true if the vector describes a point within the bounds.*/- protected static boolean meetsAllBounds(final Vector p, final Membership[] bounds) {+ private static boolean meetsAllBounds(final Vector p, final Membership[] bounds) {return meetsAllBounds(p.x, p.y, p.z, bounds);}@@ -1585,7 +1563,7 @@ public class Plane extends Vector {* @param bounds are the bounds.* @return true if the vector describes a point within the bounds.*/- protected static boolean meetsAllBounds(final double x, final double y, final double z, final Membership[] bounds) {+ private static boolean meetsAllBounds(final double x, final double y, final double z, final Membership[] bounds) {for (final Membership bound : bounds) {if (!bound.isWithin(x,y,z))return false;@@ -1600,7 +1578,7 @@ public class Plane extends Vector {* @param moreBounds are an additional set of bounds.* @return true if the vector describes a point within the bounds.*/- protected static boolean meetsAllBounds(final Vector p, final Membership[] bounds, final Membership[] moreBounds) {+ private static boolean meetsAllBounds(final Vector p, final Membership[] bounds, final Membership[] moreBounds) {return meetsAllBounds(p.x, p.y, p.z, bounds, moreBounds);}@@ -1613,7 +1591,7 @@ public class Plane extends Vector {* @param moreBounds are an additional set of bounds.* @return true if the vector describes a point within the bounds.*/- protected static boolean meetsAllBounds(final double x, final double y, final double z, final Membership[] bounds,+ private static boolean meetsAllBounds(final double x, final double y, final double z, final Membership[] bounds,final Membership[] moreBounds) {return meetsAllBounds(x,y,z, bounds) && meetsAllBounds(x,y,z, moreBounds);}diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.javaindex c3ee53d4166..3ab2701290e 100644--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java@@ -29,27 +29,27 @@ public class XYZBounds implements Bounds {* of the shape, and we cannot guarantee that without making MINIMUM_RESOLUTION* unacceptably large.*/- protected static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 2.0;+ private static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 2.0;/** Minimum x */- protected Double minX = null;+ private Double minX = null;/** Maximum x */- protected Double maxX = null;+ private Double maxX = null;/** Minimum y */- protected Double minY = null;+ private Double minY = null;/** Maximum y */- protected Double maxY = null;+ private Double maxY = null;/** Minimum z */- protected Double minZ = null;+ private Double minZ = null;/** Maximum z */- protected Double maxZ = null;+ private Double maxZ = null;/** Set to true if no longitude bounds can be stated */- protected boolean noLongitudeBound = false;+ private boolean noLongitudeBound = false;/** Set to true if no top latitude bound can be stated */- protected boolean noTopLatitudeBound = false;+ private boolean noTopLatitudeBound = false;/** Set to true if no bottom latitude bound can be stated */- protected boolean noBottomLatitudeBound = false;+ private boolean noBottomLatitudeBound = false;/** Construct an empty bounds object */public XYZBounds() {