You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2017/01/17 06:53:18 UTC
svn commit: r1779145 [1/2] - in /sis/trunk: ./
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/
core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/
core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/s...
Author: desruisseaux
Date: Tue Jan 17 06:53:18 2017
New Revision: 1779145
URL: http://svn.apache.org/viewvc?rev=1779145&view=rev
Log:
Merge from the JDK7 branch.
Added:
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
- copied unchanged from r1779143, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Acyclic.java
- copied unchanged from r1779143, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Acyclic.java
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SurjectiveConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemConverter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/AdapterReplacement.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/ModifiableIdentifierMap.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/PrimitiveTypeProperties.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 17 06:53:18 2017
@@ -1,5 +1,5 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394364-1758914
-/sis/branches/JDK7:1394913-1778899
-/sis/branches/JDK8:1584960-1778893
+/sis/branches/JDK7:1394913-1779143
+/sis/branches/JDK8:1584960-1779142
/sis/branches/JDK9:1773327-1773512
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultExtent.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -113,10 +113,10 @@ public class DefaultExtent extends ISOMe
* While a valid {@code Extent} requires at least one component to be non-null,
* this constructor does not perform such verification.
*
- * @param description A description, or {@code null} if none.
- * @param geographicElements A geographic component, or {@code null} if none.
- * @param verticalElements A vertical component, or {@code null} if none.
- * @param temporalElements A temporal component, or {@code null} if none.
+ * @param description a description, or {@code null} if none.
+ * @param geographicElements a geographic component, or {@code null} if none.
+ * @param verticalElements a vertical component, or {@code null} if none.
+ * @param temporalElements a temporal component, or {@code null} if none.
*/
public DefaultExtent(final CharSequence description,
final GeographicExtent geographicElements,
@@ -134,7 +134,7 @@ public class DefaultExtent extends ISOMe
* This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the
* given object are not recursively copied.
*
- * @param object The metadata to copy values from, or {@code null} if none.
+ * @param object the metadata to copy values from, or {@code null} if none.
*
* @see #castOrCopy(Extent)
*/
@@ -162,8 +162,8 @@ public class DefaultExtent extends ISOMe
* metadata contained in the given object are not recursively copied.</li>
* </ul>
*
- * @param object The object to get as a SIS implementation, or {@code null} if none.
- * @return A SIS implementation containing the values of the given object (may be the
+ * @param object the object to get as a SIS implementation, or {@code null} if none.
+ * @return a SIS implementation containing the values of the given object (may be the
* given object itself), or {@code null} if the argument was null.
*/
public static DefaultExtent castOrCopy(final Extent object) {
@@ -176,7 +176,7 @@ public class DefaultExtent extends ISOMe
/**
* Returns the spatial and temporal extent for the referring object.
*
- * @return The spatial and temporal extent, or {@code null} in none.
+ * @return the spatial and temporal extent, or {@code null} in none.
*/
@Override
@XmlElement(name = "description")
@@ -187,7 +187,7 @@ public class DefaultExtent extends ISOMe
/**
* Sets the spatial and temporal extent for the referring object.
*
- * @param newValue The new description.
+ * @param newValue the new description.
*/
public void setDescription(final InternationalString newValue) {
checkWritePermission();
@@ -197,7 +197,7 @@ public class DefaultExtent extends ISOMe
/**
* Provides geographic component of the extent of the referring object
*
- * @return The geographic extent, or an empty set if none.
+ * @return the geographic extent, or an empty set if none.
*/
@Override
@XmlElement(name = "geographicElement")
@@ -208,7 +208,7 @@ public class DefaultExtent extends ISOMe
/**
* Sets geographic component of the extent of the referring object.
*
- * @param newValues The new geographic elements.
+ * @param newValues the new geographic elements.
*/
public void setGeographicElements(final Collection<? extends GeographicExtent> newValues) {
geographicElements = writeCollection(newValues, geographicElements, GeographicExtent.class);
@@ -217,7 +217,7 @@ public class DefaultExtent extends ISOMe
/**
* Provides vertical component of the extent of the referring object.
*
- * @return The vertical extent, or an empty set if none.
+ * @return the vertical extent, or an empty set if none.
*/
@Override
@XmlElement(name = "verticalElement")
@@ -228,7 +228,7 @@ public class DefaultExtent extends ISOMe
/**
* Sets vertical component of the extent of the referring object.
*
- * @param newValues The new vertical elements.
+ * @param newValues the new vertical elements.
*/
public void setVerticalElements(final Collection<? extends VerticalExtent> newValues) {
verticalElements = writeCollection(newValues, verticalElements, VerticalExtent.class);
@@ -237,7 +237,7 @@ public class DefaultExtent extends ISOMe
/**
* Provides temporal component of the extent of the referring object.
*
- * @return The temporal extent, or an empty set if none.
+ * @return the temporal extent, or an empty set if none.
*/
@Override
@XmlElement(name = "temporalElement")
@@ -248,7 +248,7 @@ public class DefaultExtent extends ISOMe
/**
* Sets temporal component of the extent of the referring object.
*
- * @param newValues The new temporal elements.
+ * @param newValues the new temporal elements.
*/
public void setTemporalElements(final Collection<? extends TemporalExtent> newValues) {
temporalElements = writeCollection(newValues, temporalElements, TemporalExtent.class);
@@ -262,7 +262,7 @@ public class DefaultExtent extends ISOMe
*
* <p><b>Note:</b> this method is available only if the referencing module is on the classpath.</p>
*
- * @param envelope The envelope to use for inferring the additional extents.
+ * @param envelope the envelope to use for inferring the additional extents.
* @throws UnsupportedOperationException if the referencing module is not on the classpath.
* @throws TransformException if a coordinate transformation was required and failed.
*
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultGeographicBoundingBox.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.metadata.iso.extent;
+import java.util.Objects;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@@ -37,9 +38,6 @@ import org.apache.sis.xml.NilReason;
import static java.lang.Double.doubleToLongBits;
-// Branch-dependent imports
-import java.util.Objects;
-
/**
* Geographic position of the dataset. This is only an approximate so specifying the coordinate
@@ -289,7 +287,7 @@ public class DefaultGeographicBoundingBo
*/
public void setWestBoundLongitude(double newValue) {
checkWritePermission();
- if (newValue != Longitude.MAX_VALUE) { // Do not normalize +180� to -180�.
+ if (newValue != Longitude.MAX_VALUE) { // Do not normalize +180� to -180�.
newValue = Longitude.normalize(newValue);
}
westBoundLongitude = newValue;
@@ -322,7 +320,7 @@ public class DefaultGeographicBoundingBo
*/
public void setEastBoundLongitude(double newValue) {
checkWritePermission();
- if (newValue != Longitude.MAX_VALUE) { // Do not normalize +180� to -180�.
+ if (newValue != Longitude.MAX_VALUE) { // Do not normalize +180� to -180�.
newValue = Longitude.normalize(newValue);
}
eastBoundLongitude = newValue;
@@ -405,7 +403,7 @@ public class DefaultGeographicBoundingBo
private static void verifyBounds(final double southBoundLatitude, final double northBoundLatitude)
throws IllegalArgumentException
{
- if (southBoundLatitude > northBoundLatitude) { // Accept NaN.
+ if (southBoundLatitude > northBoundLatitude) { // Accept NaN.
throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalOrdinateRange_3,
new Latitude(southBoundLatitude), new Latitude(northBoundLatitude),
Vocabulary.format(Vocabulary.Keys.Latitude)));
@@ -421,7 +419,7 @@ public class DefaultGeographicBoundingBo
southBoundLatitude = Latitude.clamp(southBoundLatitude);
northBoundLatitude = Latitude.clamp(northBoundLatitude);
final double span = eastBoundLongitude - westBoundLongitude;
- if (!(span >= (Longitude.MAX_VALUE - Longitude.MIN_VALUE))) { // 'span' may be NaN.
+ if (!(span >= (Longitude.MAX_VALUE - Longitude.MIN_VALUE))) { // 'span' may be NaN.
westBoundLongitude = Longitude.normalize(westBoundLongitude);
eastBoundLongitude = Longitude.normalize(eastBoundLongitude);
if (span != 0) {
@@ -513,7 +511,7 @@ public class DefaultGeographicBoundingBo
ArgumentChecks.ensureNonNull("envelope", envelope);
checkWritePermission();
ReferencingServices.getInstance().setBounds(envelope, this);
- setInclusion(Boolean.TRUE); // Set only on success.
+ setInclusion(Boolean.TRUE); // Set only on success.
}
/**
@@ -650,7 +648,7 @@ public class DefaultGeographicBoundingBo
*/
final boolean i1 = getInclusion(this.getInclusion());
final boolean i2 = getInclusion(box. getInclusion());
- final int status = denormalize(\u03bbmin, \u03bbmax); // Must be after call to getInclusion().
+ final int status = denormalize(\u03bbmin, \u03bbmax); // Must be after call to getInclusion().
switch (status) {
case -1: \u03bbmin -= Longitude.MAX_VALUE - Longitude.MIN_VALUE; break;
case +1: \u03bbmax += Longitude.MAX_VALUE - Longitude.MIN_VALUE; break;
@@ -753,9 +751,11 @@ public class DefaultGeographicBoundingBo
if (object == this) {
return true;
}
- // Above code really requires DefaultGeographicBoundingBox.class, not getClass().
- // This code is used only for performance raison. The super-class implementation
- // is generic enough for all other cases.
+ /*
+ * Above code really requires DefaultGeographicBoundingBox.class, not getClass().
+ * This code is used only for performance raison. The super-class implementation
+ * is generic enough for all other cases.
+ */
if (object != null && object.getClass() == DefaultGeographicBoundingBox.class) {
final DefaultGeographicBoundingBox that = (DefaultGeographicBoundingBox) object;
return Objects.equals(getInclusion(), that.getInclusion()) &&
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/Extents.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -128,8 +128,10 @@ public final class Extents extends Stati
if (element instanceof GeographicBoundingBox) {
final GeographicBoundingBox item = (GeographicBoundingBox) element;
if (bounds == null) {
- // We use DefaultGeographicBoundingBox.getInclusion(Boolean) below because
- // add(\u2026) method that we use cares about the case where inclusion is false.
+ /*
+ * We use DefaultGeographicBoundingBox.getInclusion(Boolean) below because
+ * add(\u2026) method that we use cares about the case where inclusion is false.
+ */
if (DefaultGeographicBoundingBox.getInclusion(item.getInclusion())) {
bounds = item;
}
@@ -307,7 +309,7 @@ public final class Extents extends Stati
final Date startTime, endTime;
if (t instanceof DefaultTemporalExtent) {
final DefaultTemporalExtent dt = (DefaultTemporalExtent) t;
- startTime = dt.getStartTime(); // Maybe user has overridden those methods.
+ startTime = dt.getStartTime(); // Maybe user has overridden those methods.
endTime = dt.getEndTime();
} else {
final TemporalPrimitive p = t.getExtent();
@@ -358,7 +360,7 @@ public final class Extents extends Stati
Date endTime = null;
if (t instanceof DefaultTemporalExtent) {
final DefaultTemporalExtent dt = (DefaultTemporalExtent) t;
- if (location != 1) startTime = dt.getStartTime(); // Maybe user has overridden those methods.
+ if (location != 1) startTime = dt.getStartTime(); // Maybe user has overridden those methods.
if (location != 0) endTime = dt.getEndTime();
} else {
final TemporalPrimitive p = t.getExtent();
@@ -421,8 +423,17 @@ public final class Extents extends Stati
if (box == null) {
return Double.NaN;
}
- double \u0394\u03bb = box.getEastBoundLongitude() - box.getWestBoundLongitude(); // Negative if spanning the anti-meridian
- \u0394\u03bb -= floor(\u0394\u03bb / (Longitude.MAX_VALUE - Longitude.MIN_VALUE)) * (Longitude.MAX_VALUE - Longitude.MIN_VALUE);
+ double \u0394\u03bb = box.getEastBoundLongitude() - box.getWestBoundLongitude();
+ final double span = Longitude.MAX_VALUE - Longitude.MIN_VALUE;
+ if (\u0394\u03bb > span) {
+ \u0394\u03bb = span;
+ } else if (\u0394\u03bb < 0) {
+ if (\u0394\u03bb < -span) {
+ \u0394\u03bb = -span;
+ } else {
+ \u0394\u03bb += span;
+ }
+ }
return (AUTHALIC_RADIUS * AUTHALIC_RADIUS) * toRadians(\u0394\u03bb) *
max(0, sin(toRadians(box.getNorthBoundLatitude())) -
sin(toRadians(box.getSouthBoundLatitude())));
Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -127,6 +127,11 @@ public final strictfp class ExtentsTest
box.setNorthBoundLatitude(-90+MINUTE);
assertEquals(499.5, Extents.area(box), 0.1);
/*
+ * Spanning 360� of longitude.
+ */
+ box.setBounds(-180, +180, -90, 90);
+ assertEquals(5.1E+14, Extents.area(box), 1E+11);
+ /*
* EPSG:1241 USA - CONUS including EEZ
* This is only an anti-regression test - the value has not been validated.
* However the expected area MUST be greater than the Alaska's one below,
@@ -134,7 +139,7 @@ public final strictfp class ExtentsTest
*/
box.setBounds(-129.16, -65.70, 23.82, 49.38);
assertFalse(DefaultGeographicBoundingBoxTest.isSpanningAntiMeridian(box));
- assertEquals(15967665, Extents.area(box) / 1E6, 1); // Compare in km�
+ assertEquals(15967665, Extents.area(box) / 1E6, 1); // Compare in km�
/*
* EPSG:2373 USA - Alaska including EEZ (spanning the anti-meridian).
* This is only an anti-regression test - the value has not been validated.
@@ -142,6 +147,6 @@ public final strictfp class ExtentsTest
*/
box.setBounds(167.65, -129.99, 47.88, 74.71);
assertTrue(DefaultGeographicBoundingBoxTest.isSpanningAntiMeridian(box));
- assertEquals(9845438, Extents.area(box) / 1E6, 1); // Compare in km�
+ assertEquals(9845438, Extents.area(box) / 1E6, 1); // Compare in km�
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -35,6 +35,7 @@ import org.opengis.referencing.crs.Coord
import org.opengis.referencing.crs.CRSAuthorityFactory;
import org.opengis.referencing.crs.GeodeticCRS;
import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.GeneralDerivedCRS;
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.crs.TemporalCRS;
import org.opengis.referencing.crs.VerticalCRS;
@@ -269,6 +270,164 @@ public final class CRS extends Static {
}
/**
+ * Suggests a coordinate reference system which could be a common target for coordinate operations having the
+ * given sources. This method compares the {@linkplain #getGeographicBoundingBox(CoordinateReferenceSystem)
+ * domain of validity} of all given CRSs. If a CRS has a domain of validity that contains the domain of all other
+ * CRS, than that CRS is returned. Otherwise this method verifies if a {@linkplain GeneralDerivedCRS#getBaseCRS()
+ * base CRS} (usually a {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS} instance)
+ * would be suitable. If no suitable CRS is found, then this method returns {@code null}.
+ *
+ * <div class="note"><b>Use case:</b>
+ * before to test if two arbitrary envelopes {@linkplain GeneralEnvelope#intersects(Envelope) intersect} each other,
+ * they need to be {@linkplain Envelopes#transform(Envelope, CoordinateReferenceSystem) transformed} in the same CRS.
+ * However if one CRS is a Transverse Mercator projection while the other CRS is a world-wide geographic CRS, then
+ * attempts to use the Transverse Mercator projection as the common CRS is likely to fail since the geographic envelope
+ * may span an area far outside the projection domain of validity. This {@code suggestTargetCRS(\u2026)} method can used
+ * for choosing a common CRS which is less likely to fail.</div>
+ *
+ * @param regionOfInterest the geographic area for which the coordinate operations will be applied,
+ * or {@code null} if unknown.
+ * @param sourceCRS the coordinate reference systems for which a common target CRS is desired.
+ * @return a CRS that may be used as a common target for all the given source CRS in the given region of interest,
+ * or {@code null} if this method did not find a common target CRS. The returned CRS may be different than
+ * all given CRS.
+ *
+ * @since 0.8
+ */
+ public static CoordinateReferenceSystem suggestTargetCRS(GeographicBoundingBox regionOfInterest,
+ CoordinateReferenceSystem... sourceCRS)
+ {
+ /*
+ * Compute the union of the domain of validity of all CRS. If a CRS does not specify a domain of validity,
+ * then assume that the CRS is valid for the whole world if the CRS is geodetic or return null otherwise.
+ * Opportunistically remember the domain of validity of each CRS in this loop since we will need them later.
+ */
+ boolean worldwide = false;
+ DefaultGeographicBoundingBox domain = null;
+ final GeographicBoundingBox[] domains = new GeographicBoundingBox[sourceCRS.length];
+ for (int i=0; i < sourceCRS.length; i++) {
+ final CoordinateReferenceSystem crs = sourceCRS[i];
+ GeographicBoundingBox bbox = getGeographicBoundingBox(crs);
+ if (bbox == null) {
+ /*
+ * If no domain of validity is specified and we can not fallback
+ * on some knowledge about what the CRS is, abandon.
+ */
+ if (!(crs instanceof GeodeticCRS)) {
+ return null;
+ }
+ /*
+ * If no region of interest has been specified, conservatively assume that the caller is
+ * interested in a worldwide area. Since we have a Geodetic CRS, we will not find better.
+ */
+ if (regionOfInterest == null) {
+ return crs;
+ }
+ /*
+ * Geodetic CRS (geographic or geocentric) can generally be presumed valid in a worldwide area.
+ * Since the caller has specified an area of interest, that will be taken as our validity domain.
+ * The 'worldwide' flag is a little optimization for remembering that we do not need to compute
+ * the union anymore, but we still need to continue the loop for fetching all bounding boxes.
+ */
+ bbox = regionOfInterest;
+ worldwide = true;
+ } else if (!worldwide) {
+ if (domain == null) {
+ domain = new DefaultGeographicBoundingBox(bbox);
+ } else {
+ domain.add(bbox);
+ }
+ }
+ domains[i] = bbox;
+ }
+ /*
+ * At this point we got the union of the domain of validity of all CRS. We are interested only in the
+ * part that intersect the region of interest. If the union is whole world, we do not need to compute
+ * the intersection; we can just leave the region of interest unchanged.
+ */
+ if (domain != null && !worldwide) {
+ if (regionOfInterest != null) {
+ domain.intersect(regionOfInterest);
+ }
+ regionOfInterest = domain;
+ domain = null;
+ }
+ /*
+ * Iterate again over the domain of validity of all CRS. For each domain of validity, compute the area
+ * which is inside the domain or interest and the area which is outside. The "best CRS" will be the one
+ * which comply with the following rules, in preference order:
+ *
+ * 1) The CRS which is valid over the largest area of the region of interest.
+ * 2) If two CRS are equally good according rule 1, then the CRS with the smallest "outside area".
+ *
+ * Example: given two source CRS, a geographic one and a projected one:
+ *
+ * - If the projected CRS contains fully the region of interest, then it will be returned.
+ * The preference is given to the projected CRS because geometric are likely to be more
+ * accurate in that space. Furthermore forward conversions from geographic to projected
+ * CRS are usually faster than inverse conversions.
+ *
+ * - Otherwise (i.e. if the region of interest is likely to be wider than the projected CRS
+ * domain of validity), then the geographic CRS will be returned.
+ */
+ CoordinateReferenceSystem bestCRS = null;
+ final double roiArea = Extents.area(regionOfInterest); // NaN if 'regionOfInterest' is null.
+ double maxInsideArea = 0;
+ double minOutsideArea = Double.POSITIVE_INFINITY;
+ boolean tryDerivedCRS = false;
+ do {
+ for (int i=0; i < domains.length; i++) {
+ final GeographicBoundingBox bbox = domains[i];
+ double insideArea = Extents.area(bbox);
+ double outsideArea = 0;
+ if (regionOfInterest != null) {
+ if (domain == null) {
+ domain = new DefaultGeographicBoundingBox(bbox);
+ } else {
+ domain.setBounds(bbox);
+ }
+ domain.intersect(regionOfInterest);
+ final double area = insideArea;
+ insideArea = Extents.area(domain);
+ outsideArea = area - insideArea;
+ }
+ if (insideArea > maxInsideArea || (insideArea == maxInsideArea && outsideArea < minOutsideArea)) {
+ maxInsideArea = insideArea;
+ minOutsideArea = outsideArea;
+ bestCRS = sourceCRS[i];
+ }
+ }
+ /*
+ * If the best CRS does not cover fully the region of interest, then we will redo the check again
+ * but using base CRS instead. For example if the list of source CRS had some projected CRS, we
+ * will try with the geographic CRS on which those projected CRS are based.
+ */
+ if (maxInsideArea < roiArea) {
+ if (tryDerivedCRS) break; // Do not try twice.
+ final CoordinateReferenceSystem[] derivedCRS = new CoordinateReferenceSystem[sourceCRS.length];
+ for (int i=0; i < derivedCRS.length; i++) {
+ GeographicBoundingBox bbox = null;
+ final CoordinateReferenceSystem crs = sourceCRS[i];
+ if (crs instanceof GeneralDerivedCRS) {
+ final CoordinateReferenceSystem baseCRS = ((GeneralDerivedCRS) crs).getBaseCRS();
+ bbox = getGeographicBoundingBox(baseCRS);
+ if (bbox == null) {
+ bbox = regionOfInterest;
+ }
+ tryDerivedCRS = true;
+ derivedCRS[i] = baseCRS;
+ }
+ domains[i] = bbox;
+ }
+ sourceCRS = derivedCRS;
+ } else {
+ break;
+ }
+ } while (tryDerivedCRS);
+ return bestCRS;
+ }
+
+ /**
* Finds a mathematical operation that transforms or converts coordinates from the given source to the
* given target coordinate reference system. If an estimation of the geographic area containing the points
* to transform is known, it can be specified for helping this method to find a better suited operation.
@@ -382,9 +541,8 @@ public final class CRS extends Static {
/**
* Returns the valid geographic area for the given coordinate operation, or {@code null} if unknown.
* This method explores the {@linkplain AbstractCoordinateOperation#getDomainOfValidity() domain of validity}
- * associated with the given operation. If more than one geographic bounding box is found, then they will be
- * {@linkplain org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox#add(GeographicBoundingBox) added}
- * together.
+ * associated with the given operation. If more than one geographic bounding box is found, then this method
+ * computes their {@linkplain DefaultGeographicBoundingBox#add(GeographicBoundingBox) union}.
*
* @param operation the coordinate operation for which to get the domain of validity, or {@code null}.
* @return the geographic area where the operation is valid, or {@code null} if unspecified.
@@ -403,8 +561,8 @@ public final class CRS extends Static {
/**
* Returns the valid geographic area for the given coordinate reference system, or {@code null} if unknown.
* This method explores the {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getDomainOfValidity() domain of
- * validity} associated with the given CRS. If more than one geographic bounding box is found, then they will be
- * {@linkplain org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox#add(GeographicBoundingBox) added}
+ * validity} associated with the given CRS. If more than one geographic bounding box is found, then this method
+ * computes their {@linkplain DefaultGeographicBoundingBox#add(GeographicBoundingBox) union}.
* together.
*
* @param crs the coordinate reference system for which to get the domain of validity, or {@code null}.
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -29,7 +29,7 @@ import org.opengis.parameter.GeneralPara
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.cs.CartesianCS;
-import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
+import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
import org.opengis.referencing.datum.Ellipsoid;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.operation.Conversion;
@@ -137,12 +137,12 @@ public class DefaultProjectedCRS extends
* for performing {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes unit
* conversions and change of axis order} since those operations will be inferred by this constructor.
*
- * @param properties The properties to be given to the new derived CRS object.
- * @param baseCRS Coordinate reference system to base the derived CRS on.
- * @param conversion The defining conversion from a {@linkplain AxesConvention#NORMALIZED normalized} base
- * to a normalized derived CRS.
- * @param derivedCS The coordinate system for the derived CRS. The number of axes
- * must match the target dimension of the {@code baseToDerived} transform.
+ * @param properties the properties to be given to the new derived CRS object.
+ * @param baseCRS coordinate reference system to base the derived CRS on.
+ * @param conversion the defining conversion from a {@linkplain AxesConvention#NORMALIZED normalized}
+ * base to a normalized derived CRS.
+ * @param derivedCS the coordinate system for the derived CRS. The number of axes must match
+ * the target dimension of the {@code baseToDerived} transform.
* @throws MismatchedDimensionException if the source and target dimensions of {@code baseToDerived}
* do not match the dimensions of {@code base} and {@code derivedCS} respectively.
*
@@ -164,7 +164,7 @@ public class DefaultProjectedCRS extends
*
* <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
*
- * @param crs The coordinate reference system to copy.
+ * @param crs the coordinate reference system to copy.
*
* @see #castOrCopy(ProjectedCRS)
*/
@@ -178,8 +178,8 @@ public class DefaultProjectedCRS extends
* Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
* Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
*
- * @param object The object to get as a SIS implementation, or {@code null} if none.
- * @return A SIS implementation containing the values of the given object (may be the
+ * @param object the object to get as a SIS implementation, or {@code null} if none.
+ * @return a SIS implementation containing the values of the given object (may be the
* given object itself), or {@code null} if the argument was null.
*/
public static DefaultProjectedCRS castOrCopy(final ProjectedCRS object) {
@@ -215,7 +215,7 @@ public class DefaultProjectedCRS extends
/**
* Returns the datum of the {@linkplain #getBaseCRS() base CRS}.
*
- * @return The datum of the base CRS.
+ * @return the datum of the base CRS.
*/
@Override
public GeodeticDatum getDatum() {
@@ -228,10 +228,10 @@ public class DefaultProjectedCRS extends
* the {@linkplain org.apache.sis.referencing.operation.DefaultConversion#getSourceCRS() source}
* of the {@linkplain #getConversionFromBase() conversion from base}.
*
- * @return The base coordinate reference system, which must be geographic.
+ * @return the base coordinate reference system, which must be geographic.
*/
@Override
- @XmlElement(name = "baseGeodeticCRS", required = true) // Note: older GML version used "baseGeographicCRS".
+ @XmlElement(name = "baseGeodeticCRS", required = true) // Note: older GML version used "baseGeographicCRS".
public GeographicCRS getBaseCRS() {
final Projection projection = super.getConversionFromBase();
return (projection != null) ? (GeographicCRS) projection.getSourceCRS() : null;
@@ -251,7 +251,7 @@ public class DefaultProjectedCRS extends
* <div class="note"><b>Note:</b>
* This is different than ISO 19111, which allows source and target CRS to be {@code null}.</div>
*
- * @return The map projection from base CRS to this CRS.
+ * @return the map projection from base CRS to this CRS.
*/
@Override
public Projection getConversionFromBase() {
@@ -264,8 +264,10 @@ public class DefaultProjectedCRS extends
@Override
@XmlElement(name = "cartesianCS", required = true)
public final CartesianCS getCoordinateSystem() {
- // See AbstractDerivedCRS.createConversionFromBase(\u2026) for
- // an explanation about why this method is declared final.
+ /*
+ * See AbstractDerivedCRS.createConversionFromBase(\u2026) for
+ * an explanation about why this method is declared final.
+ */
return (CartesianCS) super.getCoordinateSystem();
}
@@ -297,10 +299,10 @@ public class DefaultProjectedCRS extends
* then axis order of the base geographic CRS are ignored
* (but <strong>not</strong> axis order of <strong>this</strong> projected CRS).
*
- * @param object The object to compare to {@code this}.
- * @param mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison, or
- * {@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} for comparing only properties
- * relevant to coordinate transformations.
+ * @param object the object to compare to {@code this}.
+ * @param mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison, or
+ * {@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} for comparing only
+ * properties relevant to coordinate transformations.
* @return {@code true} if both objects are equal.
*/
@Override
@@ -403,10 +405,10 @@ public class DefaultProjectedCRS extends
final Parameters p = new Parameters(this);
final boolean isBaseCRS;
if (isWKT1) {
- p.append(formatter); // Format outside of any "Conversion" element.
+ p.append(formatter); // Format outside of any "Conversion" element.
isBaseCRS = false;
} else {
- formatter.append(p); // Format inside a "Conversion" element.
+ formatter.append(p); // Format inside a "Conversion" element.
isBaseCRS = isBaseCRS(formatter);
}
/*
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -16,18 +16,28 @@
*/
package org.apache.sis.referencing;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Arrays;
import org.opengis.util.FactoryException;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.crs.GeodeticCRS;
import org.opengis.referencing.crs.SingleCRS;
+import org.opengis.referencing.cs.CartesianCS;
import org.apache.sis.referencing.crs.DefaultCompoundCRS;
import org.apache.sis.referencing.crs.DefaultGeographicCRS;
-import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.referencing.crs.DefaultProjectedCRS;
+import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.metadata.iso.extent.DefaultExtent;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Utilities;
// Test imports
+import org.apache.sis.referencing.operation.HardCodedConversions;
+import org.apache.sis.referencing.crs.HardCodedCRS;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -139,6 +149,71 @@ public final strictfp class CRSTest exte
}
/**
+ * Tests {@link CRS#suggestTargetCRS(GeographicBoundingBox, CoordinateReferenceSystem...)}.
+ *
+ * @since 0.8
+ */
+ @Test
+ public void testSuggestTargetCRS() {
+ /*
+ * Prepare 4 CRS with different datum (so we can more easily differentiate them in the assertions) and
+ * different domain of validity. CRS[1] is given a domain large enough for all CRS except the last one.
+ */
+ final Map<String,Object> properties = new HashMap<>(4);
+ final CartesianCS cs = (CartesianCS) StandardDefinitions.createCoordinateSystem(Constants.EPSG_PROJECTED_CS);
+ final ProjectedCRS[] crs = new ProjectedCRS[4];
+ for (int i=0; i<crs.length; i++) {
+ final CommonCRS baseCRS;
+ final double ymin, ymax;
+ switch (i) {
+ case 0: baseCRS = CommonCRS.WGS84; ymin = 2; ymax = 4; break;
+ case 1: baseCRS = CommonCRS.WGS72; ymin = 1; ymax = 4; break;
+ case 2: baseCRS = CommonCRS.SPHERE; ymin = 2; ymax = 3; break;
+ case 3: baseCRS = CommonCRS.NAD27; ymin = 3; ymax = 5; break;
+ default: throw new AssertionError(i);
+ }
+ properties.put(DefaultProjectedCRS.NAME_KEY, "CRS #" + i);
+ properties.put(DefaultProjectedCRS.DOMAIN_OF_VALIDITY_KEY, new DefaultExtent(
+ null, new DefaultGeographicBoundingBox(-1, +1, ymin, ymax), null, null));
+ crs[i] = new DefaultProjectedCRS(properties, baseCRS.geographic(), HardCodedConversions.MERCATOR, cs);
+ }
+ final ProjectedCRS[] overlappingCRS = Arrays.copyOf(crs, 3); // Exclude the last CRS only.
+ /*
+ * Test between the 3 overlapping CRS without region of interest. We expect the CRS having a domain
+ * of validity large enough for all CRS; this is the second CRS created in above 'switch' statement.
+ */
+ assertSame("Expected CRS with widest domain of validity.", crs[1],
+ CRS.suggestTargetCRS(null, overlappingCRS));
+ /*
+ * If we specify a smaller region of interest, we should get the CRS having the smallest domain of validity that
+ * cover the ROI. Following lines gradually increase the ROI size and verify that we get CRS for larger domain.
+ */
+ final DefaultGeographicBoundingBox regionOfInterest = new DefaultGeographicBoundingBox(-1, +1, 2.1, 2.9);
+ assertSame("Expected best fit for [2.1 \u2026 2.9]�N", crs[2],
+ CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+
+ regionOfInterest.setNorthBoundLatitude(3.1);
+ assertSame("Expected best fit for [2.1 \u2026 3.1]�N", crs[0],
+ CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+
+ regionOfInterest.setSouthBoundLatitude(1.9);
+ assertSame("Expected best fit for [1.9 \u2026 3.1]�N", crs[1],
+ CRS.suggestTargetCRS(regionOfInterest, overlappingCRS));
+ /*
+ * All above tests returned one of the CRS in the given array. Test now a case where none of those CRS
+ * have a domain of validity wide enough, so suggestTargetCRS(\u2026) need to search among the base CRS.
+ */
+ assertSame("Expected a GeodeticCRS since none of the ProjectedCRS have a domain of validity wide enough.",
+ crs[0].getBaseCRS(), CRS.suggestTargetCRS(null, crs));
+ /*
+ * With the same domain of validity than above, suggestTargetCRS(\u2026) should not need to fallback on the
+ * base CRS anymore.
+ */
+ assertSame("Expected best fit for [1.9 \u2026 3.1]�N", crs[1],
+ CRS.suggestTargetCRS(regionOfInterest, crs));
+ }
+
+ /**
* Tests {@link CRS#isHorizontalCRS(CoordinateReferenceSystem)}.
*/
@Test
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -112,7 +112,7 @@ public final strictfp class DefaultConve
*
* @param useGreenwich {@code true} for using Greenwich prime meridian in the {@code targetCRS},
* or {@code false} for staying on the Paris one.
- * @return A pseudo-conversion performing a longitude rotation.
+ * @return a pseudo-conversion performing a longitude rotation.
*/
public static DefaultConversion createLongitudeRotation(final boolean useGreenwich) {
return createLongitudeRotation(HardCodedCRS.NTF_NORMALIZED_AXES,
@@ -125,9 +125,9 @@ public final strictfp class DefaultConve
* at least conceptually. See {@link #createLongitudeRotation(boolean)} for an explanation about why
* this is not really a valid conversion.
*
- * @param sourceCRS A CRS using the Paris prime meridian.
- * @param targetCRS A CRS using the Greenwich prime meridian.
- * @param interpolationCRS A dummy interpolation CRS, or {@code null} if none.
+ * @param sourceCRS a CRS using the Paris prime meridian.
+ * @param targetCRS a CRS using the Greenwich prime meridian.
+ * @param interpolationCRS a dummy interpolation CRS, or {@code null} if none.
*/
private static DefaultConversion createLongitudeRotation(final GeographicCRS sourceCRS,
final GeographicCRS targetCRS, final TemporalCRS interpolationCRS)
@@ -148,8 +148,8 @@ public final strictfp class DefaultConve
final ParameterValueGroup pg = method.getParameters().createValue();
pg.parameter("Longitude offset").setValue(OFFSET);
final Matrix rotation = Matrices.createDiagonal(
- targetDim + interpDim + 1, // Number of rows.
- sourceDim + interpDim + 1); // Number of columns.
+ targetDim + interpDim + 1, // Number of rows.
+ sourceDim + interpDim + 1); // Number of columns.
rotation.setElement(interpDim, interpDim + sourceDim, OFFSET);
/*
* In theory we should not need to provide the parameters explicitly to the constructor since
@@ -218,7 +218,7 @@ public final strictfp class DefaultConve
* <div class="note"><b>Note:</b>
* By contrast, {@link #testSpecialize()} will test swapping axis order in the <em>target</em> CRS.</div>
*
- * @throws FactoryException Should not happen in this test.
+ * @throws FactoryException if an error occurred while creating the conversion.
*/
@Test
@DependsOnMethod("testConstruction")
@@ -257,7 +257,7 @@ public final strictfp class DefaultConve
* <div class="note"><b>Note:</b>
* By contrast, {@link #testDefiningConversion()} tested swapping axis order in the <em>source</em> CRS.</div>
*
- * @throws FactoryException Should not happen in this test.
+ * @throws FactoryException if an error occurred while creating the conversion.
*/
@Test
@DependsOnMethod("testDefiningConversion")
@@ -300,7 +300,7 @@ public final strictfp class DefaultConve
* staying to a strict interpretation like "the meridian passing through the main telescope",
* that meridian would indeed more with time.</div>
*
- * @throws FactoryException Should not happen in this test.
+ * @throws FactoryException if an error occurred while creating the conversion.
*/
@Test
@DependsOnMethod("testDefiningConversion")
@@ -329,7 +329,7 @@ public final strictfp class DefaultConve
/**
* Ensures that {@link DefaultConversion#specialize DefaultConversion.specialize(\u2026)} verifies the datum.
*
- * @throws FactoryException Should not happen in this test.
+ * @throws FactoryException if an error occurred while creating the conversion.
*/
@Test
public void testDatumCheck() throws FactoryException {
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=1779145&r1=1779144&r2=1779145&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] Tue Jan 17 06:53:18 2017
@@ -69,7 +69,7 @@ public final strictfp class DefaultMathT
/**
* Returns the factory to use for the tests.
*
- * @return The factory to use for the tests.
+ * @return the factory to use for the tests.
*/
static DefaultMathTransformFactory factory() {
final MathTransformFactory factory = DefaultFactories.forClass(MathTransformFactory.class);
@@ -82,7 +82,7 @@ public final strictfp class DefaultMathT
/**
* Tests the {@link DefaultMathTransformFactory#getOperationMethod(String)} method.
*
- * @throws NoSuchIdentifierException Should never happen.
+ * @throws NoSuchIdentifierException if the operation was not found.
*/
@Test
public void testGetOperationMethod() throws NoSuchIdentifierException {
@@ -118,7 +118,7 @@ public final strictfp class DefaultMathT
/**
* Tests the {@link DefaultMathTransformFactory#getAvailableMethods(Class)} method.
*
- * @throws NoSuchIdentifierException Should never happen.
+ * @throws NoSuchIdentifierException if the operation was not found.
*/
@Test
@DependsOnMethod("testGetOperationMethod")
@@ -145,7 +145,7 @@ public final strictfp class DefaultMathT
* Asks for names which are known to be duplicated. One of the duplicated elements is deprecated.
* However Apache SIS uses the same implementation.
*
- * @throws NoSuchIdentifierException Should never happen.
+ * @throws NoSuchIdentifierException if the operation was not found.
*/
@Test
public void testDuplicatedNames() throws NoSuchIdentifierException {
@@ -202,8 +202,10 @@ public final strictfp class DefaultMathT
try {
mt = mtFactory.createParameterizedTransform(param);
} catch (InvalidGeodeticParameterException e) {
- // Some map projections have mandatory parameters which we ignore for now
- // except for a few well-known projection that we know should not fail.
+ /*
+ * Some map projections have mandatory parameters which we ignore for now
+ * except for a few well-known projection that we know should not fail.
+ */
if (classification.contains("Mercator")) {
throw e;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -35,34 +35,61 @@ import org.apache.sis.math.FunctionPrope
* @module
*/
public final class AngleConverter extends SystemConverter<Angle,Double> {
- /** For cross-version compatibility. */
+ /**
+ * For cross-version compatibility.
+ */
private static final long serialVersionUID = -5124032874967170238L;
- /** The unique instance. */
+ /**
+ * The unique instance.
+ */
static final AngleConverter INSTANCE = new AngleConverter();
- /** Creates a new converter. */
- public AngleConverter() { // Instantiated by ServiceLoader.
+ /**
+ * Creates a new converter.
+ */
+ public AngleConverter() { // Instantiated by ServiceLoader.
super(Angle.class, Double.class);
}
- /** Returns the unique instance. */
- @Override public ObjectConverter<Angle,Double> unique() {
+ /**
+ * Returns the unique instance.
+ *
+ * @return unique instance.
+ */
+ @Override
+ public ObjectConverter<Angle,Double> unique() {
return INSTANCE;
}
- /** Returns the inverse converter. */
- @Override public ObjectConverter<Double,Angle> inverse() {
+ /**
+ * Returns the inverse converter.
+ *
+ * @return {@link Inverse}.
+ */
+ @Override
+ public ObjectConverter<Double,Angle> inverse() {
return Inverse.INSTANCE;
}
- /** Declares that the converter is bijective. */
- @Override public Set<FunctionProperty> properties() {
+ /**
+ * Declares that the converter is bijective.
+ *
+ * @return injective and surjective function properties (among others).
+ */
+ @Override
+ public Set<FunctionProperty> properties() {
return bijective();
}
- /** Converts the given angle. */
- @Override public Double apply(final Angle object) {
+ /**
+ * Converts the given angle.
+ *
+ * @param object the angle to convert.
+ * @return angular value in degrees.
+ */
+ @Override
+ public Double apply(final Angle object) {
return object.degrees();
}
@@ -74,34 +101,61 @@ public final class AngleConverter extend
* This class is immutable, and thus inherently thread-safe.
*/
public static final class Inverse extends SystemConverter<Double,Angle> {
- /** For cross-version compatibility. */
+ /**
+ * For cross-version compatibility.
+ */
private static final long serialVersionUID = -1736966474591258159L;
- /** The unique instance. */
+ /**
+ * The unique instance.
+ */
static final Inverse INSTANCE = new Inverse();
- /** Creates a new converter. */
- public Inverse() { // Instantiated by ServiceLoader.
+ /**
+ * Creates a new converter.
+ */
+ public Inverse() { // Instantiated by ServiceLoader.
super(Double.class, Angle.class);
}
- /** Returns the unique instance. */
- @Override public ObjectConverter<Double,Angle> unique() {
+ /**
+ * Returns the unique instance.
+ *
+ * @return the unique instance.
+ */
+ @Override
+ public ObjectConverter<Double,Angle> unique() {
return INSTANCE;
}
- /** Returns the inverse converter. */
- @Override public ObjectConverter<Angle,Double> inverse() {
+ /**
+ * Returns the inverse converter.
+ *
+ * @return {@link AngleConverter}.
+ */
+ @Override
+ public ObjectConverter<Angle,Double> inverse() {
return AngleConverter.INSTANCE;
}
- /** Declares that the converter is bijective. */
- @Override public Set<FunctionProperty> properties() {
+ /**
+ * Declares that the converter is bijective.
+ *
+ * @return injective and surjective function properties (among others).
+ */
+ @Override
+ public Set<FunctionProperty> properties() {
return bijective();
}
- /** Converts the given angle. */
- @Override public Angle apply(final Double object) {
+ /**
+ * Converts the given angle.
+ *
+ * @param object angular value in degrees.
+ * @return the angle object for the given value.
+ */
+ @Override
+ public Angle apply(final Double object) {
return new Angle(object);
}
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -55,8 +55,8 @@ final class CharSequenceConverter<T> ext
/**
* Creates a new converter from {@link CharSequence} to the given target type.
*
- * @param targetClass The target class requested by the user.
- * @param next The converter to apply after this one.
+ * @param targetClass the target class requested by the user.
+ * @param next the converter to apply after this one.
*/
CharSequenceConverter(final Class<T> targetClass, final ObjectConverter<? super String, ? extends T> next) {
super(CharSequence.class, targetClass);
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -34,8 +34,8 @@ import org.apache.sis.util.Debug;
* for {@link ConverterRegistry}. Subclasses should also be immutable, but this requirement is not as strong
* as for {@code ClassPair} (because subclasses are not used as keys in hash map).
*
- * @param <S> The base type of source objects.
- * @param <T> The base type of converted objects.
+ * @param <S> the base type of source objects.
+ * @param <T> the base type of converted objects.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
@@ -61,8 +61,8 @@ class ClassPair<S,T> implements Serializ
/**
* Creates an entry for the given source and target classes.
*
- * @param sourceClass The {@linkplain ObjectConverter#getSourceClass() source class}.
- * @param targetClass The {@linkplain ObjectConverter#getTargetClass() target class}.
+ * @param sourceClass the {@linkplain ObjectConverter#getSourceClass() source class}.
+ * @param targetClass the {@linkplain ObjectConverter#getTargetClass() target class}.
*/
ClassPair(final Class<S> sourceClass, final Class<T> targetClass) {
this.sourceClass = sourceClass;
@@ -84,7 +84,7 @@ class ClassPair<S,T> implements Serializ
*
* The target class is left unchanged.
*
- * @return A key for the parent source, or {@code null}.
+ * @return a key for the parent source, or {@code null}.
*/
final ClassPair<? super S, T> parentSource() {
final Class<? super S> source;
@@ -94,7 +94,7 @@ class ClassPair<S,T> implements Serializ
if (interfaces.length == 0) {
return null;
}
- source = interfaces[0]; // Take only the first interface declaration; ignore others.
+ source = interfaces[0]; // Take only the first interface declaration; ignore others.
} else {
source = sourceClass.getSuperclass();
if (source == null) {
@@ -133,7 +133,7 @@ class ClassPair<S,T> implements Serializ
* doing the same conversions. However the {@link SystemConverter} subclass overrides this
* method with an additional safety check.</p>
*
- * @param other The object to compare with this {@code ClassPair}.
+ * @param other the object to compare with this {@code ClassPair}.
* @return {@code true} if the given object is a {@code ClassPair}
* having the same source and target classes.
*/
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -66,7 +66,7 @@ abstract class CollectionConverter<T> ex
private static final long serialVersionUID = -8680976097058177832L;
@SuppressWarnings("unchecked")
- public List() { // Instantiated by ServiceLoader.
+ public List() { // Instantiated by ServiceLoader.
super((Class) java.util.List.class);
}
@@ -90,7 +90,7 @@ abstract class CollectionConverter<T> ex
private static final long serialVersionUID = -1065360595793529078L;
@SuppressWarnings("unchecked")
- public Set() { // Instantiated by ServiceLoader.
+ public Set() { // Instantiated by ServiceLoader.
super((Class) java.util.Set.class);
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -155,11 +155,11 @@ public class ConverterRegistry {
* If {@code existing} or one of its children is equals to the given {@code converter},
* returns it. Otherwise returns {@code null}.
*
- * @param <S> The {@code converter} source class.
- * @param <T> The {@code converter} target class.
- * @param converter The converter to replace by an existing converter, if possible.
- * @param existing Existing converter to test.
- * @return A converter equals to {@code converter}, or {@code null} if none.
+ * @param <S> the {@code converter} source class.
+ * @param <T> the {@code converter} target class.
+ * @param converter the converter to replace by an existing converter, if possible.
+ * @param existing existing converter to test.
+ * @return a converter equals to {@code converter}, or {@code null} if none.
*/
@SuppressWarnings("unchecked")
private static <S,T> ObjectConverter<S,T> findEquals(ObjectConverter<S,T> converter,
@@ -182,10 +182,10 @@ public class ConverterRegistry {
/**
* Returns a converter equals to the given {@code converter}, or {@code null} if none.
*
- * @param <S> The {@code converter} source class.
- * @param <T> The {@code converter} target class.
- * @param converter The converter to replace by an existing converter, if possible.
- * @return A converter equals to {@code converter}, or {@code null} if none.
+ * @param <S> the {@code converter} source class.
+ * @param <T> the {@code converter} target class.
+ * @param converter the converter to replace by an existing converter, if possible.
+ * @return a converter equals to {@code converter}, or {@code null} if none.
*/
@SuppressWarnings("unchecked")
final <S,T> ObjectConverter<S,T> findEquals(final SystemConverter<S,T> converter) {
@@ -239,9 +239,9 @@ public class ConverterRegistry {
* {@link #find(Class, Class)} is invoked, because we can not know the set of all
* sub-classes in advance (and would not necessarily want to register all of them anyway).
*
- * @param <S> The class of source value.
- * @param <T> The class of target (converted) values.
- * @param converter The converter to register.
+ * @param <S> the class of source value.
+ * @param <T> the class of target (converted) values.
+ * @param converter the converter to register.
*/
public <S,T> void register(final ObjectConverter<S,T> converter) {
ArgumentChecks.ensureNonNull("converter", converter);
@@ -334,8 +334,8 @@ public class ConverterRegistry {
* chain of fallbacks.</li>
* </ul>
*
- * @param key The key under which to register the converter.
- * @param converter The converter to register.
+ * @param key the key under which to register the converter.
+ * @param converter the converter to register.
*/
@SuppressWarnings("unchecked")
private <S,T> void register(final ClassPair<S,T> key, ObjectConverter<S, ? extends T> converter) {
@@ -403,11 +403,11 @@ public class ConverterRegistry {
* ensures that the converter source and target classes are the same ones
* than the classes given in argument to this method.
*
- * @param <S> The source class.
- * @param <T> The target class.
- * @param sourceClass The source class.
- * @param targetClass The target class, or {@code Object.class} for any.
- * @return The converter from the specified source class to the target class.
+ * @param <S> the source class.
+ * @param <T> the target class.
+ * @param sourceClass the source class.
+ * @param targetClass the target class, or {@code Object.class} for any.
+ * @return the converter from the specified source class to the target class.
* @throws UnconvertibleObjectException if no converter is found for the given classes.
*/
@SuppressWarnings("unchecked")
@@ -428,11 +428,11 @@ public class ConverterRegistry {
* This method may return a converter accepting more generic sources or
* converting to more specific targets.
*
- * @param <S> The source class.
- * @param <T> The target class.
- * @param sourceClass The source class.
- * @param targetClass The target class, or {@code Object.class} for any.
- * @return The converter from the specified source class to the target class.
+ * @param <S> the source class.
+ * @param <T> the target class.
+ * @param sourceClass the source class.
+ * @param targetClass the target class, or {@code Object.class} for any.
+ * @return the converter from the specified source class to the target class.
* @throws UnconvertibleObjectException if no converter is found for the given classes.
*/
public <S,T> ObjectConverter<? super S, ? extends T> find(final Class<S> sourceClass, final Class<T> targetClass)
@@ -450,7 +450,7 @@ public class ConverterRegistry {
* found on the classpath and try again.
*/
if (!isInitialized) {
- isInitialized = true; // Before 'initialize()' for preventing infinite recursivity.
+ isInitialized = true; // Before 'initialize()' for preventing infinite recursivity.
initialize();
converter = get(key);
if (converter != null) {
@@ -509,11 +509,11 @@ public class ConverterRegistry {
* would fit, and returns {@code null} in all other cases.
* Subclasses can override this method in order to generate some converters dynamically.</p>
*
- * @param <S> The source class.
- * @param <T> The target class.
- * @param sourceClass The source class.
- * @param targetClass The target class, or {@code Object.class} for any.
- * @return A newly generated converter from the specified source class to the target class,
+ * @param <S> the source class.
+ * @param <T> the target class.
+ * @param sourceClass the source class.
+ * @param targetClass the target class, or {@code Object.class} for any.
+ * @return a newly generated converter from the specified source class to the target class,
* or {@code null} if none.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@@ -530,7 +530,7 @@ public class ConverterRegistry {
* of those leafs are {@link FallbackConverter}s which delegate their work to the
* leafs.
*
- * @return A string representation of registered converters.
+ * @return a string representation of registered converters.
*/
@Debug
@Override
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -51,8 +51,8 @@ import org.apache.sis.util.Debug;
* This class is immutable, and thus inherently thread-safe,
* if the converters given to the static factory method are also immutable.
*
- * @param <S> The base type of source objects.
- * @param <T> The base type of converted objects.
+ * @param <S> the base type of source objects.
+ * @param <T> the base type of converted objects.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
@@ -83,10 +83,10 @@ final class FallbackConverter<S,T> exten
* Creates a converter using the given primary and fallback converters. This method may
* interchange the two converters in order to meet the {@linkplain #fallback} contract.
*
- * @param sourceClass The {@linkplain #getSourceClass() source class}.
- * @param targetClass The {@linkplain #getTargetClass() target class}.
- * @param primary A first converter.
- * @param fallback A second converter.
+ * @param sourceClass the {@linkplain #getSourceClass() source class}.
+ * @param targetClass the {@linkplain #getTargetClass() target class}.
+ * @param primary a first converter.
+ * @param fallback a second converter.
*
* @see #create(ObjectConverter, ObjectConverter)
*/
@@ -108,8 +108,8 @@ final class FallbackConverter<S,T> exten
* Returns {@code true} if the given primary and fallback converters should be interchanged.
* This method may invoke itself recursively.
*
- * @param primary The primary converter to test.
- * @param fallbackClass The target class of the fallback converter to test.
+ * @param primary the primary converter to test.
+ * @param fallbackClass the target class of the fallback converter to test.
* @return {@code true} if the given primary and fallback converters should be interchanged.
*/
private static <S> boolean needSwap(final ObjectConverter<S,?> primary, final Class<?> fallbackClass) {
@@ -145,11 +145,11 @@ final class FallbackConverter<S,T> exten
* This restriction exists because the tree built in such case would probably not be the
* desired one. It should be okay if only SIS code deal with {@code FallbackConverter}.
*
- * @param <S> The base type of source objects.
- * @param <T> The base type of converted objects.
- * @param primary The first converter, which may be a {@code Fallback} tree.
- * @param fallback A new fallback to insert in the converters tree.
- * @return A tree of converters which contains the given {@code converter}. May be either
+ * @param <S> the base type of source objects.
+ * @param <T> the base type of converted objects.
+ * @param primary the first converter, which may be a {@code Fallback} tree.
+ * @param fallback a new fallback to insert in the converters tree.
+ * @return a tree of converters which contains the given {@code converter}. May be either
* {@code existing}, {@code converter} or a new {@code FallbackConverter} instance.
*/
public static <S,T> ObjectConverter<S, ? extends T> merge(
@@ -210,12 +210,12 @@ final class FallbackConverter<S,T> exten
* <strong>not</strong> a {@code FallbackConverter} instance.
* See {@link #merge(ObjectConverter, ObjectConverter)} javadoc for more information.</p>
*
- * @param <S> The source class of the {@code branch} converter.
- * @param <T> The target class of the {@code branch} converter
- * @param branch The converter to eventually merge with {@code converter}.
- * @param converter The converter to eventually merge with {@code branch}.
- * @param parentTarget To be given verbatim to {@link #merge(ObjectConverter, Class)}.
- * @return The merged converter, or {@code null} if the {@code converter}
+ * @param <S> the source class of the {@code branch} converter.
+ * @param <T> the target class of the {@code branch} converter
+ * @param branch the converter to eventually merge with {@code converter}.
+ * @param converter the converter to eventually merge with {@code branch}.
+ * @param parentTarget to be given verbatim to {@link #merge(ObjectConverter, Class)}.
+ * @return the merged converter, or {@code null} if the {@code converter}
* target class is not a subtype of the {@code branch} target class.
*/
private static <S,T> ObjectConverter<S, ? extends T> mergeIfSubtype(
@@ -258,10 +258,10 @@ final class FallbackConverter<S,T> exten
* other {@code FallbackConverter} instances, then this method will follow those
* branches.
*
- * @param converter The converter to merge with {@code this}.
- * @param parentTarget If this method is invoked recursively, the target class
+ * @param converter the converter to merge with {@code this}.
+ * @param parentTarget if this method is invoked recursively, the target class
* of the parent {@code FallbackConverter}. Otherwise {@code null}.
- * @return The merged converter.
+ * @return the merged converter.
*/
private ObjectConverter<S, ? extends T> merge(final ObjectConverter<S, ? extends T> converter,
final Class<? super T> parentTarget)
@@ -330,8 +330,8 @@ final class FallbackConverter<S,T> exten
* Creates a node for the given converter and adds it to the given tree.
* This method invokes itself recursively for scanning through fallbacks.
*
- * @param converter The converter for which to create a tree.
- * @param addTo The node in which to add the converter.
+ * @param converter the converter for which to create a tree.
+ * @param addTo the node in which to add the converter.
*/
private void toTree(final ObjectConverter<?,?> converter, TreeTable.Node addTo) {
if (converter instanceof FallbackConverter<?,?>) {
@@ -346,11 +346,10 @@ final class FallbackConverter<S,T> exten
}
/**
- * Adds a simplified tree representation of this {@code FallbackConverter}
- * to the given node.
+ * Adds a simplified tree representation of this {@code FallbackConverter} to the given node.
*
- * @param addTo The node in which to add the converter.
- * @param isNew {@code true} if {@code addTo} is a newly created node.
+ * @param addTo the node in which to add the converter.
+ * @param isNew {@code true} if {@code addTo} is a newly created node.
*/
final void toTree(final TreeTable.Node addTo, final boolean isNew) {
if (isNew) {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/IdentityConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -28,8 +28,8 @@ import org.apache.sis.math.FunctionPrope
* <div class="section">Immutability and thread safety</div>
* This class is immutable and thus inherently thread-safe.
*
- * @param <S> The base type of source objects.
- * @param <T> The base type of converted objects.
+ * @param <S> the base type of source objects.
+ * @param <T> the base type of converted objects.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3
@@ -52,9 +52,9 @@ public final class IdentityConverter<S e
/**
* Creates a new identity converter.
*
- * @param sourceClass The {@linkplain #getSourceClass() source class}.
- * @param targetClass The {@linkplain #getTargetClass() target class}.
- * @param inverse The inverse converter, or {@code null} if none.
+ * @param sourceClass the {@linkplain #getSourceClass() source class}.
+ * @param targetClass the {@linkplain #getTargetClass() target class}.
+ * @param inverse the inverse converter, or {@code null} if none.
*/
@SuppressWarnings("unchecked")
public IdentityConverter(final Class<S> sourceClass, final Class<T> targetClass,
@@ -74,7 +74,7 @@ public final class IdentityConverter<S e
* for bulk operations between {@code EnumSet} instances. Those optimizations are lost (at
* least on JDK6) is we wrap the {@code EnumSet} in a {@code Collections.unmodifiableSet} view.
*
- * @return The manners in which source values are mapped to target values.
+ * @return the manners in which source values are mapped to target values.
*/
@Override
public Set<FunctionProperty> properties() {
@@ -88,7 +88,7 @@ public final class IdentityConverter<S e
/**
* Returns the inverse converter, if any.
*
- * @return A converter for converting instances of <var>T</var> back to instances of <var>S</var>.
+ * @return a converter for converting instances of <var>T</var> back to instances of <var>S</var>.
*/
@Override
public ObjectConverter<T,S> inverse() throws UnsupportedOperationException {
@@ -98,8 +98,8 @@ public final class IdentityConverter<S e
/**
* Returns the given object unchanged.
*
- * @param source The value to convert.
- * @return The given value unchanged.
+ * @param source the value to convert.
+ * @return the given value unchanged.
*/
@Override
public T apply(final S source) {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -43,8 +43,8 @@ import org.apache.sis.util.resources.Err
* <div class="section">Immutability and thread safety</div>
* This class and all inner classes are immutable, and thus inherently thread-safe.
*
- * @param <S> The source number type.
- * @param <T> The target number type.
+ * @param <S> the source number type.
+ * @param <T> the target number type.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
@@ -80,8 +80,10 @@ final class NumberConverter<S extends Nu
*/
@Override
public ObjectConverter<T,S> inverse() throws UnsupportedOperationException {
- // No need to synchronize. This is not a big deal if the same object is fetched twice.
- // The ConverterRegistry clas provides the required synchronization.
+ /*
+ * No need to synchronize. This is not a big deal if the same object is fetched twice.
+ * The ConverterRegistry clas provides the required synchronization.
+ */
ObjectConverter<T,S> candidate = inverse;
if (candidate == null) try {
inverse = candidate = SystemRegistry.INSTANCE.findExact(targetClass, sourceClass);
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ObjectToString.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -37,7 +37,7 @@ import org.apache.sis.math.FunctionPrope
* <div class="section">Immutability and thread safety</div>
* This base class and all inner classes are immutable, and thus inherently thread-safe.
*
- * @param <S> The source type.
+ * @param <S> the source type.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
@@ -94,7 +94,7 @@ class ObjectToString<S> extends SystemCo
@Override
public final ObjectConverter<S, String> unique() {
if (inverse != null) {
- return inverse.unique().inverse(); // Will typically delegate to StringConverter.
+ return inverse.unique().inverse(); // Will typically delegate to StringConverter.
}
return this;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java?rev=1779145&r1=1779144&r2=1779145&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java [UTF-8] Tue Jan 17 06:53:18 2017
@@ -19,6 +19,8 @@ package org.apache.sis.internal.converte
import java.util.Set;
import java.util.EnumSet;
import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.net.URL;
import java.net.URI;
import java.net.MalformedURLException;
@@ -27,10 +29,6 @@ import org.apache.sis.math.FunctionPrope
import org.apache.sis.util.ObjectConverter;
import org.apache.sis.util.UnconvertibleObjectException;
-// Branch-specific import
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
/**
* Handles conversions between {@link Path}, {@link File}, {@link URI} and {@link URL} objects.
@@ -69,9 +67,9 @@ abstract class PathConverter<S,T> extend
* This method verifies that the given path is non-null,
* then delegates to {@link #doConvert(S)}.
*
- * @param source The path to convert, or {@code null}.
- * @return The converted value, or {@code null} if the given path was null.
- * @throws UnconvertibleObjectException If an error occurred during the conversion.
+ * @param source the path to convert, or {@code null}.
+ * @return the converted value, or {@code null} if the given path was null.
+ * @throws UnconvertibleObjectException if an error occurred during the conversion.
*/
@Override
public final T apply(final S source) throws UnconvertibleObjectException {
@@ -89,9 +87,9 @@ abstract class PathConverter<S,T> extend
* Invoked by {@link #apply(Object)} for converting the given path to the target
* type of this converter.
*
- * @param source The path to convert, guaranteed to be non-null.
- * @return The converted path.
- * @throws Exception If an error occurred during the conversion.
+ * @param source the path to convert, guaranteed to be non-null.
+ * @return the converted path.
+ * @throws Exception if an error occurred during the conversion.
*/
abstract T doConvert(S source) throws Exception;