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 0516f0ba6fbb231cde65f477855154e3a3fd340f Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Mon Jul 17 18:17:47 2023 +0200 Rename a method for avoiding confusion between two methods which may receive similar lambda functions. --- .../org/apache/sis/coverage/grid/GridCoverageProcessor.java | 2 +- .../apache/sis/internal/coverage/MultiSourceArgument.java | 13 ++++++------- .../sis/storage/aggregate/BandAggregateGridResource.java | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java index 01d0d93d92..b64a29d4a4 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java @@ -791,7 +791,7 @@ public class GridCoverageProcessor implements Cloneable { public GridCoverage aggregateRanges(GridCoverage[] sources, int[][] bandsPerSource) { final var aggregate = new MultiSourceArgument<>(sources, bandsPerSource); aggregate.unwrap(BandAggregateGridCoverage::unwrap); - aggregate.validate(GridCoverage::getSampleDimensions); + aggregate.completeAndValidate(GridCoverage::getSampleDimensions); aggregate.mergeConsecutiveSources(); if (aggregate.isIdentity()) { return aggregate.sources()[0]; diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/MultiSourceArgument.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/MultiSourceArgument.java index 6cab63d7ed..d60f5aa2bf 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/MultiSourceArgument.java +++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/MultiSourceArgument.java @@ -91,7 +91,7 @@ public final class MultiSourceArgument<S> { * Consequently this field can also be used for checking whether * one of the {@code validate(…)} methods has been invoked.</p> * - * @see #validate(Function) + * @see #completeAndValidate(Function) * @see #validate(ToIntFunction) */ private int[] numBandsPerSource; @@ -250,7 +250,7 @@ public final class MultiSourceArgument<S> { * * @param sources all sources of the aggregate to decompose. * @param bandsPerSource selected bands of the aggregate to decompose. May contain null elements. - * @param getter same getter as {@link #validate(Function)}, used for getting the number of bands. + * @param getter same getter as {@link #completeAndValidate(Function)}, used for getting the number of bands. */ public void applySubset(final S[] sources, final int[][] bandsPerSource, final Function<S, List<SampleDimension>> getter) @@ -312,7 +312,7 @@ public final class MultiSourceArgument<S> { } /** - * Clones and validates the arguments given to the constructor. + * Validates the arguments given to the constructor. * * @param counter method to invoke for counting the number of bands in a source. * @throws IllegalArgumentException if some band indices are duplicated or outside their range of validity. @@ -323,14 +323,13 @@ public final class MultiSourceArgument<S> { } /** - * Clones and validates the arguments given to the constructor. - * Also computes the union of bands in the sources given at construction time. - * The union result is stored in {@link #ranges()}. + * Computes the union of bands in the source given at construction time, then validates. + * The union of bands is stored in {@link #ranges()}. * * @param getter method to invoke for getting the list of sample dimensions. * @throws IllegalArgumentException if some band indices are duplicated or outside their range of validity. */ - public void validate(final Function<S, List<SampleDimension>> getter) { + public void completeAndValidate(final Function<S, List<SampleDimension>> getter) { checkValidationState(false); ranges = new ArrayList<>(); validate(Objects.requireNonNull(getter), null); diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/BandAggregateGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/BandAggregateGridResource.java index 8f2de820d9..99af5b863d 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/BandAggregateGridResource.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/BandAggregateGridResource.java @@ -217,7 +217,7 @@ final class BandAggregateGridResource extends AbstractGridCoverageResource imple try { final var aggregate = new MultiSourceArgument<GridCoverageResource>(sources, bandsPerSource); aggregate.unwrap(BandAggregateGridResource::unwrap); - aggregate.validate(BandAggregateGridResource::range); + aggregate.completeAndValidate(BandAggregateGridResource::range); aggregate.mergeConsecutiveSources(); if (aggregate.isIdentity()) { return aggregate.sources()[0];