Author: desruisseaux
Date: Mon Dec 17 17:45:54 2012
New Revision: 1423051
URL: http://svn.apache.org/viewvc?rev=1423051&view=rev
Log:
Merge from the JDK7 branch.
Modified:
sis/branches/JDK6/ (props changed)
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1422801-1423049
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
Mon Dec 17 17:45:54 2012
@@ -301,11 +301,7 @@ parse: while (i < length) {
final long bits = doubleToLongBits(getOrdinate(i));
code = 31 * code + (((int) bits) ^ (int) (bits >>> 32));
}
- final CoordinateReferenceSystem crs = getCoordinateReferenceSystem();
- if (crs != null) {
- code += crs.hashCode();
- }
- return code;
+ return code + Objects.hashCode(getCoordinateReferenceSystem());
}
/**
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
Mon Dec 17 17:45:54 2012
@@ -72,12 +72,12 @@ class ArrayEnvelope extends AbstractEnve
CoordinateReferenceSystem crs;
/**
- * Constructs an envelope defined by two direct positions.
+ * Constructs an envelope defined by two corners given as direct positions.
* If at least one corner is associated to a CRS, then the new envelope
will also
* be associated to that CRS.
*
- * @param lowerCorner The lower corner.
- * @param upperCorner The upper corner.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @throws MismatchedDimensionException If the two positions do not have
the same dimension.
* @throws MismatchedReferenceSystemException If the CRS of the two
position are not equal.
*/
@@ -96,11 +96,11 @@ class ArrayEnvelope extends AbstractEnve
}
/**
- * Constructs an envelope defined by two sequences of ordinate values.
+ * Constructs an envelope defined by two corners given as sequences of
ordinate values.
* The Coordinate Reference System is initially {@code null}.
*
- * @param lowerCorner Lower ordinate values.
- * @param upperCorner Upper ordinate values.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @throws MismatchedDimensionException If the two sequences do not have
the same length.
*/
public ArrayEnvelope(final double[] lowerCorner, final double[]
upperCorner) throws MismatchedDimensionException {
@@ -341,30 +341,6 @@ scanNumber: while ((i += Character.charC
* {@inheritDoc}
*/
@Override
- public DirectPosition getLowerCorner() {
- final int dim = ordinates.length >>> 1;
- final GeneralDirectPosition position = new GeneralDirectPosition(dim);
- System.arraycopy(ordinates, 0, position.ordinates, 0, dim);
- position.setCoordinateReferenceSystem(crs);
- return position;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public DirectPosition getUpperCorner() {
- final int dim = ordinates.length >>> 1;
- final GeneralDirectPosition position = new GeneralDirectPosition(dim);
- System.arraycopy(ordinates, dim, position.ordinates, 0, dim);
- position.setCoordinateReferenceSystem(crs);
- return position;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public double getLower(final int dimension) throws
IndexOutOfBoundsException {
ensureValidIndex(ordinates.length >>> 1, dimension);
return ordinates[dimension];
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
Mon Dec 17 17:45:54 2012
@@ -283,8 +283,9 @@ public class Envelope2D extends Rectangl
}
/**
- * A coordinate position consisting of all the starting ordinates for each
- * dimension for all points within the {@code Envelope}.
+ * The limits in the direction of decreasing ordinate values for the two
dimensions.
+ * This is typically a coordinate position consisting of the minimal
ordinates for
+ * the two dimensions for all points within the {@code Envelope}.
*
* {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification
uses an extended
* interpretation of the bounding box definition. In a WCS 1.1 data
structure, the lower
@@ -302,8 +303,9 @@ public class Envelope2D extends Rectangl
}
/**
- * A coordinate position consisting of all the ending ordinates for each
- * dimension for all points within the {@code Envelope}.
+ * The limits in the direction of increasing ordinate values for the two
dimensions.
+ * This is typically a coordinate position consisting of the maximal
ordinates for
+ * the two dimensions for all points within the {@code Envelope}.
*
* {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification
uses an extended
* interpretation of the bounding box definition. In a WCS 1.1 data
structure, the upper
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
Mon Dec 17 17:45:54 2012
@@ -29,6 +29,9 @@ import org.opengis.geometry.MismatchedDi
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.util.resources.Errors;
+// JDK7 related
+import org.apache.sis.internal.util.Objects;
+
/**
* Holds the coordinates for a position within some coordinate reference
system.
@@ -92,16 +95,23 @@ public class GeneralDirectPosition exten
/**
* Constructs a position with the specified ordinates.
- * The {@code ordinates} array will be copied.
+ * This constructor assigns the given array directly (without clone) to
the {@link #ordinates} field.
+ * Consequently, callers shall not recycle the same array for creating
many instances.
+ *
+ * {@note The array is not cloned because this is usually not needed,
especially in the context
+ * of variable argument lengths since the array is often created
implicitly. Furthermore
+ * the <code>ordinates</code> field is public, so cloning the array
would not protect
+ * the state of this object anyway.}
*
- * @param ordinates The ordinate values to copy.
+ * @param ordinates The ordinate values. This array is
<strong>not</strong> cloned.
*/
public GeneralDirectPosition(final double... ordinates) {
- this.ordinates = ordinates.clone();
+ this.ordinates = ordinates;
}
/**
* Constructs a position initialized to the same values than the specified
point.
+ * This is a copy constructor.
*
* @param point The position to copy.
*/
@@ -276,10 +286,7 @@ public class GeneralDirectPosition exten
*/
@Override
public int hashCode() {
- int code = Arrays.hashCode(ordinates);
- if (crs != null) {
- code += crs.hashCode();
- }
+ final int code = Arrays.hashCode(ordinates) +
Objects.hashCode(getCoordinateReferenceSystem());
assert code == super.hashCode();
return code;
}
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
Mon Dec 17 17:45:54 2012
@@ -109,12 +109,12 @@ public class GeneralEnvelope extends Arr
private static volatile Field ordinatesField;
/**
- * Constructs an envelope defined by two direct positions.
+ * Constructs an envelope defined by two corners given as direct positions.
* If at least one corner is associated to a CRS, then the new envelope
will also
* be associated to that CRS.
*
- * @param lowerCorner The lower corner.
- * @param upperCorner The upper corner.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @throws MismatchedDimensionException If the two positions do not have
the same dimension.
* @throws MismatchedReferenceSystemException If the CRS of the two
position are not equal.
*/
@@ -125,11 +125,11 @@ public class GeneralEnvelope extends Arr
}
/**
- * Constructs an envelope defined by two sequences of ordinate values.
+ * Constructs an envelope defined by two corners given as sequences of
ordinate values.
* The Coordinate Reference System is initially {@code null}.
*
- * @param lowerCorner Lower ordinate values.
- * @param upperCorner Upper ordinate values.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @throws MismatchedDimensionException If the two sequences do not have
the same length.
*/
public GeneralEnvelope(final double[] lowerCorner, final double[]
upperCorner) throws MismatchedDimensionException {
Modified:
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java?rev=1423051&r1=1423050&r2=1423051&view=diff
==============================================================================
---
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
(original)
+++
sis/branches/JDK6/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
Mon Dec 17 17:45:54 2012
@@ -50,11 +50,11 @@ public final class ImmutableEnvelope ext
private static final long serialVersionUID = 5593936512712449234L;
/**
- * Constructs an envelope defined by two direct positions.
+ * Constructs an envelope defined by two corners given as direct positions.
* The envelope CRS will be the CRS of the given positions.
*
- * @param lowerCorner The lower corner.
- * @param upperCorner The upper corner.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @throws MismatchedDimensionException If the two positions do not have
the same dimension.
* @throws MismatchedReferenceSystemException If the CRS of the two
position are not equal.
*/
@@ -65,10 +65,10 @@ public final class ImmutableEnvelope ext
}
/**
- * Constructs an envelope defined by two sequences of ordinate values.
+ * Constructs an envelope defined by two corners given as sequences of
ordinate values.
*
- * @param lowerCorner Lower ordinate values.
- * @param upperCorner Upper ordinate values.
+ * @param lowerCorner The limits in the direction of decreasing ordinate
values for each dimension.
+ * @param upperCorner The limits in the direction of increasing ordinate
values for each dimension.
* @param crs The CRS to assign to this envelope, or {@code null}.
* @throws MismatchedDimensionException If the two sequences do not have
the same length, or
* if the dimension of the given CRS is not equals to the
dimension of the given corners.