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 3e7afe4085 Remove deprecated methods after release.
3e7afe4085 is described below
commit 3e7afe408561cb5ac48a1656132884592654fa89
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Mon Feb 2 17:12:40 2026 +0100
Remove deprecated methods after release.
---
.../org.apache.sis.feature/main/module-info.java | 2 +-
.../coverage/grid/FractionalGridCoordinates.java | 155 +-------------------
.../org/apache/sis/coverage/grid/package-info.java | 2 +-
.../org/apache/sis/feature/AbstractFeature.java | 45 +-----
.../org/apache/sis/feature/DefaultFeatureType.java | 4 +-
.../main/org/apache/sis/feature/DenseFeature.java | 14 +-
.../main/org/apache/sis/feature/SparseFeature.java | 14 +-
.../sis/feature/internal/shared/FeatureView.java | 24 ----
.../main/org/apache/sis/feature/package-info.java | 2 +-
.../main/org/apache/sis/filter/Optimization.java | 31 +---
.../main/org/apache/sis/filter/package-info.java | 2 +-
.../grid/FractionalGridCoordinatesTest.java | 50 -------
.../main/module-info.java | 2 +-
.../main/org/apache/sis/referencing/CRS.java | 28 +---
.../org/apache/sis/referencing/package-info.java | 2 +-
.../org/apache/sis/storage/geotiff/Writer.java | 2 +-
.../org.apache.sis.storage/main/module-info.java | 2 +-
.../main/org/apache/sis/storage/FeatureQuery.java | 27 +---
.../main/org/apache/sis/storage/package-info.java | 2 +-
.../src/org.apache.sis.util/main/module-info.java | 2 +-
.../main/org/apache/sis/math/Fraction.java | 30 +---
.../main/org/apache/sis/math/package-info.java | 2 +-
.../main/org/apache/sis/measure/UnitDimension.java | 5 +-
.../main/org/apache/sis/util/Classes.java | 81 +----------
.../main/org/apache/sis/util/Numbers.java | 156 +--------------------
.../org/apache/sis/util/collection/Containers.java | 41 +-----
.../apache/sis/util/collection/package-info.java | 2 +-
.../apache/sis/util/internal/shared/Numerics.java | 2 +-
.../main/org/apache/sis/util/package-info.java | 2 +-
.../test/org/apache/sis/util/ClassesTest.java | 35 +----
30 files changed, 50 insertions(+), 718 deletions(-)
diff --git a/endorsed/src/org.apache.sis.feature/main/module-info.java
b/endorsed/src/org.apache.sis.feature/main/module-info.java
index 422dfde078..3f6f2ccb4c 100644
--- a/endorsed/src/org.apache.sis.feature/main/module-info.java
+++ b/endorsed/src/org.apache.sis.feature/main/module-info.java
@@ -20,7 +20,7 @@
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.5
+ * @version 1.7
* @since 0.5
*/
module org.apache.sis.feature {
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/FractionalGridCoordinates.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/FractionalGridCoordinates.java
index 5eded56547..17853d7e66 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/FractionalGridCoordinates.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/FractionalGridCoordinates.java
@@ -24,12 +24,8 @@ import org.opengis.referencing.operation.TransformException;
import org.apache.sis.geometry.GeneralDirectPosition;
import org.apache.sis.feature.internal.Resources;
import org.apache.sis.util.StringBuilders;
-import org.apache.sis.util.internal.shared.Strings;
-import org.apache.sis.util.resources.Errors;
// Specific to the geoapi-3.1 and geoapi-4.0 branches:
-import org.opengis.coordinate.MismatchedDimensionException;
-import org.opengis.coverage.PointOutsideCoverageException;
import org.opengis.coverage.grid.GridCoordinates;
@@ -49,7 +45,7 @@ import org.opengis.coverage.grid.GridCoordinates;
* {@link ArithmeticException} is thrown.</p>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
*
* @see GridCoverage.Evaluator#toGridCoordinates(DirectPosition)
*
@@ -181,155 +177,6 @@ public class FractionalGridCoordinates implements
GridCoordinates, Serializable
}
}
- /**
- * Creates a new grid extent around this grid coordinates. The returned
extent will have the same number
- * of dimensions than this grid coordinates. For each dimension
<var>i</var> the following relationships
- * will hold (where {@code extent} is the return value):
- *
- * <ol>
- * <li>If <code>extent.{@linkplain GridExtent#getSize(int)
getSize}(i)</code> ≥ 2 and no shift (see below) then:<ul>
- * <li><code>extent.{@linkplain GridExtent#getLow(int)
getLow}(i)</code> ≤
- * <code>{@linkplain #getCoordinateFractional(int)
getCoordinateFractional}(i)</code></li>
- * <li><code>extent.{@linkplain GridExtent#getHigh(int)
getHigh}(i)</code> ≥
- * <code>{@linkplain #getCoordinateFractional(int)
getCoordinateFractional}(i)</code></li>
- * </ul></li>
- * <li>If {@code bounds.getSize(i)} ≥ {@code size[i]} and {@code
size[i]} ≠ 0 then:<ul>
- * <li><code>extent.{@linkplain GridExtent#getSize(int)
getSize}(i)</code> = {@code size[i]}</li>
- * </ul></li>
- * </ol>
- *
- * <p>The {@code size} argument is optional and can be incomplete (i.e.
the number of {@code size} values can be
- * less than the number of dimensions). For each dimension <var>i</var>,
if a {@code size[i]} value is provided
- * and is not zero, then this method tries to expand the extent in that
dimension to the specified {@code size[i]}
- * value as shown in constraint #2 above. Otherwise the default size is
the smallest possible extent that met
- * constraint #1 above, clipped to the {@code bounds}. This implies a size
of 1 if the grid coordinate in that
- * dimension is an integer, or a size of 2 (before clipping to the bounds)
if the grid coordinate has a fractional
- * part.</p>
- *
- * <p>The {@code bounds} argument is also optional.
- * If non-null, then this method enforces the following additional
rules:</p>
- *
- * <ul>
- * <li>Coordinates rounded to nearest integers must be inside the given
bounds,
- * otherwise a {@link PointOutsideCoverageException} is thrown.</li>
- * <li>If the computed extent overlaps an area outside the bounds, then
the extent will be shifted (if an explicit
- * size was given) or clipped (if automatic size is used) in order
to be be fully contained inside the bounds.</li>
- * <li>If a given size is larger than the corresponding bounds
{@linkplain GridExtent#getSize(int) size},
- * then the returned extent will be clipped to the bounds.</li>
- * </ul>
- *
- * <p>In all cases, this method tries to keep the grid coordinates close
to the center of the returned extent.
- * A shift may exist if necessary for keeping the extent inside the {@code
bounds} argument, but will never
- * move the grid coordinates outside the [<var>low</var> …
<var>high</var>+1) range of returned extent.</p>
- *
- * @param bounds if the coordinates shall be contained inside a grid,
that grid extent. Otherwise {@code null}.
- * @param size the desired extent sizes as strictly positive numbers,
or 0 sentinel values for automatic
- * sizes (1 or 2 depending on bounds and coordinate
values). This array may have any length;
- * if shorter than the number of dimensions, missing
values default to 0.
- * If longer than the number of dimensions, extra values
are ignored.
- * @throws IllegalArgumentException if a {@code size} value is negative.
- * @throws ArithmeticException if a coordinate value is outside the range
of {@code long} values.
- * @throws MismatchedDimensionException if {@code bounds} dimension is not
equal to grid coordinates dimension.
- * @throws PointOutsideCoverageException if the grid coordinates (rounded
to nearest integers) are outside the
- * given bounds.
- * @return a grid extent of the given size (if possible) containing those
grid coordinates.
- *
- * @deprecated Not used anymore because this method leads to a
multiplication of very small read operations.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public GridExtent toExtent(final GridExtent bounds, final long... size) {
- final int dimension = coordinates.length;
- if (bounds != null) {
- final int bd = bounds.getDimension();
- if (bd != dimension) {
- throw new MismatchedDimensionException(Errors.format(
- Errors.Keys.MismatchedDimension_3, "bounds",
dimension, bd));
- }
- }
- final long[] extent = GridExtent.allocate(dimension);
- for (int i=0; i<dimension; i++) {
- final double value = coordinates[i];
- if (!(value >= Long.MIN_VALUE && value <= Long.MAX_VALUE)) {
// Use ! for catching NaN values.
- throw new ArithmeticException(Resources.format(
- Resources.Keys.UnconvertibleGridCoordinate_2, "long",
value));
- }
- long margin = 0;
- if (i < size.length) {
- margin = size[i];
- if (margin < 0) {
- throw new IllegalArgumentException(Errors.format(
- Errors.Keys.NegativeArgument_2,
Strings.toIndexed("size", i), margin));
- }
- }
- /*
- * The lower/upper values are given by Math.floor/ceil
respectively (may be equal).
- * However, we do an exception to this rule if user asked
explicitly for a size of 1.
- * In such case we can no longer enforce the `lower ≤ value ≤
upper` rule. The best
- * we can do is to take the nearest neighbor.
- */
- final long nearest = Math.round(value);
- long lower, upper;
- if (margin == 1) {
- lower = upper = nearest;
- } else {
- lower = (long) Math.floor(value); // Inclusive.
- upper = (long) Math.ceil (value); // Inclusive too
(lower == upper if value is an integer).
- if (margin != 0) {
- margin -= (upper - lower + 1); // Total number of
cells to add.
- assert margin >= 0 : margin; // Because (upper -
lower + 1) ≤ 2
- if ((margin & 1) != 0) {
- if (nearest >= upper) {
- upper = Math.incrementExact(upper);
- } else {
- lower = Math.decrementExact(lower);
- }
- }
- margin >>= 1; // Number of cells to add on each side.
- lower = Math.subtractExact(lower, margin);
- upper = Math.addExact(upper, margin);
- margin = 2; // Any value different than 0 for
remembering that it was explicitly specified.
- }
- }
- /*
- * At this point the grid range has been computed (lower to upper).
- * Shift it if needed for keeping it inside the enclosing extent.
- */
- if (bounds != null) {
- final long validMin = bounds.getLow(i);
- final long validMax = bounds.getHigh(i);
- if (nearest > validMax || nearest < validMin) {
- final var b = new StringBuilder();
- writeCoordinates(b);
- throw new PointOutsideCoverageException(
-
Resources.format(Resources.Keys.GridCoordinateOutsideCoverage_4,
- bounds.getAxisIdentification(i,i), validMin,
validMax, b.toString()));
- }
- if (upper > validMax) {
- if (margin != 0) { // In automatic mode (margin = 0)
just clip, don't shift.
- /*
- * Because (upper - validMax) is always positive, then
(t > lower) would mean
- * that we have an overflow. In such cases we do not
need the result since we
- * know that we are outside the enclosing extent
anyway.
- */
- final long t = lower - Math.subtractExact(upper,
validMax);
- lower = (t >= validMin && t <= lower) ? t : validMin;
- }
- upper = validMax;
- }
- if (lower < validMin) {
- if (margin != 0) {
- final long t = upper + Math.subtractExact(validMin,
lower);
- upper = (t <= validMax && t >= upper) ? t : validMax;
// Same rational as above.
- }
- lower = validMin;
- }
- }
- extent[i] = lower;
- extent[i+dimension] = upper;
- }
- return new GridExtent(bounds, extent);
- }
-
/**
* Returns the grid coordinates converted to a geospatial position using
the given transform.
* This is the reverse of {@link
GridCoverage.Evaluator#toGridCoordinates(DirectPosition)}.
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
index 81b06aaef5..3c99f80e4e 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
@@ -41,7 +41,7 @@
* @author Martin Desruisseaux (Geomatys)
* @author Johann Sorel (Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 1.0
*/
package org.apache.sis.coverage.grid;
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/AbstractFeature.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/AbstractFeature.java
index ae06609be4..be24226f52 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/AbstractFeature.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/AbstractFeature.java
@@ -87,7 +87,7 @@ import org.opengis.feature.Operation;
* @author Travis L. Pinney
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
*
* @see DefaultFeatureType#newInstance()
*
@@ -101,8 +101,6 @@ public abstract class AbstractFeature implements Feature,
Serializable {
/**
* Sentinel value for missing property.
- *
- * @see #getValueOrFallback(String, Object)
*/
private static final Object MISSING = new Object();
@@ -350,11 +348,7 @@ public abstract class AbstractFeature implements Feature,
Serializable {
* @see AbstractAttribute#getValue()
*/
@Override
- public Object getPropertyValue(final String name) throws
PropertyNotFoundException {
- final Object value = getValueOrFallback(name, MISSING);
- if (value != MISSING) return value;
- throw new PropertyNotFoundException(propertyNotFound(type, getName(),
name));
- }
+ public abstract Object getPropertyValue(String name) throws
PropertyNotFoundException;
/**
* Sets the value for the property of the given name.
@@ -376,33 +370,6 @@ public abstract class AbstractFeature implements Feature,
Serializable {
@Override
public abstract void setPropertyValue(final String name, final Object
value) throws IllegalArgumentException;
- /**
- * Returns the value for the property of the given name if that property
exists, or a fallback value otherwise.
- * This method is equivalent to the following code, but potentially more
efficient:
- *
- * {@snippet lang="java" :
- * return type.hasProperty(name) ? getPropertyValue(name) :
missingPropertyFallback;
- * }
- *
- * Note that if a property of the given name exists but has no value, then
this method returns the
- * {@linkplain DefaultAttributeType#getDefaultValue() default value}
(which may be {@code null}).
- * <i>Property without value</i> is not equivalent to <i>non-existent
property</i>.
- *
- * @param name the property name.
- * @param missingPropertyFallback the (potentially {@code null}) value
to return
- * if no attribute or association of the given name exists.
- * @return value or default value of the specified property, or {@code
missingPropertyFallback}
- * if no attribute or association of that name exists. This value
may be {@code null}.
- *
- * @since 1.1
- *
- * @deprecated Experience suggests that this method encourage bugs in
user's code that stay unnoticed.
- */
- @Deprecated(since = "1.5", forRemoval = true)
- public Object getValueOrFallback(final String name, Object
missingPropertyFallback) {
- return type.hasProperty(name) ? getPropertyValue(name) :
missingPropertyFallback;
- }
-
/**
* Executes the parameterless operation of the given name and returns the
value of its result.
* This is a convenience method for sub-classes where some properties may
be operations that
@@ -747,12 +714,12 @@ public abstract class AbstractFeature implements Feature,
Serializable {
* Returns the exception message for a property not found. The message
will differ depending
* on whether the property is not found because ambiguous or because it
does not exist.
*
- * @param feature the name of the feature where a property where
searched ({@link String} or {@link GenericName}).
+ * @param feature the the feature where a property where searched.
* @param property the name of the property which has not been found.
*/
- static String propertyNotFound(final FeatureType type, final Object
feature, final String property) {
+ static String propertyNotFound(final FeatureType feature, final String
property) {
GenericName ambiguous = null;
- for (final IdentifiedType p : type.getProperties(true)) {
+ for (final IdentifiedType p : feature.getProperties(true)) {
final GenericName next = p.getName();
GenericName name = next;
do {
@@ -765,7 +732,7 @@ public abstract class AbstractFeature implements Feature,
Serializable {
}
} while (name instanceof ScopedName && (name = ((ScopedName)
name).tail()) != null);
}
- return Resources.format(Resources.Keys.PropertyNotFound_2, feature,
property);
+ return Resources.format(Resources.Keys.PropertyNotFound_2,
feature.getName(), property);
}
/**
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DefaultFeatureType.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DefaultFeatureType.java
index f89decfcb7..d764cbcb5b 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DefaultFeatureType.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DefaultFeatureType.java
@@ -95,7 +95,7 @@ import org.opengis.feature.PropertyNotFoundException;
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
*
* @see DefaultAttributeType
* @see DefaultAssociationRole
@@ -879,7 +879,7 @@ public class DefaultFeatureType extends
AbstractIdentifiedType implements Featur
if (pt != null) {
return pt;
}
- throw new
PropertyNotFoundException(AbstractFeature.propertyNotFound(this, getName(),
name));
+ throw new
PropertyNotFoundException(AbstractFeature.propertyNotFound(this, name));
}
/**
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DenseFeature.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DenseFeature.java
index a8f31630c4..19e9c9dbae 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DenseFeature.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/DenseFeature.java
@@ -94,7 +94,7 @@ final class DenseFeature extends AbstractFeature implements
CloneAccess {
return index;
}
ArgumentChecks.ensureNonNull("name", name);
- throw new PropertyNotFoundException(propertyNotFound(type, getName(),
name));
+ throw new PropertyNotFoundException(propertyNotFound(type, name));
}
/**
@@ -173,21 +173,17 @@ final class DenseFeature extends AbstractFeature
implements CloneAccess {
}
/**
- * Returns the value for the property of the given name if that property
exists, or a fallback value otherwise.
+ * Returns the value for the property of the given name if that property
exists.
*
* @param name the property name.
- * @param missingPropertyFallback the value to return if no attribute or
association of the given name exists.
- * @return the value for the given property, or {@code null} if none.
- *
- * @deprecated Experience suggests that this method encourage bugs in
user's code that stay unnoticed.
+ * @return the value for the given property.
*/
@Override
- @Deprecated(since = "1.5", forRemoval = true)
- public final Object getValueOrFallback(final String name, final Object
missingPropertyFallback) {
+ public final Object getPropertyValue(final String name) {
ArgumentChecks.ensureNonNull("name", name);
final Integer index = indices.get(name);
if (index == null) {
- return missingPropertyFallback;
+ throw new PropertyNotFoundException(propertyNotFound(type, name));
}
if (index < 0) {
return getOperationValue(name);
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/SparseFeature.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/SparseFeature.java
index b13a3c0118..14b8530faa 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/SparseFeature.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/SparseFeature.java
@@ -128,7 +128,7 @@ final class SparseFeature extends AbstractFeature
implements CloneAccess {
if (index != null) {
return index;
}
- throw new PropertyNotFoundException(propertyNotFound(type, getName(),
name));
+ throw new PropertyNotFoundException(propertyNotFound(type, name));
}
/**
@@ -220,21 +220,17 @@ final class SparseFeature extends AbstractFeature
implements CloneAccess {
}
/**
- * Returns the value for the property of the given name if that property
exists, or a fallback value otherwise.
+ * Returns the value for the property of the given name if that property
exists.
*
* @param name the property name.
- * @param missingPropertyFallback the value to return if no attribute or
association of the given name exists.
- * @return the value for the given property, or {@code null} if none.
- *
- * @deprecated Experience suggests that this method encourage bugs in
user's code that stay unnoticed.
+ * @return the value for the given property.
*/
@Override
- @Deprecated(since = "1.5", forRemoval = true)
- public final Object getValueOrFallback(final String name, final Object
missingPropertyFallback) {
+ public final Object getPropertyValue(final String name) {
ArgumentChecks.ensureNonNull("name", name);
final Integer index = indices.get(name);
if (index == null) {
- return missingPropertyFallback;
+ throw new PropertyNotFoundException(propertyNotFound(type, name));
}
if (index < 0) {
return getOperationValue(name);
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/internal/shared/FeatureView.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/internal/shared/FeatureView.java
index 931748153f..ebf9172e10 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/internal/shared/FeatureView.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/internal/shared/FeatureView.java
@@ -110,28 +110,4 @@ final class FeatureView extends AbstractFeature {
public void setPropertyValue(final String name, final Object value) {
source.setPropertyValue(name, value);
}
-
- /**
- * Returns the value for the property of the given name if that property
exists, or a fallback value otherwise.
- * This method delegates to the wrapped source without checking whether
the given name exists in this subset.
- *
- * <h4>Design note</h4>
- * We could add a verification of whether the property exists in the
feature type given by {@link #getType()}.
- * We don't do that for now because the current usages of this method in
the Apache SIS code base do not need
- * this method to be strict, and for consistency with the behavior of
other methods in this class.
- *
- * @param name the property name.
- * @param missingPropertyFallback the value to return if no attribute or
association of the given name exists.
- * @return value or default value of the specified property, or {@code
missingPropertyFallback}.
- *
- * @deprecated Experience suggests that this method encourage bugs in
user's code that stay unnoticed.
- */
- @Override
- @Deprecated(since = "1.5", forRemoval = true)
- public Object getValueOrFallback(final String name, final Object
missingPropertyFallback) {
- if (source instanceof AbstractFeature) {
- return ((AbstractFeature) source).getValueOrFallback(name,
missingPropertyFallback);
- }
- return super.getValueOrFallback(name, missingPropertyFallback);
- }
}
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
index 749cea6798..f10a0bf841 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/package-info.java
@@ -93,7 +93,7 @@
* @author Travis L. Pinney
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.5
*/
package org.apache.sis.feature;
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/Optimization.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/Optimization.java
index 8705943a6d..453785a2eb 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/Optimization.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/Optimization.java
@@ -99,7 +99,7 @@ import org.opengis.feature.PropertyNotFoundException;
* those effects will disappear in the optimized filter.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 1.1
*/
public class Optimization {
@@ -157,35 +157,6 @@ public class Optimization {
featureTypes = Set.of();
}
- /**
- * Returns the type of feature instances to be filtered, or {@code null}
if unknown.
- * This is the last value specified by a call to {@link
#setFeatureType(FeatureType)}.
- * The default value is {@code null}.
- *
- * @return the type of feature instances to be filtered, or {@code null}
if unknown.
- *
- * @deprecated Replaced by {@link #getFinalFeatureTypes()}.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public FeatureType getFeatureType() {
- return Containers.peekIfSingleton(getFinalFeatureTypes());
- }
-
- /**
- * Sets the type of feature instances to be filtered.
- * If this type is known in advance, specifying it may allow to compute
more specific
- * {@link org.apache.sis.util.ObjectConverter}s or to apply some geometry
reprojection
- * in advance.
- *
- * @param type the type of feature instances to be filtered, or {@code
null} if unknown.
- *
- * @deprecated Replaced by {@link #setFinalFeatureTypes(Collection)}.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public void setFeatureType(final FeatureType type) {
- setFinalFeatureType(type);
- }
-
/**
* Returns the exhaustive set of the types of all feature instances that
the filters and expressions may see.
* The super-types should not be included in the set, unless some features
may be instances of these specific
diff --git
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/package-info.java
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/package-info.java
index 52c562e1c3..a90f5c7409 100644
---
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/package-info.java
+++
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/package-info.java
@@ -57,7 +57,7 @@
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
*
* @since 1.1
*/
diff --git
a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/FractionalGridCoordinatesTest.java
b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/FractionalGridCoordinatesTest.java
index 36e9b0dc5a..65a90acfe3 100644
---
a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/FractionalGridCoordinatesTest.java
+++
b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/FractionalGridCoordinatesTest.java
@@ -52,54 +52,4 @@ public final class FractionalGridCoordinatesTest extends
TestCase {
assertEquals(-1, gc.getCoordinateValue(1));
assertEquals( 8, gc.getCoordinateValue(2));
}
-
- /**
- * Tests {@link FractionalGridCoordinates#toExtent(GridExtent, long...)}
- * with default parameter values.
- */
- @Test
- @SuppressWarnings("removal") // TODO: make
GridExtentTest.assertExtentEquals private.
- public void testToExtent() {
- final GridExtent extent = instance().toExtent(null);
- GridExtentTest.assertExtentEquals(extent, 0, 4, 4);
- GridExtentTest.assertExtentEquals(extent, 1, -2, -1);
- GridExtentTest.assertExtentEquals(extent, 2, 7, 8);
- }
-
- /**
- * Tests {@link FractionalGridCoordinates#toExtent(GridExtent, long...)}
with a size of 1.
- */
- @Test
- @SuppressWarnings("removal")
- public void testToExtentSize1() {
- final GridExtent extent = instance().toExtent(null, 1, 1, 1);
- GridExtentTest.assertExtentEquals(extent, 0, 4, 4);
- GridExtentTest.assertExtentEquals(extent, 1, -1, -1);
- GridExtentTest.assertExtentEquals(extent, 2, 8, 8);
- }
-
- /**
- * Tests {@link FractionalGridCoordinates#toExtent(GridExtent, long...)}
with a size greater than 2.
- */
- @Test
- @SuppressWarnings("removal")
- public void testToExtentSizeN() {
- final GridExtent extent = instance().toExtent(null, 3, 5, 4);
- GridExtentTest.assertExtentEquals(extent, 0, 3, 5);
- GridExtentTest.assertExtentEquals(extent, 1, -3, 1);
- GridExtentTest.assertExtentEquals(extent, 2, 6, 9);
- }
-
- /**
- * Tests {@link FractionalGridCoordinates#toExtent(GridExtent, long...)}
with a bounds constraint.
- */
- @Test
- @SuppressWarnings("removal")
- public void testToExtentBounded() {
- final GridExtent bounds = new GridExtent(null, new long[] {0, -1, 0},
new long[] {4, 2, 8}, true);
- final GridExtent extent = instance().toExtent(bounds, 3, 5, 4);
- GridExtentTest.assertExtentEquals(extent, 0, 2, 4);
- GridExtentTest.assertExtentEquals(extent, 1, -1, 2);
- GridExtentTest.assertExtentEquals(extent, 2, 5, 8);
- }
}
diff --git a/endorsed/src/org.apache.sis.referencing/main/module-info.java
b/endorsed/src/org.apache.sis.referencing/main/module-info.java
index 2457ee6ede..bacffd1670 100644
--- a/endorsed/src/org.apache.sis.referencing/main/module-info.java
+++ b/endorsed/src/org.apache.sis.referencing/main/module-info.java
@@ -21,7 +21,7 @@
* @author Martin Desruisseaux (Geomatys)
* @author Rémi Maréchal (Geomatys)
* @author Maxime Gavens (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
module org.apache.sis.referencing {
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java
index 16b670c870..c4f5ac8f37 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java
@@ -151,7 +151,7 @@ import org.opengis.coordinate.CoordinateMetadata;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
public final class CRS {
@@ -667,32 +667,6 @@ public final class CRS {
return bestCRS;
}
- /**
- * Finds a mathematical operation that transforms or converts coordinates
between the given <abbr>CRS</abbr>s and epochs.
- * This method performs the same work as the {@linkplain
#findOperation(CoordinateReferenceSystem, CoordinateReferenceSystem,
- * GeographicBoundingBox) variant working on CRS objects}, except that the
coordinate epochs may be taken in account.
- *
- * @param source the CRS and epoch of source coordinates.
- * @param target the CRS and epoch of target coordinates.
- * @param areaOfInterest the area of interest, or {@code null} if none.
- * @return the mathematical operation from {@code source} to {@code
target}.
- * @throws OperationNotFoundException if no operation was found between
the given pair of <abbr>CRS</abbr>s and epochs.
- * @throws FactoryException if the operation cannot be created for another
reason.
- *
- * @since 1.5
- *
- * @deprecated Replaced by {@link #findOperation(CoordinateMetadata,
CoordinateMetadata, CoordinateOperationContext)}.
- * This method will be removed for avoiding ambiguity when the last
argument is null.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public static CoordinateOperation findOperation(final CoordinateMetadata
source,
- final CoordinateMetadata
target,
- final
GeographicBoundingBox areaOfInterest)
- throws FactoryException
- {
- return findOperation(source, target,
CoordinateOperationContext.fromBoundingBox(areaOfInterest));
- }
-
/**
* Finds a mathematical operation that transform coordinates from the
given source to the given target <abbr>CRS</abbr>.
* If an estimation of the geographic area containing the points to
transform is known,
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/package-info.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/package-info.java
index 0b45e41295..f6a084b23f 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/package-info.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/package-info.java
@@ -94,7 +94,7 @@
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Guilhem Legal (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.4
*/
@XmlSchema(location =
"http://schemas.opengis.net/gml/3.2.1/referenceSystems.xsd",
diff --git
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java
index f3aba2e396..ca0c80065a 100644
---
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java
+++
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java
@@ -416,7 +416,7 @@ final class Writer extends IOBase implements Flushable {
* paper size, as suggested by the units of measurement which are
restricted to inch or centimeters.
* This is not very useful for geospatial applications, except as
aspect ratio.
*/
- final Fraction xres = new Fraction(1, 1); // TODO
+ final Fraction xres = Fraction.ONE; // TODO
final Fraction yres = xres;
/*
* If the image has any unsupported feature, the exception should have
been thrown before this point.
diff --git a/endorsed/src/org.apache.sis.storage/main/module-info.java
b/endorsed/src/org.apache.sis.storage/main/module-info.java
index 8b7fe8b1c5..5973ec510e 100644
--- a/endorsed/src/org.apache.sis.storage/main/module-info.java
+++ b/endorsed/src/org.apache.sis.storage/main/module-info.java
@@ -20,7 +20,7 @@
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
module org.apache.sis.storage {
diff --git
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/FeatureQuery.java
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/FeatureQuery.java
index 24a06a4ec4..71cb2dc9ba 100644
---
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/FeatureQuery.java
+++
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/FeatureQuery.java
@@ -83,7 +83,7 @@ import org.opengis.filter.SortProperty;
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 1.1
*/
public class FeatureQuery extends Query implements Cloneable, Emptiable,
Serializable {
@@ -833,33 +833,14 @@ public class FeatureQuery extends Query implements
Cloneable, Emptiable, Seriali
return source;
}
final FeatureQuery query = clone();
- query.optimize(source);
- return new FeatureSubset(source, query);
- }
-
- /**
- * Optimizes this query before execution. This method is invoked by {@link
#execute(FeatureSet)}
- * on a {@linkplain #clone() clone} of the user-provided query. The
default implementations tries
- * to optimize the {@linkplain #getSelection() selection} filter using
{@link Optimization}.
- * Subclasses can override for modifying the optimization algorithm.
- *
- * @param source the set of features given to the {@code
execute(FeatureSet)} method.
- * @throws DataStoreException if an error occurred during the optimization
of this query.
- *
- * @since 1.5
- *
- * @deprecated Moved to {@link
AbstractFeatureSet#prepareQueryOptimization(FeatureQuery, Optimization)}
- * because experience suggests that this is the class that know best how
to configure.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- protected void optimize(final FeatureSet source) throws DataStoreException
{
- if (selection != null) {
+ if (query.selection != null) {
final var optimizer = new Optimization();
if (source instanceof AbstractFeatureSet) {
((AbstractFeatureSet) source).prepareQueryOptimization(this,
optimizer);
}
- selection = optimizer.apply(selection);
+ query.selection = optimizer.apply(query.selection);
}
+ return new FeatureSubset(source, query);
}
/**
diff --git
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/package-info.java
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/package-info.java
index 4a846c5c9d..2a65abf786 100644
---
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/package-info.java
+++
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/package-info.java
@@ -24,7 +24,7 @@
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
package org.apache.sis.storage;
diff --git a/endorsed/src/org.apache.sis.util/main/module-info.java
b/endorsed/src/org.apache.sis.util/main/module-info.java
index ecc4a81533..087a1b92f4 100644
--- a/endorsed/src/org.apache.sis.util/main/module-info.java
+++ b/endorsed/src/org.apache.sis.util/main/module-info.java
@@ -22,7 +22,7 @@
*
* @author Martin Desruisseaux (MPO, IRD, Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
module org.apache.sis.util {
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/Fraction.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/Fraction.java
index 825e0319a7..a16560988c 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/Fraction.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/Fraction.java
@@ -20,7 +20,6 @@ import java.io.Serializable;
import static java.lang.Math.multiplyFull;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.collection.WeakHashSet;
import org.apache.sis.util.internal.shared.Numerics;
import org.apache.sis.pending.jdk.JDK15;
import static org.apache.sis.pending.jdk.JDK19.DOUBLE_PRECISION;
@@ -32,7 +31,7 @@ import static
org.apache.sis.pending.jdk.JDK19.DOUBLE_PRECISION;
* All {@code Fraction} instances are immutable and thus inherently
thread-safe.
*
* @author Martin Desruisseaux (MPO, Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.8
*/
public final class Fraction extends Number implements Comparable<Fraction>,
Serializable {
@@ -42,9 +41,11 @@ public final class Fraction extends Number implements
Comparable<Fraction>, Seri
private static final long serialVersionUID = -4501644254763471216L;
/**
- * Pool of fractions for which the {@link #unique()} method has been
invoked.
+ * The value 1 as a fraction.
+ *
+ * @since 1.7
*/
- private static final WeakHashSet<Fraction> POOL = new
WeakHashSet<>(Fraction.class);
+ public static final Fraction ONE = new Fraction(1, 1);
/**
* The <var>a</var> term in the <var>a</var>/<var>b</var> fraction.
@@ -198,27 +199,6 @@ public final class Fraction extends Number implements
Comparable<Fraction>, Seri
throw new
IllegalArgumentException(Errors.format(Errors.Keys.CanNotConvertValue_2, value,
Fraction.class));
}
- /**
- * Returns a unique fraction instance equals to {@code this}.
- * If this method has been invoked previously on another {@code Fraction}
with the same value as {@code this},
- * then that previous instance is returned (provided that it has not yet
been garbage collected). Otherwise this
- * method adds this fraction to the pool of fractions that may be returned
in next {@code unique()} invocations,
- * then returns {@code this}.
- *
- * <p>This method is useful for saving memory when a potentially large
number of {@code Fraction} instances will
- * be kept for a long time and many instances are likely to have the same
values.
- * It is usually not worth to invoke this method for short-lived
instances.</p>
- *
- * @return a unique instance of a fraction equals to {@code this}.
- *
- * @deprecated {@code Fraction} may become a value object with a future
Java version,
- * and this method is incompatible with value objects.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public Fraction unique() {
- return POOL.unique(this);
- }
-
/**
* Returns a fraction equivalent to {@code this} but represented by the
smallest possible numerator
* and denominator values. If this fraction cannot be simplified, then
this method returns {@code this}.
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/package-info.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/package-info.java
index 55c9097561..70d0c7c77e 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/package-info.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/package-info.java
@@ -40,7 +40,7 @@
* </ul>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
package org.apache.sis.math;
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
index 7bdec5db9f..2ee0da8c3d 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/measure/UnitDimension.java
@@ -93,7 +93,7 @@ final class UnitDimension implements Dimension, Serializable {
@SuppressWarnings("ThisEscapedInObjectConstruction") // Safe because
this class is final.
UnitDimension(final char symbol) {
this.symbol = symbol;
- components = Map.of(this, new Fraction(1,1).unique());
+ components = Map.of(this, Fraction.ONE);
UnitRegistry.init(components, this);
}
@@ -132,7 +132,6 @@ final class UnitDimension implements Dimension,
Serializable {
*/
var dim = (UnitDimension) UnitRegistry.get(components);
if (dim == null) {
- components.replaceAll((c, power) -> power.unique());
components = Containers.unmodifiable(components);
dim = new UnitDimension(components);
if (!Units.initialized) {
@@ -242,7 +241,7 @@ final class UnitDimension implements Dimension,
Serializable {
@SuppressWarnings("unchecked")
final var components = (Map<Dimension,Integer>)
dimension.getBaseDimensions();
if (components == null) {
- return Map.of(dimension, new Fraction(1,1));
+ return Map.of(dimension, Fraction.ONE);
}
return ObjectConverters.derivedValues(components, Dimension.class,
FractionConverter.FromInteger.INSTANCE);
}
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
index 7cd51e0f68..9f6bb010c8 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Classes.java
@@ -22,7 +22,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedHashSet;
import java.util.Optional;
import java.lang.reflect.Type;
import java.lang.reflect.Field;
@@ -56,7 +55,7 @@ import org.apache.sis.pending.jdk.JDK19;
* </ul>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
public final class Classes {
@@ -346,28 +345,6 @@ public final class Classes {
return (object != null) ? (Class<? extends T>) object.getClass() :
null;
}
- /**
- * Returns the classes of all objects in the given collection. If the
given collection
- * contains some null elements, then the returned set will contain a null
element as well.
- * The returned set is modifiable and can be freely updated by the caller.
- *
- * <p>Note that interfaces are not included in the returned set.</p>
- *
- * @param <T> the base type of elements in the given collection.
- * @param objects the collection of objects.
- * @return the set of classes of all objects in the given collection.
- *
- * @deprecated To be removed after removal of public deprecated methods.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- private static <T> Set<Class<? extends T>> getClasses(final Iterable<?
extends T> objects) {
- final Set<Class<? extends T>> types = new LinkedHashSet<>();
- for (final T object : objects) {
- types.add(getClass(object));
- }
- return types;
- }
-
/**
* Returns the first type or super-type (including interface) considered
"standard" in Apache SIS sense.
* This method applies the following heuristic rules, in that order:
@@ -542,40 +519,6 @@ next: for (final Class<?> candidate : candidates) {
return (Class[]) ArraysExt.resize(types, count);
}
- /**
- * Returns the most specific class of the objects in the given collection.
- * If there is more than one specialized class,
- * returns their {@linkplain #findCommonClass most specific common super
class}.
- *
- * <p>This method searches for classes only, not interfaces.</p>
- *
- * @param objects a collection of objects. May contains duplicated
values and null values.
- * @return the most specialized class, or {@code null} if the given
collection does not contain
- * at least one non-null element.
- *
- * @deprecated This method is confusing as it works on instances instead
of classes.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public static Class<?> findSpecializedClass(final Iterable<?> objects) {
- final Set<Class<?>> types = getClasses(objects);
- types.remove(null);
- /*
- * Removes every classes in the types collection which are assignable
from another
- * class from the same collection. As a result, the collection should
contain only
- * leaf classes.
- */
- for (final Iterator<Class<?>> it=types.iterator(); it.hasNext();) {
- final Class<?> candidate = it.next();
- for (final Class<?> type : types) {
- if (candidate != type && candidate.isAssignableFrom(type)) {
- it.remove();
- break;
- }
- }
- }
- return common(types);
- }
-
/**
* Returns the most specific class which is a common parent of all the
specified classes.
* This method is not public in order to make sure that it contains only
classes, not
@@ -596,28 +539,6 @@ next: for (final Class<?> candidate : candidates) {
return type;
}
- /**
- * Returns the most specific class which {@linkplain
Class#isAssignableFrom is assignable from}
- * the type of all given objects. If no element in the given collection
has a type assignable
- * from the type of all other elements, then this method searches for a
common
- * {@linkplain Class#getSuperclass super class}.
- *
- * <p>This method searches for classes only, not interfaces.</p>
- *
- * @param objects a collection of objects. May contains duplicated
values and null values.
- * @return the most specific class common to all supplied objects, or
{@code null} if the
- * given collection does not contain at least one non-null element.
- *
- * @deprecated This method is confusing as it works on instances while
{@link #findCommonClass(Class, Class)}
- * works on classes.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public static Class<?> findCommonClass(final Iterable<?> objects) {
- final Set<Class<?>> types = getClasses(objects);
- types.remove(null);
- return common(types);
- }
-
/**
* Returns the most specific class which {@linkplain
Class#isAssignableFrom is assignable from}
* the given classes or a parent of those classes. This method returns
either {@code c1},
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Numbers.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Numbers.java
index 36edf994e7..b61c1773b0 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Numbers.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/Numbers.java
@@ -38,7 +38,7 @@ import org.apache.sis.util.internal.shared.DoubleDouble;
* Static methods working with {@code Number} objects, and a few primitive
types by extension.
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.6
+ * @version 1.7
*
* @see org.apache.sis.math.MathFunctions
*
@@ -46,88 +46,12 @@ import org.apache.sis.util.internal.shared.DoubleDouble;
*/
@SuppressWarnings("UnnecessaryBoxing")
public final class Numbers {
- /**
- * Constant of value {@value} used in {@code switch} statements or as
index in arrays.
- * This enumeration provides the following guarantees (some Apache SIS
codes rely on them):
- *
- * <ul>
- * <li>{@code OTHER} value is 0.</li>
- * <li>Primitive types are enumerated in this exact order
- * (from lower value to higher value, but not necessarily as
consecutive values):
- * {@code BYTE}, {@code SHORT}, {@code INTEGER}, {@code LONG},
{@code FLOAT}, {@code DOUBLE}.</li>
- * <li>{@link java.math} types of greater capacity than primitive types
({@code BIG_DECIMAL}
- * and {@code BIG_INTEGER}) have higher enumeration values.</li>
- * <li>{@link Fraction} is considered as a kind of floating point
value.</li>
- * </ul>
- *
- * @deprecated Replaced by the {@link NumberType} enumeration.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static final byte
- BIG_DECIMAL=11, BIG_INTEGER=10, FRACTION=7,
- DOUBLE=9, FLOAT=8, LONG=6, INTEGER=5, SHORT=4, BYTE=3,
CHARACTER=2, BOOLEAN=1, OTHER=0;
-
/**
* Do not allow instantiation of this class.
*/
private Numbers() {
}
- /**
- * Returns {@code true} if the given {@code type} is a floating point
type. The floating point types
- * are {@link Float}, {@code float}, {@link Double}, {@code double} and
{@link BigDecimal}.
- * {@link Fraction} is also considered as a kind of floating point values.
- *
- * @param type the primitive type or wrapper class to test (can be
{@code null}).
- * @return {@code true} if {@code type} is one of the known types capable
to represent floating point numbers.
- *
- * @see #isInteger(Class)
- *
- * @deprecated Moved to {@link NumberType#isFractional(Class)}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static boolean isFloat(final Class<?> type) {
- return NumberType.isFractional(type);
- }
-
- /**
- * Returns {@code true} if the given {@code type} is an integer type. The
integer types are
- * {@link Byte}, {@code byte}, {@link Short}, {@code short}, {@link
Integer}, {@code int},
- * {@link Long}, {@code long} and {@link BigInteger}.
- *
- * @param type the primitive type or wrapper class to test (can be
{@code null}).
- * @return {@code true} if {@code type} is an integer type.
- *
- * @see #isFloat(Class)
- * @see #round(Number)
- *
- * @deprecated Moved to {@link NumberType#isInteger(Class)}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static boolean isInteger(final Class<?> type) {
- return NumberType.isInteger(type);
- }
-
- /**
- * Returns {@code true} if the given {@code type} is a floating point or
an integer type.
- * This method returns {@code true} if either {@link #isFloat(Class)} or
{@link #isInteger(Class)}
- * returns {@code true} for the given argument, or if the type is
assignable to {@link Number}.
- *
- * @param type the primitive type or wrapper class to test (can be
{@code null}).
- * @return {@code true} if {@code type} is a {@link Number} or a primitive
floating point or integer type.
- *
- * @see #isFloat(Class)
- * @see #isInteger(Class)
- *
- * @since 1.1
- *
- * @deprecated Moved to {@link NumberType#isReal(Class)}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static boolean isNumber(final Class<?> type) {
- return NumberType.isReal(type);
- }
-
/**
* Returns {@code true} if the given number is null or NaN.
* Current implementation recognizes {@link Float}, {@link Double} and
{@link Fraction} types.
@@ -189,54 +113,6 @@ public final class Numbers {
throw new
ArithmeticException(Errors.format(Errors.Keys.CanNotConvertValue_2, value,
Long.TYPE));
}
- /**
- * Returns the number of bits used by primitive of the specified type.
- * The given type must be a primitive type or its wrapper class.
- *
- * @param type the primitive type (can be {@code null}).
- * @return the number of bits, or 0 if {@code type} is null.
- * @throws IllegalArgumentException if the given type is not one of the
types supported by this {@code Numbers} class.
- *
- * @deprecated Replaced by {@link NumberType#size()}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static int primitiveBitCount(final Class<?> type) throws
IllegalArgumentException {
- if (type == null) {
- return 0;
- }
- return NumberType.forNumberClass(type).size().orElseThrow();
- }
-
- /**
- * Changes a primitive class to its wrapper (for example {@code int} to
{@link Integer}).
- * If the specified class is not a primitive type, then it is returned
unchanged.
- *
- * @param <N> the primitive and wrapper type (both have the same
parametric declaration).
- * @param type the primitive type (can be {@code null}).
- * @return the type as a wrapper.
- *
- * @deprecated Moved to {@link NumberType#primitiveToWrapper(Class)}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static <N> Class<N> primitiveToWrapper(final Class<N> type) {
- return NumberType.primitiveToWrapper(type);
- }
-
- /**
- * Changes a wrapper class to its primitive (for example {@link Integer}
to {@code int}).
- * If the specified class is not a wrapper type, then it is returned
unchanged.
- *
- * @param <N> the primitive and wrapper type (both have the same
parametric declaration).
- * @param type the wrapper type (can be {@code null}).
- * @return the type as a primitive.
- *
- * @deprecated Moved to {@link NumberType#wrapperToPrimitive(Class)}.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static <N> Class<N> wrapperToPrimitive(final Class<N> type) {
- return NumberType.wrapperToPrimitive(type);
- }
-
/**
* Returns the widest type of two numbers. Numbers {@code n1} and {@code
n2} can be instance of
* {@link Byte}, {@link Short}, {@link Integer}, {@link Long}, {@link
Float}, {@link Double},
@@ -685,34 +561,4 @@ public final class Numbers {
Queue.class, Containers.emptyQueue(),
SortedSet.class, Collections.emptySortedSet(),
NavigableSet.class, Collections.emptyNavigableSet());
-
- /**
- * Returns a numeric constant for the given type.
- * The constants are {@link #BIG_DECIMAL}, {@link #BIG_INTEGER}, {@link
#FRACTION},
- * {@link #DOUBLE}, {@link #FLOAT}, {@link #LONG}, {@link #INTEGER},
- * {@link #SHORT}, {@link #BYTE}, {@link #CHARACTER}, {@link #BOOLEAN}, or
{@link #OTHER}
- * constants for the given type. This is a commodity for usage in {@code
switch} statements.
- *
- * @param type a type (usually either a primitive type or its wrapper),
or {@code null}.
- * @return the constant for the given type, or {@link #OTHER} if unknown.
- *
- * @deprecated Replaced by the {@link NumberType} enumeration.
- */
- @Deprecated(since="1.6", forRemoval=true)
- public static byte getEnumConstant(final Class<?> type) {
- switch (NumberType.forClass(type).orElse(NumberType.NULL)) {
- case BIG_DECIMAL: return BIG_DECIMAL;
- case BIG_INTEGER: return BIG_INTEGER;
- case FRACTION: return FRACTION;
- case DOUBLE: return DOUBLE;
- case FLOAT: return FLOAT;
- case LONG: return LONG;
- case INTEGER: return INTEGER;
- case SHORT: return SHORT;
- case BYTE: return BYTE;
- case CHARACTER: return CHARACTER;
- case BOOLEAN: return BOOLEAN;
- default: return OTHER;
- }
- }
}
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/Containers.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/Containers.java
index f4178ed061..05fc392fa1 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/Containers.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/Containers.java
@@ -52,7 +52,7 @@ import org.apache.sis.util.resources.Errors;
* All methods in this class preserve element order, including the methods
returning a {@link Set}.
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
public final class Containers {
@@ -385,45 +385,6 @@ public final class Containers {
return new UnmodifiableArrayList.SubList<>(array, lower, upper -
lower);
}
- /**
- * Returns an unmodifiable view of the given array. A direct reference to
the given array is
- * retained (i.e. the array is <strong>not</strong> cloned).
- *
- * @param <E> the base type of elements in the list.
- * @param array the array to wrap, or {@code null} if none.
- * @return the given array wrapped in an unmodifiable list, or {@code
null} if the given array was null.
- *
- * @deprecated Renamed as {@link #viewAsUnmodifiableList(Object...)} for
clarity.
- * The new name emphases the contrast with {@link
#copyToImmutableList(Collection, Class)}.
- * The parameterized return type is also different.
- */
- @SafeVarargs
- @SuppressWarnings("varargs")
- @Deprecated(since = "1.6", forRemoval = true)
- public static <E> List<? extends E> unmodifiableList(final E... array) {
- return viewAsUnmodifiableList(array);
- }
-
- /**
- * Returns an unmodifiable view of a subregion of the given array. A
direct reference to the
- * given array is retained (i.e. the array is <strong>not</strong> cloned).
- *
- * @param <E> the type of elements in the list.
- * @param array the array to wrap (cannot be null).
- * @param lower low endpoint (inclusive) of the sublist.
- * @param upper high endpoint (exclusive) of the sublist.
- * @return the given array wrapped in an unmodifiable list.
- * @throws IndexOutOfBoundsException if the lower or upper value are out
of bounds.
- *
- * @deprecated Renamed as {@link #viewAsUnmodifiableList(Object[], int,
int)} for clarity.
- * The new name emphases the contrast with {@link
#copyToImmutableList(Collection, Class)}.
- * The parameterized return type is also different.
- */
- @Deprecated(since = "1.6", forRemoval = true)
- public static <E> List<? extends E> unmodifiableList(final E[] array,
final int lower, final int upper) {
- return viewAsUnmodifiableList(array, lower, upper);
- }
-
/**
* Returns an unmodifiable view or copy of the given list.
* This method is similar to the standard {@link
Collections#unmodifiableList(List)} except for the following:
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
index ab988b178c..d05578cef1 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
@@ -51,7 +51,7 @@
* </ul>
*
* @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
package org.apache.sis.util.collection;
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Numerics.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Numerics.java
index 7294881949..a7bdbc308f 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Numerics.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Numerics.java
@@ -321,7 +321,7 @@ public final class Numerics {
*/
public static Number fraction(long numerator, long denominator) {
try {
- return Fraction.valueOf(numerator, denominator).unique();
+ return Fraction.valueOf(numerator, denominator);
} catch (ArithmeticException e) {
return numerator / (double) denominator;
}
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
index 6e89e547aa..28291f7284 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
@@ -39,7 +39,7 @@
*
* @author Martin Desruisseaux (Geomatys)
* @author Alexis Manin (Geomatys)
- * @version 1.6
+ * @version 1.7
* @since 0.3
*/
package org.apache.sis.util;
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ClassesTest.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ClassesTest.java
index 1564f4fa73..26024dd249 100644
--- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ClassesTest.java
+++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ClassesTest.java
@@ -42,11 +42,6 @@ import java.util.Collection;
import java.util.NavigableSet;
import java.util.RandomAccess;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectStreamException;
-import java.io.InvalidObjectException;
-import java.io.NotSerializableException;
import java.io.Serializable;
import java.awt.geom.Point2D;
import javax.print.attribute.standard.PrinterStateReason;
@@ -68,6 +63,7 @@ import org.opengis.referencing.operation.CoordinateOperation;
*
* @author Martin Desruisseaux (Geomatys)
*/
+@SuppressWarnings("exports")
public final class ClassesTest extends TestCase {
/**
* Creates a new test case.
@@ -161,35 +157,6 @@ public final class ClassesTest extends TestCase {
assertEquals(CharSequence.class,
Classes.getStandardType(CharSequence.class));
}
- /**
- * Tests {@link Classes#findCommonClass(Iterable)}
- * and {@link Classes#findSpecializedClass(Iterable)}.
- */
- @Test
- public void testFindCommonParent() {
- final Set<Object> types = new HashSet<>();
-
- assertTrue(types.add(new NotSerializableException()));
- assertEquals(NotSerializableException.class, findCommonClass
(types));
- assertEquals(NotSerializableException.class,
findSpecializedClass(types));
-
- assertTrue(types.add(new InvalidObjectException(null)));
- assertEquals(ObjectStreamException.class, findCommonClass (types));
- assertEquals(ObjectStreamException.class, findSpecializedClass(types));
-
- assertTrue(types.add(new FileNotFoundException()));
- assertEquals(IOException.class, findCommonClass (types));
- assertEquals(IOException.class, findSpecializedClass(types));
-
- assertTrue(types.add(new IOException()));
- assertEquals(IOException.class, findCommonClass (types));
- assertEquals(IOException.class, findSpecializedClass(types));
-
- assertTrue(types.add(new Exception()));
- assertEquals( Exception.class, findCommonClass (types));
- assertEquals(IOException.class, findSpecializedClass(types));
- }
-
/**
* Tests {@link Classes#findCommonInterfaces(Class, Class)}.
*/