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 6963a10770 Cleanup, including removal of an unused method and methods where the default implementation is okay. 6963a10770 is described below commit 6963a10770adb3a85fbf687b80d353f607d461a7 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Tue Jul 9 18:02:57 2024 +0200 Cleanup, including removal of an unused method and methods where the default implementation is okay. --- .../main/org/apache/sis/io/wkt/Convention.java | 7 --- .../sis/referencing/MultiRegisterOperations.java | 59 ---------------------- .../internal/ParameterizedTransformBuilder.java | 7 ++- .../main/org/apache/sis/system/Environment.java | 1 + 4 files changed, 4 insertions(+), 70 deletions(-) diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java index 032e1bdd53..df454931b8 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java @@ -264,13 +264,6 @@ public enum Convention { return this != WKT2; } - /** - * {@code true} if the identifiers should be formatted for all elements instead of only the last one. - */ - final boolean showIdentifiers() { - return this == WKT2_SIMPLIFIED || this == INTERNAL; - } - /** * Returns the default authority to look for when fetching identified object names and identifiers. * The difference between various authorities are most easily seen in projection and parameter names. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/MultiRegisterOperations.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/MultiRegisterOperations.java index db0cdca8e4..07646e2cb4 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/MultiRegisterOperations.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/MultiRegisterOperations.java @@ -25,10 +25,7 @@ import java.util.Objects; import java.util.Optional; import org.opengis.util.Factory; import org.opengis.util.FactoryException; -import org.opengis.util.InternationalString; -import org.opengis.metadata.citation.Citation; import org.opengis.metadata.extent.GeographicBoundingBox; -import org.opengis.referencing.IdentifiedObject; import org.opengis.referencing.AuthorityFactory; import org.opengis.referencing.RegisterOperations; import org.opengis.referencing.crs.SingleCRS; @@ -194,27 +191,6 @@ public class MultiRegisterOperations extends AbstractFactory implements Register crsFactory = AuthorityFactories.ALL.getAuthorityFactory(CRSAuthorityFactory.class, authority, version); } - /** - * Returns the <abbr>CRS</abbr> authority factory. - */ - private CRSAuthorityFactory crsFactory() { - return (crsFactory != null) ? crsFactory : AuthorityFactories.ALL; - } - - /** - * Returns the organization or party responsible for definition and maintenance of the register. - * If an authority has been specified by a call to {@link #withAuthority(String)}, then this method - * returns that authority. Otherwise, this method returns {@code null}. - * - * @return the organization responsible for definitions in the registry, or {@code null} if none or many. - * - * @see MultiAuthoritiesFactory#getAuthority() - */ - @Override - public Citation getAuthority() { - return crsFactory().getAuthority(); - } - /** * Returns an instance for a geodetic registry of the specified authority, such as "EPSG". * If a {@linkplain #withVersion(String) version number was specified} previously, that version is cleared. @@ -280,41 +256,6 @@ public class MultiRegisterOperations extends AbstractFactory implements Register } } - /** - * Returns the set of authority codes for objects of the given type. - * The {@code type} argument specifies the base type of identified objects. - * For example, {@code CoordinateReferenceSystem.class} is for requesting the <abbr>CRS</abbr> codes. - * - * <h4>Limitations</h4> - * In the current implementation, codes are filtered by authority and registry version, - * but not for the area of interest. - * - * @param type the type of referencing object for which to get authority codes. - * @return the set of authority codes for referencing objects of the given type. - * @throws FactoryException if access to the underlying database failed. - */ - @Override - public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException { - return crsFactory().getAuthorityCodes(type); - } - - /** - * Returns a textual description of the object corresponding to a code. - * The description may be used in graphical user interfaces. - * - * @param type the type of object for which to get a description. - * @param code value allocated by the authority for an object of the given type. - * @return a description of the object, or empty if the object has no description. - * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. - * @throws FactoryException if the query failed for some other reason. - */ - @Override - public Optional<InternationalString> getDescriptionText(Class<? extends IdentifiedObject> type, String code) - throws FactoryException - { - return crsFactory().getDescriptionText(type, code); - } - /** * Extracts <abbr>CRS</abbr> details from the registry. If this {@code RegisterOperations} has not * been restricted to a specific authority by a call to {@link #withAuthority(String)}, then the diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java index d439168dd4..735edeafd7 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/ParameterizedTransformBuilder.java @@ -654,7 +654,8 @@ public class ParameterizedTransformBuilder extends MathTransformBuilder implemen if (provider instanceof AbstractProvider) { provider = ((AbstractProvider) provider).variantFor(transform); } - return swapAndScaleAxes(unique(transform)); + // A call to `unique` needs to be last because it set `factory.lastMethod` as a side-effect. + return unique(swapAndScaleAxes(unique(transform))); } catch (FactoryException exception) { if (warning != null) { exception.addSuppressed(warning); @@ -784,9 +785,7 @@ public class ParameterizedTransformBuilder extends MathTransformBuilder implemen * created transform; it does not change the operation. */ if (normalized instanceof ParameterizedAffine && !(mt instanceof ParameterizedAffine)) { - if (mt != (mt = ((ParameterizedAffine) normalized).newTransform(mt))) { - mt = unique(mt); - } + return ((ParameterizedAffine) normalized).newTransform(mt); } return mt; } diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Environment.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Environment.java index c545d46fc2..a6bdd1f6cf 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Environment.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/system/Environment.java @@ -50,6 +50,7 @@ public final class Environment extends Static { * from a JShell session resulted in wrong characters being printed, sometime followed by JShell errors. * This flag is set only if the commands are run from JShell. */ + @Configuration(writeAccess = Configuration.Access.INTERNAL) @Workaround(library="jshell", version="21") public static void avoidConsoleWriter() { avoidConsoleWriter = true;