Skip to content

Apache Lucene open-source search software

LUCENE-7970: Separate bounds computation method into its own interface, in prep for creating shapes that can't implement intersects()

Karl Wright347ab7e86f55
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Bounded.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Bounded.java
new file mode 100644
index 00000000000..59dcc6a9a0c
--- /dev/null
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Bounded.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.spatial3d.geom;
+
+/**
+ * This interface describes methods that determine what the bounds are
+ * for a shape.
+ *
+ * @lucene.experimental
+ */
+public interface Bounded {
+
+ /**
+ * Compute bounds for the shape.
+ *
+ * @param bounds is the input bounds object.
+ * The input object will be modified.
+ */
+ public void getBounds(final Bounds bounds);
+
+}
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoShape.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoShape.java
index bc2d8f9743a..5cb07a5625f 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoShape.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoShape.java
@@ -23,7 +23,7 @@ package org.apache.lucene.spatial3d.geom;
*
* @lucene.experimental
*/
-public interface GeoShape extends Membership, PlanetObject {
+public interface GeoShape extends Bounded, Membership, PlanetObject {
/**
* Return a sample point that is on the outside edge/boundary of the shape.
@@ -53,12 +53,4 @@ public interface GeoShape extends Membership, PlanetObject {
*/
public boolean intersects(final Plane plane, final GeoPoint[] notablePoints, final Membership... bounds);
- /**
- * Compute bounds for the shape.
- *
- * @param bounds is the input bounds object.
- * The input object will be modified.
- */
- public void getBounds(final Bounds bounds);
-
}