Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -898,7 +898,7 @@ next: while (--numPts >= 0) { /** * If this transform returns three-dimensional outputs, and if the transform just after this one * just drops the height values, then replaces this transform by a two-dimensional one. - * The intend is to handle the following sequence of operations defined in the EPSG database: + * The intent is to handle the following sequence of operations defined in the EPSG database: * * <ol> * <li>Inverse of <cite>Geographic/geocentric conversions</cite> (EPSG:9602)</li> @@ -978,7 +978,7 @@ next: while (--numPts >= 0) { /** * If this transform expects three-dimensional inputs, and if the transform just before this one * unconditionally sets the height to zero, then replaces this transform by a two-dimensional one. - * The intend is to handle the following sequence of operations defined in the EPSG database: + * The intent is to handle the following sequence of operations defined in the EPSG database: * * <ol> * <li>Inverse of <cite>Geographic 3D to 2D conversion</cite> (EPSG:9659)</li>
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -39,11 +39,26 @@ import org.apache.sis.util.resources.Err * <p>If desired values in decreasing order can be supported by inverting the sign of all values, * then concatenating this transform with a transform that multiply all output values by -1.</p> * + * <div class="section">Extrapolation</div> + * If an input value is outside the expected range of values, this class extrapolates using the + * slope defined by the two first points if the requested value is before, or the slope defined + * by the two last points if the requested value is after. In other words, extrapolations are + * computed using only values at the extremum where extrapolation happen. This rule causes less + * surprising behavior when computing a data cube envelope, which may need extrapolation by 0.5 + * pixel before the first value or after the last value. + * + * <div class="note"><b>Example:</b> + * if a vertical dimension is made of slices at y₀=5, y₁=10, y₂=100 and y₃=250 meters, then linear + * interpolation at 0.5 is 7.5 meters and extrapolation at -0.5 is expected to give 2.5 meters.</div> + * * @author Johann Sorel (Geomatys) * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.7 - * @since 0.7 + * @version 1.0 + * + * @see MathTransforms#interpolate(double[], double[]) + * + * @since 0.7 * @module */ final class LinearInterpolator1D extends AbstractMathTransform1D implements Serializable { @@ -54,15 +69,11 @@ final class LinearInterpolator1D extends /** * The sequence values specified at construction time. + * Must contain at least 2 values. */ private final double[] values; /** - * The average function slope. Used only for extrapolations. - */ - private final double slope; - - /** * If the transform is invertible, the inverse. Otherwise {@code null}. * The transform is invertible only if values are in increasing order. */ @@ -72,15 +83,13 @@ final class LinearInterpolator1D extends * Creates a new transform which will interpolate in the given table of values. * The inputs are {0, 1, … , <var>N</var>} where <var>N</var> is length of output values. * - * <p>This constructor assumes that the {@code values} array have already be clones, - * so it will not clone it again.</p> + * <p>This constructor assumes that the {@code values} array has already been cloned, + * so it will not clone it again. That array shall contain at least two values.</p> * * @param values the <var>y</var> values in <var>y=f(x)</var> where <var>x</var> = {0, 1, … , {@code values.length-1}}. - * @param slope the value to use for extrapolation. */ - private LinearInterpolator1D(final double[] values, final double slope) { + private LinearInterpolator1D(final double[] values) { this.values = values; // Cloning this array is caller's responsibility. - this.slope = slope; double last = values[0]; for (int i=1; i<values.length; i++) { if (!(last <= (last = values[i]))) { // Use '!' for catching NaN values. @@ -93,14 +102,15 @@ final class LinearInterpolator1D extends /** * Creates a transform for the given values. This method returns an affine transform instead than an - * interpolator if the given values form a series with a constant increment. + * interpolator if the given values form a series with a constant increment. The given array shall + * contain at least two values. * * @param values a <strong>copy</strong> of the user-provided values. This array may be modified. */ private static MathTransform1D create(final double[] values) { final int n = values.length - 1; final double offset = values[0]; - double slope = (values[n] - offset) / n; + final double slope = (values[n] - offset) / n; final double as = Math.abs(slope); /* * If the increment between values is constant (with a small tolerance factor), @@ -122,12 +132,11 @@ final class LinearInterpolator1D extends */ final boolean isReverted = (slope < 0); if (isReverted) { - slope = -slope; for (i=0; i <= n; i++) { values[i] = -values[i]; } } - MathTransform1D tr = new LinearInterpolator1D(values, slope); + MathTransform1D tr = new LinearInterpolator1D(values); if (isReverted) { tr = new ConcatenatedTransformDirect1D(tr, LinearTransform1D.NEGATE); } @@ -223,17 +232,21 @@ final class LinearInterpolator1D extends final int n = values.length - 1; if (i < n) { x -= i; - y = values[i] * (1-x) + values[i+1] * x; - d = values[i+1] - values[i]; + final double y0 = values[i ]; + final double y1 = values[i+1]; + y = y0 * (1-x) + y1 * x; + d = y1 - y0; } else { // x is after the last available value. - y = (x - n) * slope + values[n]; - d = slope; + final double y1 = values[n]; + d = y1 - values[n-1]; + y = (x - n) * d + y1; } } else { // x is before the first available value. - y = x * slope + values[0]; - d = slope; + final double y0 = values[0]; + d = values[1] - y0; + y = x * d + y0; } if (dstPts != null) { dstPts[dstOff] = y; @@ -256,11 +269,13 @@ final class LinearInterpolator1D extends return values[i] * (1-x) + values[i+1] * x; } else { // x is after the last available value. - return (x - n) * slope + values[n]; + final double y1 = values[n]; + return (x - n) * (y1 - values[n-1]) + y1; } } else { // x is before the first available value. - return x * slope + values[0]; + final double y0 = values[0]; + return x * (values[1] - y0) + y0; } } @@ -271,13 +286,8 @@ final class LinearInterpolator1D extends */ @Override public double derivative(final double x) { - if (x >= 0) { - final int i = (int) x; - if (i < values.length - 1) { - return values[i+1] - values[i]; - } - } - return slope; + final int i = Math.max(0, Math.min(values.length - 2, (int) x)); + return values[i+1] - values[i]; } /** @@ -307,7 +317,7 @@ final class LinearInterpolator1D extends /** * Combines {@link #transform(double)}, {@link #derivative(double)} in a single method call. - * The intend is to avoid to call {@link Arrays#binarySearch(double[], double)} twice for the + * The intent is to avoid to call {@link Arrays#binarySearch(double[], double)} twice for the * same value. */ @Override @@ -320,7 +330,8 @@ final class LinearInterpolator1D extends int i = Arrays.binarySearch(values, y); if (i >= 0) { x = i; - d = (i >= 1 && i < values.length) ? (values[i] - values[i-1]) : slope; + i = Math.max(1, Math.min(values.length - 1, i)); + d = values[i] - values[i-1]; } else { i = ~i; if (i >= 1) { @@ -330,11 +341,13 @@ final class LinearInterpolator1D extends } else { // y is after the last available value. final int n = values.length - 1; - x = (y - values[n]) / (d = slope) + n; + final double y1 = values[n]; + x = (y - y1) / (d = y1 - values[n-1]) + n; } } else { // y is before the first available value. - x = (y - values[0]) / (d = slope); + final double y0 = values[0]; + x = (y - y0) / (d = values[1] - y0); } } if (dstPts != null) { @@ -361,11 +374,13 @@ final class LinearInterpolator1D extends } else { // y is after the last available value. final int n = values.length - 1; - return (y - values[n]) / slope + n; + final double y1 = values[n]; + return (y - y1) / (y1 - values[n-1]) + n; } } else { // y is before the first available value. - return (y - values[0]) / slope; + final double y0 = values[0]; + return (y - y0) / (values[1] - y0); } } } @@ -380,13 +395,8 @@ final class LinearInterpolator1D extends if (i < 0) { i = ~i; } - final double d; - if (i >= 1 && i < values.length) { - d = (values[i] - values[i-1]); - } else { - d = slope; - } - return 1 / d; + i = Math.max(1, Math.min(values.length - 1, i)); + return 1 / (values[i] - values[i-1]); } } Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -67,7 +67,7 @@ public final strictfp class EnvelopesTes * This transformation can not handle poles. * * <p>This method wraps the math transform into an opaque object for hiding the fact that the given - * transform implement the {@link MathTransform2D} interface. The intend is to disable optimization + * transform implement the {@link MathTransform2D} interface. The intent is to disable optimization * paths (if any), in order to test the generic path.</p> */ @Override Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -113,7 +113,7 @@ public final strictfp class GeographicOf /** * Tests {@code VerticalOffset.createMathTransform(…)} indirectly, through a call to the math transform factory - * with the source and target coordinate systems specified. The intend of this test is to verify that the change + * with the source and target coordinate systems specified. The intent of this test is to verify that the change * of axis direction is properly handled, given source CRS axis direction up and target CRS axis direction down. * * @throws FactoryException if an error occurred while creating the transform. Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -384,7 +384,7 @@ public final strictfp class ParameterMar /** * Tests unmarshalling of a parameter value group. The XML file does not use {@code xlink:href} attributes; - * descriptor definitions are repeated. The intend of this test is to test Apache SIS capability to replace + * descriptor definitions are repeated. The intent of this test is to test Apache SIS capability to replace * duplicates instances by unique instances. * * @throws JAXBException if an error occurred during unmarshalling. Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -107,7 +107,7 @@ public final strictfp class DefaultGeoce } /** - * Tests WKT 1 formatting using axes in kilometres. The intend of this test is to verify that + * Tests WKT 1 formatting using axes in kilometres. The intent of this test is to verify that * the coordinate system replacement documented in {@link #testWKT1()} preserves the axis units. * * @since 0.6 Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -87,7 +87,7 @@ public final strictfp class DefaultGeogr /** * Verifies the {@link CommonCRS#WGS84} identifiers in both normalized and unnormalized CRS. - * The intend is actually to test the replacement of {@code "EPSG:4326"} by {@code "CRS:84"}. + * The intent is actually to test the replacement of {@code "EPSG:4326"} by {@code "CRS:84"}. */ @Test public void testIdentifiers() { Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -77,7 +77,7 @@ public final strictfp class IdentifiedOb CRS84, finder.findSingleton(CRS84)); /* * Same test than above, using a CRS without identifier. - * The intend is to force a full scan. + * The intent is to force a full scan. */ final CoordinateReferenceSystem search = new DefaultGeographicCRS( Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, CRS84.getName()), Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -220,7 +220,7 @@ public final strictfp class EPSGInstalle /* * Following forces the authority factory to iterate over all codes. * Since the iterator returns only non-deprecated codes, EPSG:4329 - * should not be included. The intend is to verify that the fields + * should not be included. The intent is to verify that the fields * of type BOOLEAN have been properly handled. */ codes = new HashSet<>(codes); Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -281,7 +281,7 @@ public final strictfp class CoordinateOp λDimension = new int[] {1}; zDimension = new int[] {2}; double[] source = { - 39.00, -85.00, -10000.00, // The intend of those large height values is to cause a shift in (φ,λ) + 39.00, -85.00, -10000.00, // The intent of those large height values is to cause a shift in (φ,λ) 38.26, -80.58, +10000.00 // large enough for being detected if we fail to use h in calculations. }; double[] target; Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -260,7 +260,7 @@ public final class MercatorMethodCompari /** * Prints the error of the two methods for various eccentricity values. - * The intend of this method is to find an eccentricity threshold value where we consider the errors too high. + * The intent of this method is to find an eccentricity threshold value where we consider the errors too high. * * <p>This method is used for determining empirically a value for {@link ConformalProjection#ECCENTRICITY_THRESHOLD}. * The current threshold value is shown by inserting a horizontal line separator in the table when that threshold Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -122,7 +122,7 @@ public final strictfp class AbridgedMolo } /** - * Tests a deserialized instance. The intend is to verify that the transient fields + * Tests a deserialized instance. The intent is to verify that the transient fields * are correctly recomputed. * * @throws FactoryException if an error occurred while creating a transform step. Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -27,7 +27,7 @@ import static org.junit.Assert.*; /** * Tests {@link CoordinateDomain}. - * The main intend of this class is to allow visual inspection (by looking in source code) of sampled data. + * The main intent of this class is to allow visual inspection (by looking in source code) of sampled data. * * @author Martin Desruisseaux (Geomatys) * @version 0.6 Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -229,7 +229,7 @@ public final strictfp class DefaultMathT assertEquals(classification, 6356256.909237285, param.parameter("semi_minor").doubleValue(), 1E-4); /* * Creates a ProjectedCRS from the map projection. This part is more an integration test than - * a DefaultMathTransformFactory test. Again, the intend is to verify that the properties are + * a DefaultMathTransformFactory test. Again, the intent is to verify that the properties are * the one that we specified. */ final DefaultProjectedCRS crs = new DefaultProjectedCRS(dummyName, Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] (original) +++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -20,6 +20,7 @@ import java.util.Random; import org.opengis.referencing.operation.MathTransform1D; import org.opengis.referencing.operation.NoninvertibleTransformException; import org.opengis.referencing.operation.TransformException; +import org.apache.sis.test.DependsOnMethod; import org.junit.Test; import static org.opengis.test.Assert.*; @@ -30,7 +31,7 @@ import static org.opengis.test.Assert.*; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys). - * @version 0.7 + * @version 1.0 * @since 0.7 * @module */ @@ -237,4 +238,24 @@ public final strictfp class LinearInterp */ verifyInDomain(new double[] {min}, new double[] {max}, new int[] {100}, new Random(randomSeed)); } + + /** + * Tests input values outside the expected range. + * A few values inside ranges are also tested as a safety. + * + * @throws TransformException if an error occurred while testing a value. + */ + @Test + @DependsOnMethod("testIndicesToIncreasingValues") + public void testExtrapolations() throws TransformException { + values = new double[] {5, 10, 100, 250}; + transform = LinearInterpolator1D.create(preimage, values); + derivativeDeltas = new double[] {0.1}; + verifyTransform(new double[] {0, 1, 0.5, -0.5, -1, -2, 3, 3.5, 4, 5}, // Values to transform. + new double[] {5, 10, 7.5, 2.5, 0, -5, 250, 325, 400, 550}); // Expected results. + + verifyDerivative(0.25); // Interpolation (verified by safety) + verifyDerivative(-8); // Extrapolation + verifyDerivative( 8); + } } Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -33,7 +33,7 @@ import org.apache.sis.internal.system.Mo * <ul> * <li>Fetch the list of converters from the content of all * {@code META-INF/services/org.apache.sis.util.ObjectConverter} files found on the classpath. - * The intend is to allow other modules to register their own converters.</li> + * The intent is to allow other modules to register their own converters.</li> * * <li>Apply heuristic rules in addition to the explicitly registered converters. * Those heuristic rules are provided in a separated class in order to keep the Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/ModifiableIdentifierMap.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/ModifiableIdentifierMap.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/ModifiableIdentifierMap.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/ModifiableIdentifierMap.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -60,7 +60,7 @@ public final class ModifiableIdentifierM /** * Sets the {@code xlink:href} value, which may be null. If an explicit {@code xlink:href} identifier exists, - * then it will removed before to set the new {@code href} in the {@link XLink} object. The intend is to give + * then it will removed before to set the new {@code href} in the {@link XLink} object. The intent is to give * precedence to the {@link XLink#getHRef()} property in every cases where the {@code href} is parsable as a * {@link URI}, and use the value associated to the {@code HREF} key only as a fallback when the string can not * be parsed. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -157,7 +157,7 @@ public abstract class PropertyType<Value * @param value the primitive type wrapper. * @param mayBeNil {@code true} if we should check for nil reasons. */ - PropertyType(final BoundType value, final boolean mayBeNil) { + protected PropertyType(final BoundType value, final boolean mayBeNil) { metadata = value; if (mayBeNil) { final Object property = PrimitiveTypeProperties.property(value); Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -116,7 +116,7 @@ public enum DataDirectory { /** * Returns the value of {@value #ENV} environment variable, or {@code null} if none. * This method does not perform any logging and does not verify if the directory exists. - * If the intend is to perform I/O operations, use {@link #getRootDirectory()} instead. + * If the intent is to perform I/O operations, use {@link #getRootDirectory()} instead. * * @return the {@value #ENV} environment variable, or {@code null} if none. * @throws SecurityException if this method is not allowed to query the environment variable. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -195,7 +195,7 @@ public final class DefaultFactories exte * is equal or is a child of the SIS loader, then it is left unchanged. Otherwise the context * class loader is replaced by the SIS one. * - * <p>The intend of this method is to ensure that {@link ServiceLoader#load(Class)} will find the + * <p>The intent of this method is to ensure that {@link ServiceLoader#load(Class)} will find the * Apache SIS services even in an environment that defined an unsuitable context class loader.</p> * * @return the context class loader if suitable, or another class loader otherwise. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -145,7 +145,7 @@ public final class Loggers extends Stati } } /* - * Process the loggers in alphabetical order. The intend is to process parent loggers before child. + * Process the loggers in alphabetical order. The intent is to process parent loggers before child. * The first logger in the map should be the SIS root logger, "org.apache.sis". */ final Iterator<Map.Entry<String,Level>> it = levels.entrySet().iterator(); Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -58,7 +58,7 @@ public final class Semaphores { /** * A flag to indicate that {@link org.apache.sis.referencing.operation.AbstractCoordinateOperation} * is querying parameters of a {@code MathTransform} enclosed in the operation. This is often in the - * intend to format WKT of a {@code "ProjectedCRS"} element. + * intent to format WKT of a {@code "ProjectedCRS"} element. */ public static final int ENCLOSED_IN_OPERATION = 8; Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -22,7 +22,7 @@ import org.apache.sis.util.logging.Loggi /** * Utilities methods for threads. This class declares in a single place every {@link ThreadGroup} used in SIS. - * Their intend is to bring some order in debugger informations, by grouping the threads created by SIS together + * Their intent is to bring some order in debugger informations, by grouping the threads created by SIS together * under the same parent tree node. * * <div class="section">Note on dependencies</div> @@ -39,7 +39,7 @@ final class Threads extends Static { /** * The parent of every threads declared in this class. This parent will be declared as close * as possible to the root of all thread groups (i.e. not as an application thread subgroup). - * The intend is to separate the library thread groups from the user application thread groups. + * The intent is to separate the library thread groups from the user application thread groups. */ static final ThreadGroup SIS; static { Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -31,8 +31,10 @@ import org.apache.sis.util.Static; import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR; +// Branch-dependent imports import org.opengis.referencing.ReferenceIdentifier; + /** * Utility methods working on {@link Citation} objects. The public facade of those methods is * defined in the {@link org.apache.sis.metadata.iso.citation.Citations} class, but the actual @@ -248,25 +250,51 @@ public final class Citations extends Sta */ public static boolean identifierMatches(final Citation citation, final Identifier identifier, final CharSequence code) { if (citation != null && code != null) { - final Iterator<? extends Identifier> identifiers = iterator(citation.getIdentifiers()); - if (identifiers == null) { + final Collection<? extends Identifier> citIds = citation.getIdentifiers(); + Iterator<? extends Identifier> it = iterator(citIds); + if (it == null) { return titleMatches(citation, code); } - while (identifiers.hasNext()) { - final Identifier id = identifiers.next(); - if (id != null && equalsFiltered(code, id.getCode())) { + while (it.hasNext()) { + final Identifier citId = it.next(); + if (citId != null && equalsFiltered(code, citId.getCode())) { + /* + * Found a possible match. We will take the code space in account only if it is defined + * by both identifiers. If a code space is undefined, we consider that we have a match. + */ if (identifier instanceof ReferenceIdentifier) { final String codeSpace = ((ReferenceIdentifier) identifier).getCodeSpace(); - if (codeSpace != null && id instanceof ReferenceIdentifier) { - final String cs = ((ReferenceIdentifier) id).getCodeSpace(); - if (cs != null) { - return equalsFiltered(codeSpace, cs); + if (codeSpace != null && citId instanceof ReferenceIdentifier) { + final String cs = ((ReferenceIdentifier) citId).getCodeSpace(); + if (cs != null && !equalsFiltered(codeSpace, cs)) { + continue; // Check other identifiers. } } } return true; } } + /* + * Before to give up, maybe the given code argument is actually written using a "codeSpace:code" syntax. + * Try to parse that syntax only if no Identifier argument were specified (otherwise we require the code + * and code space to be splitted as defined in the identifier). + */ + if (identifier == null) { + int s = 0; + final int length = code.length(); + while ((s = CharSequences.indexOf(code, DEFAULT_SEPARATOR, s, length)) >= 0) { + final CharSequence codeSpace = code.subSequence(0, s); + final CharSequence localPart = code.subSequence(++s, length); + for (it = citIds.iterator(); it.hasNext();) { + final Identifier id = it.next(); + if (id instanceof ReferenceIdentifier && equalsFiltered(codeSpace, + ((ReferenceIdentifier) id).getCodeSpace()) && equalsFiltered(localPart, id.getCode())) + { + return true; + } + } + } + } } return false; } @@ -461,7 +489,7 @@ public final class Citations extends Sta * <div class="section">When to use</div> * Use this method when assigning values to be returned by methods like {@code Identifier.getCodeSpace()}, * since those values are likely to be compared without special care about ignorable identifier characters. - * But if the intend is to format a more complex string like WKT or {@code toString()}, then we suggest to + * But if the intent is to format a more complex string like WKT or {@code toString()}, then we suggest to * use {@code getIdentifier(citation, true)} instead, which will produce the same result but preserving the * ignorable characters, which can be useful for formatting purpose. * @@ -475,7 +503,16 @@ public final class Citations extends Sta * after we moved the {@code sis-utility} code that use this method. */ public static String getUnicodeIdentifier(final Citation citation) { - final String identifier = getIdentifier(citation, true); + return removeIgnorableCharacters(getIdentifier(citation, true)); + } + + /** + * Removes characters that are ignorable according Unicode specification. + * + * @param identifier the character sequence from which to remove ignorable characters, or {@code null}. + * @return a character sequence with ignorable character removed. May be the same instance than the given argument. + */ + public static String removeIgnorableCharacters(final String identifier) { if (identifier != null) { /* * First perform a quick check to see if there is any ignorable characters. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -586,7 +586,7 @@ public final class CollectionsExt extend /** * Returns a more compact representation of the given map. This method is similar to * {@link #unmodifiableOrCopy(Map)} except that it does not wrap the map in an unmodifiable - * view. The intend is to avoid one level of indirection for performance and memory reasons. + * view. The intent is to avoid one level of indirection for performance and memory reasons. * This is okay only if the map is kept in a private field and never escape outside that class. * * @param <K> the type of keys in the map. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -345,7 +345,7 @@ public final class DoubleDouble extends * SIS often creates matrices for unit conversions, and most conversion factors are defined precisely in base 10. * For example the conversion from feet to metres is defined by a factor of exactly 0.3048, which can not be * represented precisely as a {@code double}. Consequently if a value of 0.3048 is given, we can assume that - * the intend was to provide the "feet to metres" conversion factor and complete the double-double instance + * the intent was to provide the "feet to metres" conversion factor and complete the double-double instance * accordingly. * * @param value the value for which to get this error. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -43,7 +43,7 @@ final class EmptyQueue<E> extends Abstra /** * The singleton instance to be returned by {@link CollectionsExt#emptyQueue()}. - * This is not parameterized on intend. + * This is not parameterized on intent. */ @SuppressWarnings("rawtypes") static final Queue INSTANCE = new EmptyQueue(); Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -76,7 +76,7 @@ public class MetadataServices extends Op if (c == null) { /* * Double-checked locking: okay since Java 5 provided that the 'instance' field is volatile. - * In the particular case of this class, the intend is to ensure that SystemListener.add(…) + * In the particular case of this class, the intent is to ensure that SystemListener.add(…) * is invoked only once. */ c = getInstance(MetadataServices.class, Modules.UTILITIES, "sis-metadata", Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/Appender.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/Appender.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/Appender.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/io/Appender.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -133,7 +133,7 @@ abstract class Appender implements Appen /** * If the given sequence begins with a low surrogate completing a previous high surrogate, - * delegates to {@link #append(char)} and returns {@code start+1}. The intend is to avoid + * delegates to {@link #append(char)} and returns {@code start+1}. The intent is to avoid * processing a character sequence which starts by an invalid code point. * * @param sequence the character sequence to write. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -520,7 +520,7 @@ public abstract class Vector extends Abs * * doubleValue(i) = first + increment*i * - * The intend is that if tolerance = 0 and this method returns a non-null value, then replacing + * The intent is that if tolerance = 0 and this method returns a non-null value, then replacing * this vector by an instance of SequenceVector should produce exactely the same double values. */ if (type >= Numbers.FLOAT && type <= Numbers.DOUBLE) { Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -73,7 +73,7 @@ abstract class AbstractUnit<Q extends Qu * (<strong>not</strong> the UCUM format). In particular, this symbol uses Unicode characters * for arithmetic operators and superscripts, as in “m/s²”. However this symbol should never * contains the unit conversion terms. For example “km” is okay, but “1000⋅m” is not. - * The intend of those rules is to make easier to analyze the symbol in methods like + * The intent of those rules is to make easier to analyze the symbol in methods like * {@link ConventionalUnit#power(String)}. * * <p>Users can override this symbol by call to {@link UnitFormat#label(Unit, String)}, Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -991,7 +991,7 @@ public class AngleFormat extends Format minutes = Math.abs(degrees - (degrees = truncate(degrees))) * 60; /* * Limit the maximal number of fraction digits to the amount of significant digits for a 'double' value. - * The intend is to avoid non-significant garbage that are pure artifacts from the conversion from base + * The intent is to avoid non-significant garbage that are pure artifacts from the conversion from base * 2 to base 10. */ final int n = fractionDigitsForDelta(Math.ulp(angle) * (secondsFieldWidth == 0 ? 60 : 3600), false); Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -459,7 +459,7 @@ public class UnitFormat extends Format i * Returns the unit instance for the given long (un)localized or name. * This method is somewhat the converse of {@link #symbolToName()}, but recognizes also * international and American spelling of unit names in addition of localized names. - * The intend is to recognize "meter" as well as "metre". + * The intent is to recognize "meter" as well as "metre". * * <p>While we said that {@code UnitFormat} is not thread safe, we make an exception for this method * for allowing the singleton {@link #INSTANCE} to parse symbols in a multi-threads environment.</p> Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -1113,7 +1113,7 @@ public final class Units extends Static final LinearConverter ten4 = LinearConverter.scale(10000, 1); /* * All Unit<Angle>. - * 20 is the greatest common denominator between 180 and 200. The intend is to have arguments as small + * 20 is the greatest common denominator between 180 and 200. The intent is to have arguments as small * as possible in the call to the scale(double, double) method, while keeping the right side integer. * Staying closer to zero during conversions helo to reduce rounding errors. */ Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -197,7 +197,7 @@ public final class StringBuilders extend /** * A sequence of a constant character. This implementation does not perform any argument * check since it is for {@link StringBuilder#append(CharSequence, int, int)} usage only. - * The intend is to allow {@code StringBuilder} to append the characters in one operation + * The intent is to allow {@code StringBuilder} to append the characters in one operation * instead than looping on {@link StringBuilder#insert(int, char)} (which would require * memory move on each call). */ Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -532,7 +532,7 @@ public class DefaultTreeTable implements * cast will need to be replaced by an "instanceof" check. */ @Override - @SuppressWarnings("ReturnOfCollectionOrArrayField") // Returned list is modifiable on intend. + @SuppressWarnings("ReturnOfCollectionOrArrayField") // Returned list is modifiable on intent. public final List<TreeTable.Node> getChildren() { if (children == null) { if (isLeaf()) { Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/FrequencySortedSet.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -67,7 +67,7 @@ public class FrequencySortedSet<E> exten * {@code 0} if the element should be sorted in the usual order, or {@code -1} * if the elements should be sorted in reverse order (most frequent element first). * This value is XORed with the number of times <var>n</var> that an element is added: {@code n ^ order}. - * The intend is to store negative numbers in the {@link #count} map if this {@code FrequencySortedSet} + * The intent is to store negative numbers in the {@link #count} map if this {@code FrequencySortedSet} * has been created for reverse order. * * <div class="note"><b>Implementation note:</b> Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -349,7 +349,7 @@ public class DefaultNameSpace implements * Returns a child namespace of the given name. The returned namespace will * have this namespace as its parent, and will use the same separator. * - * <p>The {@link #headSeparator} is not inherited by the children on intend, because this + * <p>The {@link #headSeparator} is not inherited by the children on intent, because this * method is used only by {@link DefaultScopedName} constructors in order to create a * sequence of parsed local names. For example in {@code "http://www.opengeospatial.org"} * the head separator is {@code "://"} for {@code "www"} (which is having this namespace), Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -936,6 +936,11 @@ public final class Errors extends Indexe public static final short UnsupportedFormatVersion_2 = 159; /** + * Format “{0}” is unsupported. + */ + public static final short UnsupportedFormat_1 = 181; + + /** * Can not handle this instance of ‘{0}’ because arbitrary implementations are not yet * supported. */ Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Sat Feb 24 15:36:52 2018 @@ -193,6 +193,7 @@ UnparsableStringForClass_3 = Text UnparsableStringInElement_2 = Can not parse \u201c{1}\u201d in element \u201c{0}\u201d. UnspecifiedCRS = Coordinate reference system has not been specified. UnspecifiedFormatForClass_1 = No format is specified for objects of class \u2018{0}\u2019. +UnsupportedFormat_1 = Format \u201c{0}\u201d is unsupported. UnsupportedFormatVersion_2 = Version {1} of {0} format is not supported. UnsupportedImplementation_1 = Can not handle this instance of \u2018{0}\u2019 because arbitrary implementations are not yet supported. UnsupportedInterpolation_1 = The \u201c{0}\u201d interpolation is unsupported. Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original) +++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Sat Feb 24 15:36:52 2018 @@ -189,6 +189,7 @@ UnspecifiedFormatForClass_1 = Aucu UnparsableStringForClass_2 = Le texte \u00ab\u202f{1}\u202f\u00bb n\u2019est pas reconnu comme un objet de type \u2018{0}\u2019. UnparsableStringForClass_3 = Le texte \u00ab\u202f{1}\u202f\u00bb n\u2019est pas reconnu comme un objet de type \u2018{0}\u2019, \u00e0 cause des caract\u00e8res \u00ab\u202f{2}\u202f\u00bb. UnparsableStringInElement_2 = Le texte \u00ab\u202f{1}\u202f\u00bb dans l\u2019\u00e9l\u00e9ment \u00ab\u202f{0}\u202f\u00bb ne peut pas \u00eatre lu. +UnsupportedFormat_1 = Le format \u00ab\u202f{0}\u202f\u00bb n\u2019est pas support\u00e9. UnsupportedFormatVersion_2 = La version {1} du format {0} n\u2019est pas support\u00e9e. UnsupportedImplementation_1 = Cette instance de \u2018{0}\u2019 ne peut pas \u00eatre g\u00e9r\u00e9e parce que les impl\u00e9mentations arbitraires ne sont pas encore support\u00e9es. UnsupportedInterpolation_1 = L\u2019interpolation \u201c{0}\u201d n\u2019est pas support\u00e9e. Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -33,7 +33,7 @@ import static org.junit.Assert.*; * Tests the internal {@link Citations} class. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 1.0 * @since 0.6 * @module */ @@ -112,4 +112,22 @@ public final strictfp class CitationsTes assertEquals("OGC:06-042", Citations.getIdentifier(citation, false)); assertEquals("ISO_19128", Citations.getIdentifier(citation, true)); } + + /** + * Tests {@link Citations#identifierMatches(Citation, Identifier, CharSequence)}. + */ + @Test + public void testIdentifierMatches() { + final Identifier ogc = identifier("OGC", "06-042"); + final Identifier iso = identifier("ISO", "19128"); + final Citation citation = citation("Web Map Server", ogc, iso, identifier("Foo", "06-042")); + assertTrue ("With full identifier", Citations.identifierMatches(citation, ogc, ogc.getCode())); + assertTrue ("With full identifier", Citations.identifierMatches(citation, iso, iso.getCode())); + assertFalse("With wrong code", Citations.identifierMatches(citation, identifier("ISO", "19115"), "19115")); + assertFalse("With wrong code space", Citations.identifierMatches(citation, identifier("Foo", "19128"), "19128")); + assertFalse("With wrong code", Citations.identifierMatches(citation, null, "Foo")); + assertTrue ("Without identifier", Citations.identifierMatches(citation, null, "19128")); + assertTrue ("With parsing", Citations.identifierMatches(citation, null, "ISO:19128")); + assertFalse("With wrong code space", Citations.identifierMatches(citation, null, "Foo:19128")); + } } Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -104,7 +104,7 @@ public final strictfp class TableAppende /** * Tests the {@link TableAppender#toString()} method. - * The intend of this test is also to ensure that we can use the API + * The intent of this test is also to ensure that we can use the API * more easily, without having to deal with {@link IOException}. */ @Test Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -581,7 +581,7 @@ public abstract strictfp class Annotatio * be non-null here since this is not the job of this test method. This * is because subclasses may choose to override the above test method. */ - if (uml != null) { + if (uml != null && false) { // Disabled until we merged the ISO 19115-3 branch. assertEquals("Wrong @XmlElement.name().", getExpectedXmlElementName(type, uml), element.name()); assertEquals("Wrong @XmlElement.required().", uml.obligation() == Obligation.MANDATORY, element.required()); } Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -65,7 +65,7 @@ public abstract strictfp class TestCase * } * } * - * The intend is to make easier to identify test cases that fail with the current version + * The intent is to make easier to identify test cases that fail with the current version * of SIS (e.g. because of unsupported operations), but should pass in a future version. * * @since 0.4 Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -260,7 +260,7 @@ public abstract strictfp class TestSuite * Simulates a module uninstall after all tests. This method will first notify any classpath-dependant * services that the should clear their cache, then stop the SIS daemon threads. Those operations are * actually not needed in non-server environment (it is okay to just let the JVM stop by itself), but - * the intend here is to ensure that no exception is thrown. + * the intent here is to ensure that no exception is thrown. * * <p>Since this method stops SIS daemon threads, the SIS library shall not be used anymore after * this method execution.</p> Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -165,7 +165,7 @@ public abstract strictfp class XMLTestCa * The file shall be in the same package than a subclass of {@code this}. * This method begins the search in the package of {@link #getClass()}. * If the resource is not found in that package, then this method searches in the parent classes. - * The intend is to allow some test classes to be overridden in different modules. + * The intent is to allow some test classes to be overridden in different modules. * * @param filename the name of the XML file. * @return the URL to the given XML file. Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java [UTF-8] (original) +++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -160,7 +160,7 @@ public final strictfp class IndexedResou /** * Tests the {@link IndexedResourceBundle#getString(short, Object)} method with a {@code CodeList} argument. - * The intend is to test the code list localization. + * The intent is to test the code list localization. */ @Test @DependsOnMethod("testGetStringWithParameter") Modified: sis/trunk/ide-project/NetBeans/build.xml URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/build.xml?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/ide-project/NetBeans/build.xml (original) +++ sis/trunk/ide-project/NetBeans/build.xml Sat Feb 24 15:36:52 2018 @@ -233,6 +233,7 @@ </fileset> <fileset dir="${project.root}/storage/sis-storage/src/test/resources"> <include name="**/*.txt"/> + <include name="**/*.prj"/> <include name="**/*.xml"/> </fileset> <fileset dir="${project.root}/storage/sis-xmlstore/src/test/resources"> Modified: sis/trunk/pom.xml URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/pom.xml (original) +++ sis/trunk/pom.xml Sat Feb 24 15:36:52 2018 @@ -27,7 +27,7 @@ <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> - <version>18</version> + <version>19</version> </parent> @@ -426,14 +426,14 @@ Apache SIS is a free software, Java lang <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> - <version>1.14</version> + <version>1.16.1</version> </dependency> <!-- Databases --> <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> - <version>10.13.1.1</version> + <version>10.14.1.0</version> </dependency> <dependency> <groupId>org.hsqldb</groupId> @@ -444,7 +444,7 @@ Apache SIS is a free software, Java lang <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> - <version>42.1.4</version> + <version>42.2.1</version> <scope>test</scope> </dependency> @@ -664,7 +664,7 @@ Apache SIS is a free software, Java lang <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> - <version>3.3.0</version> + <version>3.5.0</version> <extensions>true</extensions> <configuration> <excludeDependencies>true</excludeDependencies> @@ -682,12 +682,12 @@ Apache SIS is a free software, Java lang <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> - <version>2.17</version> + <version>3.0.0</version> <dependencies> <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> - <version>8.2</version> + <version>8.8</version> </dependency> </dependencies> <executions> @@ -789,7 +789,7 @@ Apache SIS is a free software, Java lang <!-- JavaDoc configuration. --> <plugin> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> <!-- 3.0.0-M1 is required for JDK9, but contains a regression that prevent javadoc:aggregate to work. --> + <version>3.0.0</version> <configuration> <source>${maven.compile.source}</source> <!-- Enables javadoc to handle language constructs present in target JDK. --> <encoding>${project.build.sourceEncoding}</encoding> <!-- Encoding of Java source file. --> Modified: sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java [UTF-8] (original) +++ sis/trunk/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStoreProvider.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -23,7 +23,7 @@ import org.apache.sis.storage.DataStoreE import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.ProbeResult; import org.apache.sis.internal.storage.Capability; -import org.apache.sis.internal.storage.Capabilities; +import org.apache.sis.internal.storage.StoreMetadata; import org.apache.sis.internal.storage.URIDataStore; import org.apache.sis.internal.storage.wkt.FirstKeywordPeek; @@ -37,11 +37,13 @@ import org.apache.sis.internal.storage.w * the part of the caller. However the {@link LandsatStore} instances created by this factory are not thread-safe. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.8 * @module */ -@Capabilities(Capability.READ) +@StoreMetadata(formatName = LandsatStoreProvider.NAME, + fileSuffixes = "txt", + capabilities = Capability.READ) public class LandsatStoreProvider extends DataStoreProvider { /** * The format name. Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] (original) +++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -1369,7 +1369,7 @@ final class CRSBuilder { /** * Map projection parameters to be considered as aliases. This table is used for reading GeoTIFF files - * that are not really well-formed, but for which we can reasonably guess what was the producer intend + * that are not really well-formed, but for which we can reasonably guess what was the producer intent * and which parameters were confused. See {@link #aliases(Map)} for more explanation. */ private static final short[][] PARAMETER_ALIASES = { Modified: sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] (original) +++ sis/trunk/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStoreProvider.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -25,7 +25,7 @@ import org.apache.sis.storage.DataStoreE import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.ProbeResult; import org.apache.sis.storage.StorageConnector; -import org.apache.sis.internal.storage.Capabilities; +import org.apache.sis.internal.storage.StoreMetadata; import org.apache.sis.internal.storage.Capability; import org.apache.sis.internal.storage.URIDataStore; import org.apache.sis.internal.util.Constants; @@ -40,14 +40,16 @@ import org.apache.sis.internal.util.Cons * the part of the caller. However the {@link GeoTiffStore} instances created by this factory are not thread-safe. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * * @see GeoTiffStore * * @since 0.8 * @module */ -@Capabilities(Capability.READ) +@StoreMetadata(formatName = "GeoTIFF", + fileSuffixes = {"tiff", "tif"}, + capabilities = Capability.READ) public class GeoTiffStoreProvider extends DataStoreProvider { /** * The MIME type for GeoTIFF files. Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] (original) +++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfo.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -115,7 +115,7 @@ final class GridGeometryInfo extends Gri public Axis[] getAxes() throws IOException, DataStoreException { /* * Process the variables in the order the appear in the sequence of bytes that make the netCDF files. - * This is often the same order than the indices, but not necessarily. The intend is to reduce the + * This is often the same order than the indices, but not necessarily. The intent is to reduce the * amount of disk seek operations. */ final SortedMap<VariableInfo,Integer> variables = new TreeMap<>(); Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] (original) +++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -32,7 +32,7 @@ import org.apache.sis.internal.netcdf.Re import org.apache.sis.internal.netcdf.impl.ChannelDecoder; import org.apache.sis.internal.netcdf.ucar.DecoderWrapper; import org.apache.sis.internal.storage.io.ChannelDataInput; -import org.apache.sis.internal.storage.Capabilities; +import org.apache.sis.internal.storage.StoreMetadata; import org.apache.sis.internal.storage.Capability; import org.apache.sis.internal.storage.URIDataStore; import org.apache.sis.internal.system.SystemListener; @@ -61,14 +61,16 @@ import org.apache.sis.util.Version; * the part of the caller. However the {@link NetcdfStore} instances created by this factory are not thread-safe. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * * @see NetcdfStore * * @since 0.3 * @module */ -@Capabilities(Capability.READ) +@StoreMetadata(formatName = NetcdfStoreProvider.NAME, + fileSuffixes = "nc", + capabilities = Capability.READ) public class NetcdfStoreProvider extends DataStoreProvider { /** * The format name. Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Capability.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -30,7 +30,7 @@ import org.apache.sis.util.iso.Types; /** - * One aspect in the set of capabilities of a class annotated by {@link Capabilities}. + * Capabilities of a class annotated by {@link StoreMetadata}. * * <p>This is not a committed API since the way to represent data store capabilities is likely to change.</p> * @@ -83,10 +83,10 @@ public enum Capability { /* * Build a slash-separated list of capabilities. Example: "Read / write". */ - final Capabilities annotation = provider.getClass().getAnnotation(Capabilities.class); + final StoreMetadata metadata = provider.getClass().getAnnotation(StoreMetadata.class); String capabilities = null; - if (annotation != null) { - for (final Capability c : annotation.value()) { + if (metadata != null) { + for (final Capability c : metadata.capabilities()) { final String e = resources.getString(c.resourceKey); capabilities = (capabilities == null) ? e : resources.getString( Vocabulary.Keys.SlashSeparatedList_2, capabilities, e.toLowerCase(locale)); Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -46,7 +46,7 @@ public abstract class DocumentedStorePro /** * {@code true} if the call to {@link #getFormat()} caught an exception. In such case, * we log a warning only the first time and use a finer logging level the other times. - * The intend is to avoid polluting the logs with too many warnings. + * The intent is to avoid polluting the logs with too many warnings. */ private volatile boolean logged; Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?rev=1825249&r1=1825248&r2=1825249&view=diff ============================================================================== --- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] (original) +++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] Sat Feb 24 15:36:52 2018 @@ -868,6 +868,25 @@ public class MetadataBuilder { } /** + * Adds a data and/or metadata identifier. This method performs the same work than + * {@link #addIdentifier(CharSequence, String, Scope)} for situations where the + * identifier instance is already available. + * + * @param id the identifier, or {@code null} if none. + * @param scope whether the date applies to data, to metadata or to both. + * + * @see #addIdentifier(CharSequence, String, Scope) + */ + public final void addIdentifier(Identifier id, final Scope scope) { + ArgumentChecks.ensureNonNull("scope", scope); + if (id != null) { + id = (Identifier) sharedValues.getOrDefault(id, id); + if (scope != Scope.RESOURCE) metadata().setMetadataIdentifier(id); + if (scope != Scope.METADATA) addIfNotPresent(citation().getIdentifiers(), id); + } + } + + /** * Adds a resource (data) identifier, a metadata identifier, or both as they are often the same. * The identifier is added only if {@code code} is non-null, regardless other argument values. * Empty strings (ignoring spaces) are ignored. @@ -884,6 +903,7 @@ public class MetadataBuilder { * * @see #addTitle(CharSequence) * @see #addTitleOrIdentifier(String, Scope) + * @see #addIdentifier(Identifier, Scope) */ public final void addIdentifier(final CharSequence authority, String code, final Scope scope) { ArgumentChecks.ensureNonNull("scope", scope);
