You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2019/06/21 15:48:19 UTC
[sis] 06/10: Add an optimization enabled by the previous commit
(part of SIS-463).
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
commit 557fb8bc673cfc53a5d34541a21ca666a00cc4d0
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jun 21 15:50:36 2019 +0200
Add an optimization enabled by the previous commit (part of SIS-463).
---
.../java/org/apache/sis/metadata/iso/citation/Citations.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
index 4bea3e6..5eaf426 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
@@ -636,6 +636,15 @@ public final class Citations extends Static {
return true; // Optimisation for a common case.
}
/*
+ * If both argument are one of the constants defined in the Citations class,
+ * then we do not need to compare identifier; call to `equals` is sufficient.
+ * This special case avoids the potentially costly call to `getIdentifiers()`
+ * since that call may cause a connection to the spatial metadata database.
+ */
+ if (c1 instanceof CitationConstant && c2 instanceof CitationConstant) {
+ return c1.equals(c2);
+ }
+ /*
* If there is no identifier in both citations, fallback on title comparisons.
* If there is identifiers in only one citation, make sure that this citation
* is the second one (c2) in order to allow at least one call to