This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 08012a9 Add documentation about purpose of a method and what
improvement could be done.
08012a9 is described below
commit 08012a95dde88295ad3ca078da236ebfe9431db5
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri Jan 17 10:38:10 2020 +0100
Add documentation about purpose of a method and what improvement could be
done.
---
.../src/main/java/org/apache/sis/index/tree/PointTree.java | 7 +++++++
.../src/main/java/org/apache/sis/internal/feature/ESRI.java | 4 +++-
.../java/org/apache/sis/internal/feature/Geometries.java | 2 ++
.../src/main/java/org/apache/sis/internal/feature/JTS.java | 4 +++-
.../main/java/org/apache/sis/internal/feature/Java2D.java | 13 +++++--------
5 files changed, 20 insertions(+), 10 deletions(-)
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
b/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
index 4e607dd..cc2eb4a 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/index/tree/PointTree.java
@@ -341,6 +341,13 @@ public class PointTree<E> extends AbstractSet<E>
implements CheckedContainer<E>,
modified = true;
count++;
}
+ /*
+ * Note: if practice suggests that we need more performance in
this method, we could temporarily
+ * use java.util.ArrayList instead of the copy-on-write strategy
applied by the insert(…) method
+ * below for elements stored in Object[] arrays, then invoke
List.toArray() after we finished to
+ * insert all elements. Given the increase in code complexity, we
wait to see if there is a need
+ * for that.
+ */
}
return modified;
}
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
index 7a38721..471b49d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/ESRI.java
@@ -37,6 +37,7 @@ import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.math.Vector;
import org.apache.sis.setup.GeometryLibrary;
import org.apache.sis.util.Classes;
+import org.apache.sis.util.Debug;
import com.esri.core.geometry.*;
@@ -121,8 +122,9 @@ final class ESRI extends Geometries<Geometry> {
/**
* If the given geometry is an implementation of this library, returns all
its coordinate tuples.
- * Otherwise returns {@code null}.
+ * Otherwise returns {@code null}. This method is currently used only for
testing purpose.
*/
+ @Debug
@Override
final double[] tryGetAllCoordinates(final Object geometry) {
if (geometry instanceof MultiVertexGeometry) {
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
index 24545f7..ed8f18a 100644
---
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
+++
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Geometries.java
@@ -37,6 +37,7 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.UnsupportedImplementationException;
import org.apache.sis.util.Classes;
+import org.apache.sis.util.Debug;
/**
@@ -294,6 +295,7 @@ public abstract class Geometries<G> {
* If the given object is one of the recognized geometry implementations,
returns all its coordinate tuples.
* Otherwise returns {@code null}. This method is currently used only for
testing purpose.
*/
+ @Debug
abstract double[] tryGetAllCoordinates(Object geometry);
/**
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
index 9146584..a37858b 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/JTS.java
@@ -31,6 +31,7 @@ import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.math.Vector;
import org.apache.sis.setup.GeometryLibrary;
import org.apache.sis.util.Classes;
+import org.apache.sis.util.Debug;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
@@ -156,8 +157,9 @@ final class JTS extends Geometries<Geometry> {
/**
* If the given geometry is an implementation of this library, returns all
its coordinate tuples.
- * Otherwise returns {@code null}.
+ * Otherwise returns {@code null}. This method is currently used only for
testing purpose.
*/
+ @Debug
@Override
final double[] tryGetAllCoordinates(Object geometry) {
if (geometry instanceof Geometry) {
diff --git
a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
index 0adf7b6..c975518 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/Java2D.java
@@ -16,18 +16,13 @@
*/
package org.apache.sis.internal.feature;
+import java.util.List;
+import java.util.Iterator;
import java.awt.Shape;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
-import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Spliterator;
-import java.util.function.Consumer;
-import java.util.stream.DoubleStream;
import java.awt.geom.RectangularShape;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.internal.feature.j2d.ShapeProperties;
@@ -36,6 +31,7 @@ import org.apache.sis.math.Vector;
import org.apache.sis.setup.GeometryLibrary;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.Classes;
+import org.apache.sis.util.Debug;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.UnsupportedImplementationException;
@@ -113,8 +109,9 @@ final class Java2D extends Geometries<Shape> {
/**
* If the given geometry is an implementation of this library, returns all
its coordinate tuples.
- * Otherwise returns {@code null}.
+ * Otherwise returns {@code null}. This method is currently used only for
testing purpose.
*/
+ @Debug
@Override
final double[] tryGetAllCoordinates(final Object geometry) {
if (geometry instanceof Point2D) {