Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,157 +16,518 @@
  */
 package org.apache.sis.measure;
 
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
+import javax.measure.UnitConverter;
+import javax.measure.format.ParserException;
+import javax.measure.Quantity;
 import javax.measure.quantity.Angle;
-import javax.measure.quantity.Length;
-import javax.measure.quantity.Duration;
+import javax.measure.quantity.Area;
 import javax.measure.quantity.Dimensionless;
-import javax.measure.quantity.Quantity;
-import javax.measure.converter.UnitConverter;
+import javax.measure.quantity.Energy;
+import javax.measure.quantity.Force;
+import javax.measure.quantity.Frequency;
+import javax.measure.quantity.Length;
+import javax.measure.quantity.Mass;
+import javax.measure.quantity.Power;
+import javax.measure.quantity.Pressure;
+import javax.measure.quantity.Speed;
+import javax.measure.quantity.Temperature;
+import javax.measure.quantity.Time;
+import javax.measure.quantity.Volume;
+
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Workaround;
-import org.apache.sis.util.ArraysExt;
-import org.apache.sis.util.Exceptions;
-import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.XPaths;
 
 import static java.lang.Math.PI;
 import static java.lang.Math.abs;
 import static org.apache.sis.measure.SexagesimalConverter.EPS;
-import static org.apache.sis.util.CharSequences.trimWhitespaces;
 
 
 /**
- * Static methods working on {@link Unit} instances, and some constants in 
addition to the
- * {@link SI} and {@link NonSI} ones.
+ * Provides constants for various Units of Measurement together with static 
methods working on {@link Unit} instances.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class Units extends Static {
     /**
-     * The suffixes that NetCDF files sometime put after the "degrees" unit.
-     * Suffix at even index are for axes having the standard geometric 
direction,
-     * while suffix at odd index are for axes having the reverse direction.
+     * The SI base unit for distances (symbol “m”).
+     *
+     * @see #NANOMETRE
+     * @see #MILLIMETRE
+     * @see #CENTIMETRE
+     * @see #KILOMETRE
+     * @see #NAUTICAL_MILE
+     * @see #FOOT
+     * @see #FOOT_SURVEY_US
+     *
+     * @since 0.8
      */
-    private static final String[] CARDINAL_DIRECTIONS = {"east", "west", 
"north", "south"};
+    public static final Unit<Length> METRE = tec.units.ri.unit.Units.METRE;
 
     /**
-     * Do not allows instantiation of this class.
+     * Unit of measurement defined as 10<sup>-9</sup> metres.
+     * This unit is often used in wavelength measurements.
+     *
+     * @see #METRE
+     * @see #CENTIMETRE
+     * @see #MILLIMETRE
+     *
+     * @since 0.8
      */
-    private Units() {
-    }
+    public static final Unit<Length> NANOMETRE = METRE.divide(1E9);
+
+    /**
+     * Unit of measurement defined as 0.001 metres.
+     *
+     * @see #METRE
+     * @see #NANOMETRE
+     * @see #CENTIMETRE
+     * @see #KILOMETRE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> MILLIMETRE = METRE.divide(1000);
+
+    /**
+     * Unit of measurement defined as 0.01 metres.
+     *
+     * @see #METRE
+     * @see #NANOMETRE
+     * @see #MILLIMETRE
+     * @see #KILOMETRE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> CENTIMETRE = METRE.divide(100);
+
+    /**
+     * Unit of measurement defined as 1000 metres.
+     *
+     * @see #METRE
+     * @see #NAUTICAL_MILE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> KILOMETRE = METRE.multiply(1000);
+
+    /**
+     * Unit of measurement defined as 1852 metres.
+     * This is approximatively the distance between two parallels of latitude 
separated by one arc-minute.
+     *
+     * @see #METRE
+     * @see #KILOMETRE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> NAUTICAL_MILE = METRE.multiply(1852);
+
+    /**
+     * Unit of measurement defined as 0.3048 metres.
+     *
+     * @see #METRE
+     * @see #FOOT_SURVEY_US
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> FOOT = METRE.multiply(0.3048);
+
+    /**
+     * Unit of measurement defined as 12/39.37 metres.
+     * This is approximatively 0.3048006096… metres.
+     *
+     * @see #METRE
+     * @see #FOOT
+     *
+     * @since 0.8
+     */
+    public static final Unit<Length> FOOT_SURVEY_US = METRE.multiply(12 / 
39.37);
+
+    /**
+     * The SI unit for plane angles.
+     * There is 2π radians in a circle.
+     *
+     * @see #DEGREE
+     * @see #GRAD
+     * @see #ARC_MINUTE
+     * @see #ARC_SECOND
+     * @see #MICRORADIAN
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> RADIAN = tec.units.ri.unit.Units.RADIAN;
+
+    /**
+     * Unit of measurement defined as π/180 radians.
+     * There is 360° in a circle.
+     *
+     * @see #RADIAN
+     * @see #ARC_MINUTE
+     * @see #ARC_SECOND
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> DEGREE = RADIAN.multiply(Math.PI/180);
+
+    /**
+     * Unit of measurement defined as π/200 radians.
+     * There is 400 grads in a circle.
+     *
+     * @see #RADIAN
+     * @see #DEGREE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> GRAD = RADIAN.multiply(Math.PI/200);
+
+    /**
+     * Unit of measurement defined as 1/60 degree.
+     *
+     * @see #RADIAN
+     * @see #DEGREE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> ARC_MINUTE = RADIAN.multiply(Math.PI / 
(180*60));
+
+    /**
+     * Unit of measurement defined as 1/(60×60) degree.
+     *
+     * @see #RADIAN
+     * @see #DEGREE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> ARC_SECOND = RADIAN.multiply(Math.PI / 
(180*60*60));
+
+    /**
+     * Unit of measurement defined as 10<sup>-6</sup> radians.
+     *
+     * @see #RADIAN
+     *
+     * @since 0.8
+     */
+    public static final Unit<Angle> MICRORADIAN = RADIAN.divide(1E+6);
+
+    /**
+     * The SI base unit for durations (symbol “s”).
+     *
+     * @see #MILLISECOND
+     * @see #MINUTE
+     * @see #HOUR
+     * @see #DAY
+     * @see #WEEK
+     * @see #YEAR
+     *
+     * @since 0.8
+     */
+    public static final Unit<Time> SECOND = tec.units.ri.unit.Units.SECOND;
+
+    /**
+     * Unit of measurement defined as 10<sup>-3</sup> seconds.
+     * Useful for conversions from and to {@link java.util.Date} objects.
+     *
+     * @see #SECOND
+     */
+    public static final Unit<Time> MILLISECOND = SECOND.divide(1000);
+
+    /**
+     * Unit of measurement defined as 60 seconds.
+     *
+     * @see #SECOND
+     * @see #HOUR
+     *
+     * @since 0.8
+     */
+    public static final Unit<Time> MINUTE = tec.units.ri.unit.Units.MINUTE;
+
+    /**
+     * Unit of measurement defined as 60×60 seconds.
+     *
+     * @see #SECOND
+     * @see #MINUTE
+     *
+     * @since 0.8
+     */
+    public static final Unit<Time> HOUR = tec.units.ri.unit.Units.HOUR;
+
+    /**
+     * Unit of measurement defined as 24×60×60 seconds.
+     *
+     * @see #SECOND
+     * @see #WEEK
+     *
+     * @since 0.8
+     */
+    public static final Unit<Time> DAY = tec.units.ri.unit.Units.DAY;
 
     /**
-     * Unit for milliseconds. Useful for conversion from and to {@link 
java.util.Date} objects.
+     * Unit of measurement defined as 7 days.
+     *
+     * @see #SECOND
+     * @see #DAY
+     * @see #YEAR
+     *
+     * @since 0.8
      */
-    public static final Unit<Duration> MILLISECOND = 
SI.MetricPrefix.MILLI(SI.SECOND);
+    public static final Unit<Time> WEEK = tec.units.ri.unit.Units.WEEK;
 
     /**
      * The EPSG:1029 definition of year.
+     *
+     * @see #SECOND
+     * @see #WEEK
+     * @see #DAY
+     *
+     * @since 0.8
+     */
+    private static final Unit<Time> YEAR = SECOND.divide(31556925.445);
+
+    /**
+     * The SI unit for frequency (symbol “Hz”).
+     * A unit of frequency equal to one cycle per second.
+     *
+     * @since 0.8
+     */
+    public static final Unit<Frequency> HERTZ = tec.units.ri.unit.Units.HERTZ;
+
+    /**
+     * The SI unit for pressure (symbol “Pa”).
+     * One pascal is equal to 1 N/m².
+     * Pressures are often used in {@linkplain 
org.apache.sis.referencing.crs.DefaultParametricCRS parametric CRS}
+     * for height measurements.
+     *
+     * @see #HECTOPASCAL
+     *
+     * @since 0.8
+     */
+    public static final Unit<Pressure> PASCAL = tec.units.ri.unit.Units.PASCAL;
+
+    /**
+     * Unit of measurement defined as 100 pascals.
+     *
+     * @see #PASCAL
+     *
+     * @since 0.8
+     */
+    public static final Unit<Pressure> HECTOPASCAL = PASCAL.multiply(100);
+
+    /**
+     * The SI base unit for mass (symbol “kg”).
+     *
+     * @since 0.8
+     */
+    public static final Unit<Mass> KILOGRAM = tec.units.ri.unit.Units.KILOGRAM;
+
+    /**
+     * The SI unit for force (symbol “N”).
+     * One newton is the force required to give a mass of 1 kg an acceleration 
of 1 m/s².
+     *
+     * @since 0.8
+     */
+    public static final Unit<Force> NEWTON = tec.units.ri.unit.Units.NEWTON;
+
+    /**
+     * The SI unit for energy (symbol “J”).
+     *
+     * @since 0.8
+     */
+    public static final Unit<Energy> JOULE = tec.units.ri.unit.Units.JOULE;
+
+    /**
+     * The SI unit for power (symbol “W”).
+     * One watt is equal to one joule per second.
+     *
+     * @since 0.8
+     */
+    public static final Unit<Power> WATT = tec.units.ri.unit.Units.WATT;
+
+    /**
+     * The SI base unit for thermodynamic temperature (symbol “K”).
+     *
+     * @see #CELSIUS
+     *
+     * @since 0.8
+     */
+    public static final Unit<Temperature> KELVIN = 
tec.units.ri.unit.Units.KELVIN;
+
+    /**
+     * Unit of measurement defined as the temperature in Kelvin minus 273.15.
+     *
+     * @see #KELVIN
+     *
+     * @since 0.8
+     */
+    public static final Unit<Temperature> CELSIUS = 
tec.units.ri.unit.Units.CELSIUS;
+
+    /**
+     * Derived unit of measurement for speed (symbol “m/s”).
+     *
+     * @see #KILOMETRES_PER_HOUR
+     *
+     * @since 0.8
+     */
+    public static final Unit<Speed> METRES_PER_SECOND = 
tec.units.ri.unit.Units.METRES_PER_SECOND;
+
+    /**
+     * Derived unit of measurement for speed (symbol “km/h”).
+     *
+     * @see #METRES_PER_SECOND
+     *
+     * @since 0.8
+     */
+    public static final Unit<Speed> KILOMETRES_PER_HOUR = 
tec.units.ri.unit.Units.KILOMETRES_PER_HOUR;
+
+    /**
+     * Derived unit of measurement for area (symbol “m²”).
+     *
+     * @since 0.8
+     */
+    public static final Unit<Area> SQUARE_METRE = 
tec.units.ri.unit.Units.SQUARE_METRE;
+
+    /**
+     * Derived unit of measurement for area (symbol “m²”).
+     *
+     * @since 0.8
      */
-    private static final Unit<Duration> YEAR = SI.SECOND.divide(31556925.445);
+    public static final Unit<Volume> CUBIC_METRE = 
tec.units.ri.unit.Units.CUBIC_METRE;
 
     /**
-     * Parts per million.
+     * Dimensionless unit for scale measurements.
      *
-     * <p>This unit does not have an easily readable symbol because of the
-     * <a href="http://kenai.com/jira/browse/JSR_275-41";>JSR-275 bug</a>.</p>
+     * @see #PERCENT
+     * @see #PPM
+     *
+     * @since 0.8
      */
-    public static final Unit<Dimensionless> PPM = 
Unit.ONE.times(1E-6);//.alternate("ppm");
+    public static final Unit<Dimensionless> ONE = 
tec.units.ri.AbstractUnit.ONE;
+
+    /**
+     * Dimensionless unit for percentages.
+     *
+     * @see #ONE
+     * @see #PPM
+     *
+     * @since 0.8
+     */
+    public static final Unit<Dimensionless> PERCENT = 
tec.units.ri.unit.Units.PERCENT;
+
+    /**
+     * Dimensionless unit for parts per million.
+     *
+     * @see #ONE
+     * @see #PERCENT
+     */
+    public static final Unit<Dimensionless> PPM = ONE.divide(1E+6);
 
     /**
      * Salinity measured using PSS-78. While this is a dimensionless 
measurement, the {@code "psu"} symbol
      * is sometime added to PSS-78 measurement. However this is officially 
discouraged.
      */
-    static final Unit<Dimensionless> PSU = Unit.ONE.alternate("psu");
+    static final Unit<Dimensionless> PSU = ONE.alternate("psu");
 
     /**
      * Sigma-level, used in oceanography. This is a way to measure a depth as 
a fraction of the sea floor depth.
      */
-    static final Unit<Dimensionless> SIGMA = Unit.ONE.alternate("sigma");
+    static final Unit<Dimensionless> SIGMA = ONE.alternate("sigma");
+
+    /**
+     * Dimensionless unit for pixels.
+     */
+    public static final Unit<Dimensionless> PIXEL = ONE.alternate("pixel");
+
+    static {
+        final javax.measure.format.UnitFormat format = 
tec.units.ri.format.SimpleUnitFormat.getInstance();
+        format.label(METRE,  "m");
+        format.label(FOOT,  "ft");
+        format.label(DEGREE, "°");
+        format.label(GRAD, "grad");
+    }
+
+    /**
+     * Do not allows instantiation of this class.
+     */
+    private Units() {
+    }
 
     /**
      * Returns {@code true} if the given unit is a linear unit.
-     * Linear units are convertible to {@link NonSI#DEGREE_ANGLE}.
+     * Linear units are convertible to {@link #DEGREE}.
      *
      * <p>Angular units are dimensionless, which may be a cause of confusion 
with other
-     * dimensionless units like {@link Unit#ONE} or {@link #PPM}. This method 
take care
+     * dimensionless units like {@link #ONE} or {@link #PPM}. This method take 
care
      * of differentiating angular units from other dimensionless units.</p>
      *
-     * @param unit The unit to check (may be {@code null}).
+     * @param  unit  the unit to check (may be {@code null}).
      * @return {@code true} if the given unit is non-null and angular.
      *
      * @see #ensureAngular(Unit)
      */
     public static boolean isAngular(final Unit<?> unit) {
-        return (unit != null) && unit.toSI().equals(SI.RADIAN);
+        return (unit != null) && unit.getSystemUnit().equals(RADIAN);
     }
 
     /**
      * Returns {@code true} if the given unit is a linear unit.
-     * Linear units are convertible to {@link SI#METRE}.
+     * Linear units are convertible to {@link #METRE}.
      *
-     * @param unit The unit to check (may be {@code null}).
+     * @param  unit  the unit to check (may be {@code null}).
      * @return {@code true} if the given unit is non-null and linear.
      *
      * @see #ensureLinear(Unit)
      */
     public static boolean isLinear(final Unit<?> unit) {
-        return (unit != null) && unit.toSI().equals(SI.METRE);
+        return (unit != null) && unit.getSystemUnit().equals(METRE);
     }
 
     /**
      * Returns {@code true} if the given unit is a pressure unit.
-     * Pressure units are convertible to {@link SI#PASCAL}.
+     * Pressure units are convertible to {@link #PASCAL}.
      * Those units are sometime used instead of linear units for altitude 
measurements.
      *
-     * @param unit The unit to check (may be {@code null}).
+     * @param  unit  the unit to check (may be {@code null}).
      * @return {@code true} if the given unit is non-null and a pressure unit.
      */
     public static boolean isPressure(final Unit<?> unit) {
-        return (unit != null) && unit.toSI().equals(SI.PASCAL);
+        return (unit != null) && unit.getSystemUnit().equals(PASCAL);
     }
 
     /**
      * Returns {@code true} if the given unit is a temporal unit.
-     * Temporal units are convertible to {@link SI#SECOND}.
+     * Temporal units are convertible to {@link #SECOND}.
      *
-     * @param unit The unit to check (may be {@code null}).
+     * @param  unit  the unit to check (may be {@code null}).
      * @return {@code true} if the given unit is non-null and temporal.
      *
      * @see #ensureTemporal(Unit)
      */
     public static boolean isTemporal(final Unit<?> unit) {
-        return (unit != null) && unit.toSI().equals(SI.SECOND);
+        return (unit != null) && unit.getSystemUnit().equals(SECOND);
     }
 
     /**
      * Returns {@code true} if the given unit is a dimensionless scale unit.
      * This include {@link Unit#ONE} and {@link #PPM}.
      *
-     * @param unit The unit to check (may be {@code null}).
+     * @param  unit  the unit to check (may be {@code null}).
      * @return {@code true} if the given unit is non-null and a dimensionless 
scale.
      *
      * @see #ensureScale(Unit)
      */
     public static boolean isScale(final Unit<?> unit) {
-        return (unit != null) && unit.toSI().equals(Unit.ONE);
+        return (unit != null) && unit.getSystemUnit().equals(ONE);
     }
 
     /**
      * Makes sure that the specified unit is either null or an angular unit.
      * This method is used for argument checks in constructors and setter 
methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
-     * @return The given {@code unit} argument, which may be null.
+     * @param  unit  the unit to check, or {@code null} if none.
+     * @return the given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not an 
angular unit.
      *
      * @see #isAngular(Unit)
@@ -183,8 +544,8 @@ public final class Units extends Static
      * Makes sure that the specified unit is either null or a linear unit.
      * This method is used for argument checks in constructors and setter 
methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
-     * @return The given {@code unit} argument, which may be null.
+     * @param  unit  the unit to check, or {@code null} if none.
+     * @return the given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a 
linear unit.
      *
      * @see #isLinear(Unit)
@@ -201,26 +562,26 @@ public final class Units extends Static
      * Makes sure that the specified unit is either null or a temporal unit.
      * This method is used for argument checks in constructors and setter 
methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
-     * @return The given {@code unit} argument, which may be null.
+     * @param  unit  the unit to check, or {@code null} if none.
+     * @return the given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a 
temporal unit.
      *
      * @see #isTemporal(Unit)
      */
     @SuppressWarnings("unchecked")
-    public static Unit<Duration> ensureTemporal(final Unit<?> unit) throws 
IllegalArgumentException {
+    public static Unit<Time> ensureTemporal(final Unit<?> unit) throws 
IllegalArgumentException {
         if (unit != null && !isTemporal(unit)) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.NonTemporalUnit_1, unit));
         }
-        return (Unit<Duration>) unit;
+        return (Unit<Time>) unit;
     }
 
     /**
      * Makes sure that the specified unit is either null or a scale unit.
      * This method is used for argument checks in constructors and setter 
methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
-     * @return The given {@code unit} argument, which may be null.
+     * @param  unit  the unit to check, or {@code null} if none.
+     * @return the given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a 
scale unit.
      *
      * @see #isScale(Unit)
@@ -234,54 +595,43 @@ public final class Units extends Static
     }
 
     /**
-     * Multiplies the given unit by the given factor. For example multiplying 
{@link SI#METRE}
-     * by 1000 gives {@link SI#KILOMETRE}. Invoking this method is equivalent 
to invoking
-     * {@link Unit#times(double)} except for the following:
+     * Multiplies the given unit by the given factor. For example multiplying 
{@link #METRE}
+     * by 1000 gives {@link #KILOMETRE}. Invoking this method is equivalent to 
invoking
+     * {@link Unit#multiply(double)} except for the following:
      *
      * <ul>
      *   <li>A small tolerance factor is applied for a few factors commonly 
used in GIS.
-     *       For example {@code multiply(SI.RADIANS, 0.0174532925199...)} will 
return
-     *       {@link NonSI#DEGREE_ANGLE} even if the given numerical value is 
slightly
-     *       different than {@linkplain Math#PI pi}/180. The tolerance factor 
and the
-     *       set of units handled especially may change in future SIS 
versions.</li>
+     *       For example {@code multiply(RADIANS, 0.0174532925199...)} will 
return {@link #DEGREE}
+     *       even if the given numerical value is slightly different than 
{@linkplain Math#PI π}/180.
+     *       The tolerance factor and the set of units handled especially may 
change in future SIS versions.</li>
      *   <li>This method tries to returns unique instances for some common 
units.</li>
      * </ul>
      *
-     * @param  <Q>    The quantity measured by the unit.
-     * @param  unit   The unit to multiply.
-     * @param  factor The multiplication factor.
-     * @return The unit multiplied by the given factor.
+     * @param  <Q>     the quantity measured by the unit.
+     * @param  unit    the unit to multiply.
+     * @param  factor  the multiplication factor.
+     * @return the unit multiplied by the given factor.
      */
     @Workaround(library="JSR-275", version="0.9.3")
     @SuppressWarnings("unchecked")
-    public static <Q extends Quantity> Unit<Q> multiply(Unit<Q> unit, final 
double factor) {
-        if (SI.RADIAN.equals(unit)) {
+    public static <Q extends Quantity<Q>> Unit<Q> multiply(Unit<Q> unit, final 
double factor) {
+        if (RADIAN.equals(unit)) {
             if (abs(factor - (PI / 180)) <= (EPS * PI/180)) {
-                return (Unit<Q>) NonSI.DEGREE_ANGLE;
+                return (Unit<Q>) DEGREE;
             }
             if (abs(factor - (PI / 200)) <= (EPS * PI/200)) {
-                return (Unit<Q>) NonSI.GRADE;
+                return (Unit<Q>) GRAD;
             }
-        } else if (SI.METRE.equals(unit)) {
+        } else if (METRE.equals(unit)) {
             if (abs(factor - 0.3048) <= (EPS * 0.3048)) {
-                return (Unit<Q>) NonSI.FOOT;
+                return (Unit<Q>) FOOT;
             }
             if (abs(factor - (1200.0/3937)) <= (EPS * (1200.0/3937))) {
-                return (Unit<Q>) NonSI.FOOT_SURVEY_US;
+                return (Unit<Q>) FOOT_SURVEY_US;
             }
         }
         if (abs(factor - 1) > EPS) {
-            final long fl = (long) factor;
-            if (fl == factor) {
-                /*
-                 * Invoke the Unit.times(long) overloaded method, not 
Unit.scale(double),
-                 * because as of JSR-275 0.9.3 the method with the long 
argument seems to
-                 * do a better work of detecting when the result is an 
existing unit.
-                 */
-                unit = unit.times(fl);
-            } else {
-                unit = unit.times(factor);
-            }
+            unit = unit.multiply(factor);
         }
         return UnitsMap.canonicalize(unit);
     }
@@ -290,25 +640,24 @@ public final class Units extends Static
      * Returns the factor by which to multiply the standard unit in order to 
get the given unit.
      * The "standard" unit is usually the SI unit on which the given unit is 
based.
      *
-     * <p><b>Example:</b> If the given unit is <var>kilometre</var>, then this 
method returns 1000
+     * <p><b>Example:</b> if the given unit is <var>kilometre</var>, then this 
method returns 1000
      * since a measurement in kilometres must be multiplied by 1000 in order 
to give the equivalent
      * measurement in the "standard" units (here <var>metres</var>).</p>
      *
-     * @param  <Q>  The quantity measured by the unit.
-     * @param  unit The unit for which we want the multiplication factor to 
standard unit.
-     * @return The factor by which to multiply a measurement in the given unit 
in order to
+     * @param  <Q>   the quantity measured by the unit.
+     * @param  unit  the unit for which we want the multiplication factor to 
standard unit.
+     * @return the factor by which to multiply a measurement in the given unit 
in order to
      *         get an equivalent measurement in the standard unit.
      */
     @Workaround(library="JSR-275", version="0.9.3")
-    public static <Q extends Quantity> double toStandardUnit(final Unit<Q> 
unit) {
-        return derivative(unit.getConverterTo(unit.toSI()), 0);
+    public static <Q extends Quantity<Q>> double toStandardUnit(final Unit<Q> 
unit) {
+        return derivative(unit.getConverterTo(unit.getSystemUnit()), 0);
     }
 
     /**
      * Returns an estimation of the derivative of the given converter at the 
given value.
      * This method is a workaround for a method which existed in previous 
JSR-275 API but
-     * have been removed in more recent releases. This method will be 
deprecated if the
-     * removed API is reinserted in future JSR-275 release.
+     * have been removed in more recent releases.
      *
      * <p>Current implementation computes the derivative as below:</p>
      *
@@ -316,13 +665,12 @@ public final class Units extends Static
      *     return converter.convert(value + 1) - converter.convert(value);
      * }
      *
-     * The above is exact for {@linkplain 
javax.measure.converter.LinearConverter linear converters},
-     * which is the case of the vast majority of unit converters in use. It 
may not be exact for a
-     * few unusual converter like the one from sexagesimal degrees to decimal 
degrees for example.
-     *
-     * @param  converter The converter for which we want the derivative at a 
given point.
-     * @param  value The point at which to compute the derivative.
-     * @return The derivative at the given point.
+     * The above is exact for linear converters, which is the case of the vast 
majority of unit converters in use.
+     * It may not be exact for a few unusual converter like the one from 
sexagesimal degrees to decimal degrees.
+     *
+     * @param  converter  the converter for which we want the derivative at a 
given point.
+     * @param  value      the point at which to compute the derivative.
+     * @return the derivative at the given point.
      */
     @Workaround(library="JSR-275", version="0.9.3")
     public static double derivative(final UnitConverter converter, final 
double value) {
@@ -330,9 +678,11 @@ public final class Units extends Static
     }
 
     /**
-     * Parses the given symbol. This method is similar to {@link 
Unit#valueOf(CharSequence)}, but
-     * hands especially a few symbols found in WKT parsing or in XML files. 
The list of symbols
-     * handled especially is implementation-dependent and may change in future 
SIS versions.
+     * Parses the given symbol. Invoking this method is equivalent to invoking
+     * {@link UnitFormat#parse(CharSequence)} on a shared locale-independent 
instance.
+     * This method is capable to handle some symbols found during WKT parsing 
or in XML files.
+     * The list of symbols supported by this method is implementation-dependent
+     * and may change in future SIS versions.
      *
      * <div class="section">Parsing authority codes</div>
      * As a special case, if the given {@code uom} arguments is of the form 
{@code "EPSG:####"}
@@ -342,158 +692,25 @@ public final class Units extends Static
      * <div class="section">NetCDF unit symbols</div>
      * The attributes in NetCDF files often merge the axis direction with the 
angular unit,
      * as in {@code "degrees_east"} or {@code "degrees_north"}. This {@code 
valueOf} method
-     * ignores those suffixes and unconditionally returns {@link 
NonSI#DEGREE_ANGLE} for all
-     * axis directions. In particular, the units for {@code "degrees_west"} 
and {@code "degrees_east"}
-     * do <strong>not</strong> have opposite sign. It is caller responsibility 
to handle the
-     * direction of axes associated to NetCDF units.
-     *
-     * @param  uom The symbol to parse, or {@code null}.
-     * @return The parsed symbol, or {@code null} if {@code uom} was null.
-     * @throws IllegalArgumentException if the given symbol can not be parsed.
-     */
-    public static Unit<?> valueOf(String uom) throws IllegalArgumentException {
-        if (uom == null) {
-            return null;
-        }
-        uom = trimWhitespaces(CharSequences.toASCII(uom)).toString();
-        final int length = uom.length();
-        /*
-         * Check for authority codes (currently only EPSG, but more could be 
added later).
-         * If the unit is not an authority code (which is the most common 
case), then we
-         * will check for hard-coded unit symbols.
-         *
-         * DefinitionURI.codeOf(…) returns 'uom' directly (provided that 
whitespaces were already trimmed)
-         * if no ':' character were found, in which case the string is assumed 
to be the code directly.
-         * This is the intended behavior for AuthorityFactory, but in the 
particular case of this method
-         * we want to try to parse as a xpointer before to give up.
-         */
-        if (isURI(uom)) {
-            String code = DefinitionURI.codeOf("uom", Constants.EPSG, uom);
-            if (code != null && code != uom) try {              // Really 
identity check, see above comment.
-                return valueOfEPSG(Integer.parseInt(code));
-            } catch (NumberFormatException e) {
-                throw new IllegalArgumentException(Errors.format(
-                        Errors.Keys.IllegalArgumentValue_2, "uom", uom), e);
-            }
-            code = XPaths.xpointer("uom", uom);
-            if (code != null) {
-                uom = code;
-            }
-        }
-        /*
-         * Check for degrees units. Note that "deg" could be both angular and 
Celsius degrees.
-         * We try to resolve this ambiguity in the code below by looking for 
the "Celsius" suffix.
-         * Other suffixes commonly found in NetCDF files are "west", "east", 
"north" or "south".
-         * Those suffixes are ignored.
-         */
-        if (uom.regionMatches(true, 0, "deg", 0, 3)) {
-            switch (length) {
-                case 3: return NonSI.DEGREE_ANGLE; // Exactly "deg"
-                case 4: {
-                    if (uom.charAt(3) == 'K') {
-                        return SI.KELVIN; // Exactly "degK".
-                    }
-                    break;
-                }
-            }
-            String prefix = uom;
-            boolean isTemperature = false;
-            final int s = Math.max(uom.lastIndexOf(' '), uom.lastIndexOf('_'));
-            if (s >= 1) {
-                final String suffix = (String) trimWhitespaces(uom, s+1, 
length);
-                if (ArraysExt.containsIgnoreCase(CARDINAL_DIRECTIONS, suffix) 
|| (isTemperature = isCelsius(suffix))) {
-                    prefix = (String) trimWhitespaces(uom, 0, s); // Remove 
the suffix only if we recognized it.
-                }
-            }
-            if (equalsIgnorePlural(prefix, "degree")) {
-                return isTemperature ? SI.CELSIUS : NonSI.DEGREE_ANGLE;
-            }
-        } else {
-            /*
-             * Check for unit symbols that do not begin with "deg". If a 
symbol begins
-             * with "deg", then the check should be put in the above block 
instead.
-             */
-            if (uom.equals("°")                      || 
equalsIgnorePlural(uom, "decimal_degree")) return NonSI.DEGREE_ANGLE;
-            if (uom.equalsIgnoreCase("arcsec"))                                
                    return NonSI.SECOND_ANGLE;
-            if (uom.equalsIgnoreCase("rad")          || 
equalsIgnorePlural(uom, "radian"))         return SI.RADIAN;
-            if (equalsIgnorePlural(uom, "meter")     || 
equalsIgnorePlural(uom, "metre"))          return SI.METRE;
-            if (equalsIgnorePlural(uom, "kilometer") || 
equalsIgnorePlural(uom, "kilometre"))      return SI.KILOMETRE;
-            if (equalsIgnorePlural(uom, "week"))        return NonSI.WEEK;
-            if (equalsIgnorePlural(uom, "day"))         return NonSI.DAY;
-            if (equalsIgnorePlural(uom, "hour"))        return NonSI.HOUR;
-            if (equalsIgnorePlural(uom, "minute"))      return NonSI.MINUTE;
-            if (equalsIgnorePlural(uom, "second"))      return SI   .SECOND;
-            if (equalsIgnorePlural(uom, "pixel"))       return NonSI.PIXEL;
-            if (equalsIgnorePlural(uom, "grade"))       return NonSI.GRADE;
-            if (isCelsius(uom))                         return SI.CELSIUS;
-            if (uom.isEmpty())                          return Unit.ONE;
-            if (uom.equalsIgnoreCase("US survey foot")) return 
NonSI.FOOT_SURVEY_US;
-            if (uom.equalsIgnoreCase("ppm"))            return PPM;
-            if (uom.equalsIgnoreCase("psu"))            return PSU;
-            if (uom.equalsIgnoreCase("sigma"))          return SIGMA;
-        }
-        final Unit<?> unit;
-        try {
-            unit = Unit.valueOf(uom);
-        } catch (IllegalArgumentException e) {
-            // Provides a better error message than the default JSR-275 0.9.4 
implementation.
-            throw Exceptions.setMessage(e, 
Errors.format(Errors.Keys.IllegalArgumentValue_2, "uom", uom), true);
-        }
-        /*
-         * Special case: JSR-275 version 0.6.1 parses "1/s" and "s-1" as 
"Baud", which is not what
-         * we use in geoscience. Replace "Baud" by "Hertz" if the symbol was 
not explicitely "Bd".
-         */
-        if (unit.isCompatible(SI.HERTZ) && !uom.equals("Bd")) {
-            return SI.HERTZ;
-        }
-        return UnitsMap.canonicalize(unit);
-    }
-
-    /**
-     * Returns {@code true} if the given {@code uom} is equals to the given 
expected string,
-     * ignoring trailing {@code 's'} character (if any).
-     */
-    @SuppressWarnings("fallthrough")
-    private static boolean equalsIgnorePlural(final String uom, final String 
expected) {
-        final int length = expected.length();
-        switch (uom.length() - length) {
-            case 0:  break; // uom has exactly the expected length.
-            case 1:  if (Character.toLowerCase(uom.charAt(length)) == 's') 
break; // else fallthrough.
-            default: return false;
-        }
-        return uom.regionMatches(true, 0, expected, 0, length);
-    }
-
-    /**
-     * Returns {@code true} if the given {@code uom} is equals to {@code 
"Celsius"} or
-     * {@code "Celcius"}. The later is a common misspelling.
-     */
-    private static boolean isCelsius(final String uom) {
-        return uom.equalsIgnoreCase("Celsius") || 
uom.equalsIgnoreCase("Celcius");
-    }
-
-    /**
-     * Returns {@code true} if the given unit seems to be an URI. Example:
-     * <ul>
-     *   <li>{@code "urn:ogc:def:uom:EPSG::9001"}</li>
-     *   <li>{@code 
"http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])"}</li>
-     * </ul>
+     * ignores those suffixes and unconditionally returns {@link #DEGREE} for 
all axis directions.
+     * In particular, the units for {@code "degrees_west"} and {@code 
"degrees_east"}
+     * do <strong>not</strong> have opposite sign.
+     * It is caller responsibility to handle the direction of axes associated 
to NetCDF units.
+     *
+     * @param  uom  the symbol to parse, or {@code null}.
+     * @return the parsed symbol, or {@code null} if {@code uom} was null.
+     * @throws ParserException if the given symbol can not be parsed.
+     *
+     * @see UnitFormat#parse(CharSequence)
      */
-    private static boolean isURI(final String uom) {
-        for (int i=uom.length(); --i>=0;) {
-            final char c = uom.charAt(i);
-            if (c == ':' || c == '#') {
-                return true;
-            }
-        }
-        return false;
+    public static Unit<?> valueOf(String uom) throws ParserException {
+        return (uom != null) ? UnitFormat.INSTANCE.parse(uom) : null;
     }
 
     /**
-     * Returns a hard-coded unit from an EPSG code. The {@code code} argument 
given to this
-     * method shall be a code identifying a record in the {@code "Unit of 
Measure"} table of
-     * the EPSG database. If this method does not recognize the given code, 
then it returns
-     * {@code null}.
+     * Returns a hard-coded unit from an EPSG code. The {@code code} argument 
given to this method shall
+     * be a code identifying a record in the {@code "Unit of Measure"} table 
of the EPSG geodetic dataset.
+     * If this method does not recognize the given code, then it returns 
{@code null}.
      *
      * <p>The list of units recognized by this method is not exhaustive. This 
method recognizes
      * the base units declared in the {@code TARGET_UOM_CODE} column of the 
above-cited table,
@@ -521,7 +738,7 @@ public final class Units extends Static
      *       <tr><td>9102</td><td>decimal degree</td></tr>
      *       <tr><td>9103</td><td>minute</td></tr>
      *       <tr><td>9104</td><td>second</td></tr>
-     *       <tr><td>9105</td><td>grade</td></tr>
+     *       <tr><td>9105</td><td>grad</td></tr>
      *       <tr><td>9107</td><td>degree-minute-second</td></tr>
      *       <tr><td>9108</td><td>degree-minute-second</td></tr>
      *       <tr><td>9109</td><td>microradian</td></tr>
@@ -556,35 +773,35 @@ public final class Units extends Static
      * and code 9122 (<cite>degree (supplier to define representation)</cite>) 
for coordinate system axes.
      * But Apache SIS considers those two codes as synonymous.</div>
      *
-     * @param  code The EPSG code for a unit of measurement.
-     * @return The unit, or {@code null} if the code is unrecognized.
+     * @param  code  the EPSG code for a unit of measurement.
+     * @return the unit, or {@code null} if the code is unrecognized.
      *
      * @see 
org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createUnit(String)
      */
     public static Unit<?> valueOfEPSG(final int code) {
         switch (code) {
             case Constants.EPSG_PARAM_DEGREES:  // Fall through
-            case Constants.EPSG_AXIS_DEGREES:   return NonSI.DEGREE_ANGLE;
-            case Constants.EPSG_METRE:          return SI.METRE;
+            case Constants.EPSG_AXIS_DEGREES:   return DEGREE;
+            case Constants.EPSG_METRE:          return METRE;
 
-            case 1029: return       YEAR;
-            case 1040: return SI   .SECOND;
-            case 9002: return NonSI.FOOT;
-            case 9003: return NonSI.FOOT_SURVEY_US;
-            case 9030: return NonSI.NAUTICAL_MILE;
-            case 9036: return SI   .KILOMETRE;
-            case 9101: return SI   .RADIAN;
-            case 9103: return NonSI.MINUTE_ANGLE;
-            case 9104: return NonSI.SECOND_ANGLE;
-            case 9105: return NonSI.GRADE;
-            case 9109: return SI.MetricPrefix.MICRO(SI.RADIAN);
+            case 1029: return YEAR;
+            case 1040: return SECOND;
+            case 9002: return FOOT;
+            case 9003: return FOOT_SURVEY_US;
+            case 9030: return NAUTICAL_MILE;
+            case 9036: return KILOMETRE;
+            case 9101: return RADIAN;
+            case 9103: return ARC_MINUTE;
+            case 9104: return ARC_SECOND;
+            case 9105: return GRAD;
+            case 9109: return MICRORADIAN;
             case 9107: // Fall through
             case 9108: return SexagesimalConverter.DMS_SCALED;
             case 9110: return SexagesimalConverter.DMS;
             case 9111: return SexagesimalConverter.DM;
             case 9203: // Fall through
-            case 9201: return Unit .ONE;
-            case 9202: return Units.PPM;
+            case 9201: return ONE;
+            case 9202: return PPM;
             default:   return null;
         }
     }
@@ -602,9 +819,9 @@ public final class Units extends Static
      * When such choice exists, the code to return is determined by the {@code 
inAxis} argument,
      * which specifies whether the code will be used for axis definition or in 
other context.
      *
-     * @param  unit The unit for which to get the EPSG code.
+     * @param  unit   the unit for which to get the EPSG code.
      * @param  inAxis {@code true} for a unit used in Coordinate System Axis 
definition.
-     * @return The EPSG code of the given units, or {@code null} if unknown.
+     * @return the EPSG code of the given units, or {@code null} if unknown.
      *
      * @since 0.4
      */

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitsMap.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitsMap.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitsMap.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitsMap.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -20,10 +20,8 @@ import java.util.Map;
 import java.util.HashMap;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.Unit;
-import javax.measure.quantity.Quantity;
+import javax.measure.Unit;
+import javax.measure.Quantity;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.Static;
 
@@ -31,12 +29,12 @@ import static org.apache.sis.measure.Uni
 
 
 /**
- * Map of units, defined in a separated class in order to avoid too-early 
class loading.
+ * Map of units, defined in a separated class in order to avoid too early 
class loading.
  * This class may be removed in a future SIS version if we provide our own 
units framework.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 final class UnitsMap extends Static {
@@ -73,8 +71,8 @@ final class UnitsMap extends Static {
     private static final Map<Unit<?>,Unit<?>> COMMONS = new HashMap<>(48);
     static {
         COMMONS.put(MILLISECOND, MILLISECOND);
-        boolean nonSI = false;
-        do for (final Field field : (nonSI ? NonSI.class : 
SI.class).getFields()) {
+        COMMONS.put(tec.units.ri.AbstractUnit.ONE, 
tec.units.ri.AbstractUnit.ONE);
+        for (final Field field : tec.units.ri.unit.Units.class.getFields()) {
             final int modifiers = field.getModifiers();
             if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
                 final Object value;
@@ -91,18 +89,18 @@ final class UnitsMap extends Static {
                     }
                 }
             }
-        } while ((nonSI = !nonSI) == true);
+        }
     }
 
     /**
      * Returns a unique instance of the given units if possible, or the units 
unchanged otherwise.
      *
-     * @param  <A>    The quantity measured by the unit.
-     * @param  unit   The unit to canonicalize.
-     * @return A unit equivalents to the given unit, canonicalized if possible.
+     * @param  <A>   the quantity measured by the unit.
+     * @param  unit  the unit to canonicalize.
+     * @return a unit equivalents to the given unit, canonicalized if possible.
      */
     @SuppressWarnings({"unchecked","rawtypes"})
-    static <A extends Quantity> Unit<A> canonicalize(final Unit<A> unit) {
+    static <A extends Quantity<A>> Unit<A> canonicalize(final Unit<A> unit) {
         final Unit<?> candidate = COMMONS.get(unit);
         if (candidate != null) {
             return (Unit) candidate;

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -36,7 +36,7 @@
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.8
  * @module
  */
 package org.apache.sis.measure;

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -49,7 +49,7 @@ package org.apache.sis.util;
  * <tr><td>{@link org.apache.sis.referencing.operation.matrix.Matrices}</td>
  *     <td>Create and compare {@link org.opengis.referencing.operation.Matrix} 
objects</td></tr>
  * <tr><td>{@link org.apache.sis.measure.Units}</td>
- *     <td>Get a {@linkplain javax.measure.unit.Unit unit} from a symbol or 
EPSG code,
+ *     <td>Get a {@linkplain javax.measure.Unit unit} from a symbol or EPSG 
code,
  *         and test if a unit is angular, linear or temporal.</td></tr>
  *
  * <tr><th colspan="2" class="hsep">OGC/ISO objects (metadata, referencing, 
geometries)</th></tr>

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -30,7 +30,7 @@ import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.lang.reflect.Modifier;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
 import org.opengis.util.CodeList;
 import org.opengis.util.ControlledVocabulary;
 import org.opengis.util.InternationalString;

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -84,7 +84,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  *
  * @see java.util.ResourceBundle

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -26,7 +26,8 @@ import java.util.Locale;
 import java.util.UUID;
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
+import javax.measure.format.ParserException;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.Locales;
 
@@ -321,7 +322,7 @@ public class ValueConverter {
         value = trimWhitespaces(value);
         if (value != null && !value.isEmpty()) try {
             return Units.valueOf(value);
-        } catch (IllegalArgumentException e) {
+        } catch (ParserException e) {
             if (!exceptionOccured(context, value, String.class, Unit.class, 
e)) {
                 throw e;
             }

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/StringConverterTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -26,11 +26,11 @@ import java.net.URISyntaxException;
 import java.net.MalformedURLException;
 import java.nio.charset.Charset;
 import java.lang.annotation.ElementType;
-import javax.measure.unit.SI;
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.OnLineFunction;
 import org.apache.sis.measure.Angle;
+import org.apache.sis.measure.Units;
 import org.apache.sis.math.FunctionProperty;
 import org.apache.sis.util.ObjectConverter;
 import org.apache.sis.util.UnconvertibleObjectException;
@@ -52,7 +52,7 @@ import java.nio.charset.StandardCharsets
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.8
  * @module
  */
 @DependsOn(org.apache.sis.measure.AngleTest.class)
@@ -300,7 +300,7 @@ public final strictfp class StringConver
     @Test
     public void testUnit() {
         final ObjectConverter<String,Unit<?>> c = new StringConverter.Unit();
-        runInvertibleConversion(c, "km", SI.KILOMETRE);
+        runInvertibleConversion(c, "km", Units.KILOMETRE);
         assertSerializedEquals(c);
     }
 

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -17,9 +17,7 @@
 package org.apache.sis.internal.jaxb.gml;
 
 import java.net.URISyntaxException;
-import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
+import org.apache.sis.measure.Units;
 import org.apache.sis.internal.jaxb.Schemas;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -42,11 +40,11 @@ public final strictfp class MeasureTest
      */
     @Test
     public void testGetUOM() {
-        final Measure measure = new Measure(10, SI.METRE);
+        final Measure measure = new Measure(10, Units.METRE);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
-        measure.unit = NonSI.DEGREE_ANGLE;
+        measure.unit = Units.DEGREE;
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
-        measure.unit = Unit.ONE;
+        measure.unit = Units.ONE;
         assertEquals("urn:ogc:def:uom:EPSG::9201", measure.getUOM());
     }
 
@@ -60,7 +58,7 @@ public final strictfp class MeasureTest
     public void testSetUOM() throws URISyntaxException {
         final Measure measure = new Measure();
         
measure.setUOM("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#m";);
-        assertEquals(SI.METRE, measure.unit);
+        assertEquals(Units.METRE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
         measure.asXPointer = true;
         assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + 
"#xpointer(//*[@gml:id='m'])", measure.getUOM());
@@ -68,7 +66,7 @@ public final strictfp class MeasureTest
         measure.unit = null;
         measure.asXPointer = false;
         measure.setUOM("../uom/ML_gmxUom.xml#xpointer(//*[@gml:id='deg'])");
-        assertEquals(NonSI.DEGREE_ANGLE, measure.unit);
+        assertEquals(Units.DEGREE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
         measure.asXPointer = true;
         assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + 
"#xpointer(//*[@gml:id='deg'])", measure.getUOM());
@@ -76,7 +74,7 @@ public final strictfp class MeasureTest
         measure.unit = null;
         measure.asXPointer = true;
         measure.setUOM("gmxUom.xml#kg"); // Not really an existing unit in 
'gmxUom'.
-        assertEquals(SI.KILOGRAM, measure.unit);
+        assertEquals(Units.KILOGRAM, measure.unit);
         assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + 
"#xpointer(//*[@gml:id='kg'])", measure.getUOM());
     }
 }

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,9 +16,7 @@
  */
 package org.apache.sis.measure;
 
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
-import javax.measure.converter.ConversionException;
+import javax.measure.IncommensurableException;
 import org.junit.Test;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
@@ -31,7 +29,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (IRD)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 @DependsOn(NumberRangeTest.class)
@@ -39,13 +37,13 @@ public final strictfp class MeasurementR
     /**
      * Tests unit conversions by the {@link MeasurementRange#convertTo(Unit)} 
method.
      *
-     * @throws ConversionException Should not happen.
+     * @throws IncommensurableException if a conversion between incompatible 
units were attempted.
      */
     @Test
-    public void testConvertTo() throws ConversionException {
-        final MeasurementRange<Float> range = MeasurementRange.create(1000f, 
true, 2000f, true, SI.METRE);
-        assertSame(range, range.convertTo(SI.METRE));
-        assertEquals(MeasurementRange.create(1f, true, 2f, true, 
SI.KILOMETRE), range.convertTo(SI.KILOMETRE));
+    public void testConvertTo() throws IncommensurableException {
+        final MeasurementRange<Float> range = MeasurementRange.create(1000f, 
true, 2000f, true, Units.METRE);
+        assertSame(range, range.convertTo(Units.METRE));
+        assertEquals(MeasurementRange.create(1f, true, 2f, true, 
Units.KILOMETRE), range.convertTo(Units.KILOMETRE));
     }
 
     /**
@@ -53,14 +51,14 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testAutoConversions() {
-        final MeasurementRange<Float> r1 = MeasurementRange.create(1000f, 
true, 2000f, true, SI.METRE);
-        final MeasurementRange<Float> r2 = MeasurementRange.create(1.5f, true, 
3f, true, SI.KILOMETRE);
+        final MeasurementRange<Float> r1 = MeasurementRange.create(1000f, 
true, 2000f, true, Units.METRE);
+        final MeasurementRange<Float> r2 = MeasurementRange.create(1.5f, true, 
3f, true, Units.KILOMETRE);
         assertEquals(Float.class, r1.getElementType());
         assertEquals(Float.class, r2.getElementType());
-        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, 
SI.METRE ),    r1.union    (r2));
-        assertEquals(MeasurementRange.create(   1f, true,    3f, true, 
SI.KILOMETRE), r2.union    (r1));
-        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, 
SI.METRE ),    r1.intersect(r2));
-        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, 
SI.KILOMETRE), r2.intersect(r1));
+        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, 
Units.METRE ),    r1.union    (r2));
+        assertEquals(MeasurementRange.create(   1f, true,    3f, true, 
Units.KILOMETRE), r2.union    (r1));
+        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, 
Units.METRE ),    r1.intersect(r2));
+        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, 
Units.KILOMETRE), r2.intersect(r1));
     }
 
     /**
@@ -68,12 +66,12 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testAutoConversionsOfAny() {
-        final MeasurementRange<?> r1 = MeasurementRange.create(1000f, true, 
2000f, true, SI.METRE);
-        final MeasurementRange<?> r2 = MeasurementRange.create(1.5f, true, 3f, 
true, SI.KILOMETRE);
-        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, 
SI.METRE ),    r1.unionAny    (r2));
-        assertEquals(MeasurementRange.create(   1f, true,    3f, true, 
SI.KILOMETRE), r2.unionAny    (r1));
-        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, 
SI.METRE ),    r1.intersectAny(r2));
-        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, 
SI.KILOMETRE), r2.intersectAny(r1));
+        final MeasurementRange<?> r1 = MeasurementRange.create(1000f, true, 
2000f, true, Units.METRE);
+        final MeasurementRange<?> r2 = MeasurementRange.create(1.5f, true, 3f, 
true, Units.KILOMETRE);
+        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, 
Units.METRE ),    r1.unionAny    (r2));
+        assertEquals(MeasurementRange.create(   1f, true,    3f, true, 
Units.KILOMETRE), r2.unionAny    (r1));
+        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, 
Units.METRE ),    r1.intersectAny(r2));
+        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, 
Units.KILOMETRE), r2.intersectAny(r1));
     }
 
     /**
@@ -81,9 +79,9 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testToString() {
-        MeasurementRange<Float> range = MeasurementRange.create(10f, true, 
20f, true, SI.KILOMETRE);
+        MeasurementRange<Float> range = MeasurementRange.create(10f, true, 
20f, true, Units.KILOMETRE);
         assertEquals("[10.0 … 20.0] km", range.toString());
-        range = MeasurementRange.create(10f, true, 20f, true, 
NonSI.DEGREE_ANGLE);
+        range = MeasurementRange.create(10f, true, 20f, true, Units.DEGREE);
         assertEquals("[10.0 … 20.0]°", range.toString());
     }
 
@@ -92,8 +90,8 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testSerialization() {
-        NumberRange<Float> r1 = MeasurementRange.create(1000f, true, 2000f, 
true, SI.METRE);
-        NumberRange<Float> r2 = MeasurementRange.create(1.5f, true, 3f, true, 
SI.KILOMETRE);
+        NumberRange<Float> r1 = MeasurementRange.create(1000f, true, 2000f, 
true, Units.METRE);
+        NumberRange<Float> r2 = MeasurementRange.create(1.5f, true, 3f, true, 
Units.KILOMETRE);
         assertNotSame(r1, assertSerializedEquals(r1));
         assertNotSame(r2, assertSerializedEquals(r2));
     }

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -24,8 +24,6 @@ import java.text.FieldPosition;
 import java.text.ParsePosition;
 import java.text.ParseException;
 import java.text.AttributedCharacterIterator;
-import javax.measure.unit.NonSI;
-import javax.measure.unit.SI;
 import org.junit.Test;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
@@ -42,7 +40,7 @@ import static org.apache.sis.internal.ut
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 @DependsOn(MeasurementRangeTest.class)
@@ -167,34 +165,34 @@ public final strictfp class RangeFormatT
         assertEquals("maxPos.endIndex",   7, maxPos.getEndIndex());
 
         // Positive infinity with integers
-        assertEquals("[50 … ∞)", format(new 
NumberRange<Integer>(Integer.class, 50, true, null, true)));
+        assertEquals("[50 … ∞)", format(new NumberRange<>(Integer.class, 50, 
true, null, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   7, maxPos.getEndIndex());
 
         // Negative infinity with integers
-        assertEquals("(-∞ … 40]", format(new 
NumberRange<Integer>(Integer.class, null, true, 40, true)));
+        assertEquals("(-∞ … 40]", format(new NumberRange<>(Integer.class, 
null, true, 40, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   8, maxPos.getEndIndex());
 
         // Measurement
-        assertEquals("[-10 … 20] m", format(MeasurementRange.create(-10, true, 
20, true, SI.METRE)));
+        assertEquals("[-10 … 20] m", format(MeasurementRange.create(-10, true, 
20, true, Units.METRE)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   4, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 7, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   9, maxPos.getEndIndex());
 
-        assertEquals("[-10 … 20]°", format(MeasurementRange.create(-10, true, 
20, true, NonSI.DEGREE_ANGLE)));
+        assertEquals("[-10 … 20]°", format(MeasurementRange.create(-10, true, 
20, true, Units.DEGREE)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   4, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 7, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   9, maxPos.getEndIndex());
 
         maxPos = new FieldPosition(RangeFormat.Field.UNIT);
-        assertEquals("[-1 … 2] km", format(MeasurementRange.create(-1, true, 
2, true, SI.KILOMETRE)));
+        assertEquals("[-1 … 2] km", format(MeasurementRange.create(-1, true, 
2, true, Units.KILOMETRE)));
         assertEquals("unitPos.beginIndex", 9, maxPos.getBeginIndex());
         assertEquals("unitPos.endIndex",  11, maxPos.getEndIndex());
     }

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,14 +16,13 @@
  */
 package org.apache.sis.measure;
 
-import javax.measure.unit.Unit;
-import javax.measure.quantity.Quantity;
-import javax.measure.converter.UnitConverter;
+import javax.measure.Unit;
+import javax.measure.Quantity;
+import javax.measure.UnitConverter;
 import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static javax.measure.unit.NonSI.DEGREE_ANGLE;
 import static org.apache.sis.measure.SexagesimalConverter.*;
 import static org.apache.sis.test.Assert.*;
 
@@ -33,7 +32,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.8
  * @module
  */
 public final strictfp class SexagesimalConverterTest extends TestCase {
@@ -46,7 +45,7 @@ public final strictfp class SexagesimalC
      * Converts the given value to an other unit, compares with the expected 
value, and verify
      * the inverse conversion. Then tries again with the negative of the given 
values.
      */
-    private static <Q extends Quantity> void checkConversion(
+    private static <Q extends Quantity<Q>> void checkConversion(
             final double expected, final Unit<Q> unitExpected,
             final double actual,   final Unit<Q> unitActual)
     {
@@ -63,11 +62,11 @@ public final strictfp class SexagesimalC
      */
     @Test
     public void testDM() {
-        checkConversion(10.00,              DEGREE_ANGLE, 10.0000,    DM);
-        checkConversion(10.006,             DEGREE_ANGLE, 10.0036,    DM);
-        checkConversion(10.50,              DEGREE_ANGLE, 10.3000,    DM);
-        checkConversion(10.987333333333333, DEGREE_ANGLE, 10.5924,    DM);
-        checkConversion(44.503354166666666, DEGREE_ANGLE, 44.3020125, DM);
+        checkConversion(10.00,              Units.DEGREE, 10.0000,    DM);
+        checkConversion(10.006,             Units.DEGREE, 10.0036,    DM);
+        checkConversion(10.50,              Units.DEGREE, 10.3000,    DM);
+        checkConversion(10.987333333333333, Units.DEGREE, 10.5924,    DM);
+        checkConversion(44.503354166666666, Units.DEGREE, 44.3020125, DM);
     }
 
     /**
@@ -75,11 +74,11 @@ public final strictfp class SexagesimalC
      */
     @Test
     public void testDMS() {
-        checkConversion(10.00,              DEGREE_ANGLE, 10.0000,    DMS);
-        checkConversion(10.01,              DEGREE_ANGLE, 10.0036,    DMS);
-        checkConversion(10.50,              DEGREE_ANGLE, 10.3000,    DMS);
-        checkConversion(10.99,              DEGREE_ANGLE, 10.5924,    DMS);
-        checkConversion(44.505590277777777, DEGREE_ANGLE, 44.3020125, DMS);
+        checkConversion(10.00,              Units.DEGREE, 10.0000,    DMS);
+        checkConversion(10.01,              Units.DEGREE, 10.0036,    DMS);
+        checkConversion(10.50,              Units.DEGREE, 10.3000,    DMS);
+        checkConversion(10.99,              Units.DEGREE, 10.5924,    DMS);
+        checkConversion(44.505590277777777, Units.DEGREE, 44.3020125, DMS);
     }
 
     /**
@@ -87,11 +86,11 @@ public final strictfp class SexagesimalC
      */
     @Test
     public void testDMS_Scaled() {
-        checkConversion(10.00,              DEGREE_ANGLE, 100000,     
DMS_SCALED);
-        checkConversion(10.01,              DEGREE_ANGLE, 100036,     
DMS_SCALED);
-        checkConversion(10.50,              DEGREE_ANGLE, 103000,     
DMS_SCALED);
-        checkConversion(10.99,              DEGREE_ANGLE, 105924,     
DMS_SCALED);
-        checkConversion(44.505590277777777, DEGREE_ANGLE, 443020.125, 
DMS_SCALED);
+        checkConversion(10.00,              Units.DEGREE, 100000,     
DMS_SCALED);
+        checkConversion(10.01,              Units.DEGREE, 100036,     
DMS_SCALED);
+        checkConversion(10.50,              Units.DEGREE, 103000,     
DMS_SCALED);
+        checkConversion(10.99,              Units.DEGREE, 105924,     
DMS_SCALED);
+        checkConversion(44.505590277777777, Units.DEGREE, 443020.125, 
DMS_SCALED);
     }
 
     /**

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,34 +16,11 @@
  */
 package org.apache.sis.measure;
 
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static javax.measure.unit.Unit.ONE;
-import static javax.measure.unit.SI.CELSIUS;
-import static javax.measure.unit.SI.KELVIN;
-import static javax.measure.unit.SI.METRE;
-import static javax.measure.unit.SI.METRES_PER_SECOND;
-import static javax.measure.unit.SI.SQUARE_METRE;
-import static javax.measure.unit.SI.KILOMETRE;
-import static javax.measure.unit.SI.KILOGRAM;
-import static javax.measure.unit.SI.JOULE;
-import static javax.measure.unit.SI.PASCAL;
-import static javax.measure.unit.SI.SECOND;
-import static javax.measure.unit.SI.HERTZ;
-import static javax.measure.unit.SI.RADIAN;
-import static javax.measure.unit.NonSI.CENTIRADIAN;
-import static javax.measure.unit.NonSI.DEGREE_ANGLE;
-import static javax.measure.unit.NonSI.MINUTE_ANGLE;
-import static javax.measure.unit.NonSI.SECOND_ANGLE;
-import static javax.measure.unit.NonSI.GRADE;
-import static javax.measure.unit.NonSI.DAY;
-import static javax.measure.unit.NonSI.SPHERE;
-import static javax.measure.unit.NonSI.ATMOSPHERE;
-import static javax.measure.unit.NonSI.NAUTICAL_MILE;
-import static javax.measure.unit.NonSI.PERCENT;
 import static org.apache.sis.measure.SexagesimalConverter.*;
 import static org.apache.sis.measure.Units.*;
 import static org.apache.sis.test.Assert.*;
@@ -54,7 +31,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 @DependsOn({
@@ -80,10 +57,10 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testSerialization() {
-        assertEquals(DEGREE_ANGLE,         
assertSerializedEquals(DEGREE_ANGLE));
-        assertEquals(DMS,      assertSerializedEquals(DMS));
+        assertEquals(DEGREE,     assertSerializedEquals(DEGREE));
+        assertEquals(DMS,        assertSerializedEquals(DMS));
         assertEquals(DMS_SCALED, assertSerializedEquals(DMS_SCALED));
-        assertEquals(PPM,                  assertSerializedEquals(PPM));
+        assertEquals(PPM,        assertSerializedEquals(PPM));
     }
 
     /**
@@ -96,14 +73,11 @@ public final strictfp class UnitsTest ex
         assertFalse(isTemporal(ONE));
         assertFalse(isTemporal(METRE));
         assertFalse(isTemporal(RADIAN));
-        assertFalse(isTemporal(CENTIRADIAN));
-        assertFalse(isTemporal(DEGREE_ANGLE));
-        assertFalse(isTemporal(MINUTE_ANGLE));
-        assertFalse(isTemporal(SECOND_ANGLE));
-        assertFalse(isTemporal(GRADE));
+        assertFalse(isTemporal(DEGREE));
+        assertFalse(isTemporal(ARC_MINUTE));
+        assertFalse(isTemporal(ARC_SECOND));
+        assertFalse(isTemporal(GRAD));
         assertTrue (isTemporal(DAY));
-        assertFalse(isTemporal(SPHERE));
-        assertFalse(isTemporal(ATMOSPHERE));
         assertFalse(isTemporal(NAUTICAL_MILE));
 
         // Additional units
@@ -123,14 +97,11 @@ public final strictfp class UnitsTest ex
         assertFalse(isLinear(ONE));
         assertTrue (isLinear(METRE));
         assertFalse(isLinear(RADIAN));
-        assertFalse(isLinear(CENTIRADIAN));
-        assertFalse(isLinear(DEGREE_ANGLE));
-        assertFalse(isLinear(MINUTE_ANGLE));
-        assertFalse(isLinear(SECOND_ANGLE));
-        assertFalse(isLinear(GRADE));
+        assertFalse(isLinear(DEGREE));
+        assertFalse(isLinear(ARC_MINUTE));
+        assertFalse(isLinear(ARC_SECOND));
+        assertFalse(isLinear(GRAD));
         assertFalse(isLinear(DAY));
-        assertFalse(isLinear(SPHERE));
-        assertFalse(isLinear(ATMOSPHERE));
         assertTrue (isLinear(NAUTICAL_MILE));
 
         // Additional units
@@ -150,14 +121,11 @@ public final strictfp class UnitsTest ex
         assertFalse(isAngular(ONE));
         assertFalse(isAngular(METRE));
         assertTrue (isAngular(RADIAN));
-        assertTrue (isAngular(CENTIRADIAN));
-        assertTrue (isAngular(DEGREE_ANGLE));
-        assertTrue (isAngular(MINUTE_ANGLE));
-        assertTrue (isAngular(SECOND_ANGLE));
-        assertTrue (isAngular(GRADE));
+        assertTrue (isAngular(DEGREE));
+        assertTrue (isAngular(ARC_MINUTE));
+        assertTrue (isAngular(ARC_SECOND));
+        assertTrue (isAngular(GRAD));
         assertFalse(isAngular(DAY));
-        assertFalse(isAngular(SPHERE));
-        assertFalse(isAngular(ATMOSPHERE));
         assertFalse(isAngular(NAUTICAL_MILE));
 
         // Additional units
@@ -177,14 +145,11 @@ public final strictfp class UnitsTest ex
         assertTrue (isScale(ONE));
         assertFalse(isScale(METRE));
         assertFalse(isScale(RADIAN));
-        assertFalse(isScale(CENTIRADIAN));
-        assertFalse(isScale(DEGREE_ANGLE));
-        assertFalse(isScale(MINUTE_ANGLE));
-        assertFalse(isScale(SECOND_ANGLE));
-        assertFalse(isScale(GRADE));
+        assertFalse(isScale(DEGREE));
+        assertFalse(isScale(ARC_MINUTE));
+        assertFalse(isScale(ARC_SECOND));
+        assertFalse(isScale(GRAD));
         assertFalse(isScale(DAY));
-        assertFalse(isScale(SPHERE));
-        assertFalse(isScale(ATMOSPHERE));
         assertFalse(isScale(NAUTICAL_MILE));
 
         // Additional units
@@ -201,7 +166,6 @@ public final strictfp class UnitsTest ex
     public void testIsPressure() {
         assertFalse(isPressure(null));
         assertFalse(isPressure(METRE));
-        assertTrue (isPressure(ATMOSPHERE));
     }
 
     /**
@@ -210,7 +174,7 @@ public final strictfp class UnitsTest ex
     @Test
     public void testToStandardUnit() {
         assertEquals(1000.0,               toStandardUnit(KILOMETRE),    
1E-15);
-        assertEquals(0.017453292519943295, toStandardUnit(DEGREE_ANGLE), 
1E-15);
+        assertEquals(0.017453292519943295, toStandardUnit(DEGREE), 1E-15);
     }
 
     /**
@@ -218,8 +182,8 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testMultiply() {
-        assertSame(KILOMETRE,    multiply(METRE,  1000));
-        assertSame(DEGREE_ANGLE, multiply(RADIAN, 0.017453292519943295));
+        assertSame(KILOMETRE, multiply(METRE,  1000));
+        assertSame(DEGREE, multiply(RADIAN, 0.017453292519943295));
     }
 
     /**
@@ -227,18 +191,18 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testValueOf() {
-        assertSame(DEGREE_ANGLE, valueOf("°"));
-        assertSame(DEGREE_ANGLE, valueOf("deg"));
-        assertSame(DEGREE_ANGLE, valueOf("degree"));
-        assertSame(DEGREE_ANGLE, valueOf("degrees"));
-        assertSame(DEGREE_ANGLE, valueOf("degrées"));
-        assertSame(DEGREE_ANGLE, valueOf("DEGREES"));
-        assertSame(DEGREE_ANGLE, valueOf("DEGRÉES"));
-        assertSame(DEGREE_ANGLE, valueOf("degrees_east"));
-        assertSame(DEGREE_ANGLE, valueOf("degrees_north"));
-        assertSame(DEGREE_ANGLE, valueOf("degrées_north"));
-        assertSame(DEGREE_ANGLE, valueOf("decimal_degree"));
-        assertSame(SECOND_ANGLE, valueOf("arcsec"));
+        assertSame(DEGREE,       valueOf("°"));
+        assertSame(DEGREE,       valueOf("deg"));
+        assertSame(DEGREE,       valueOf("degree"));
+        assertSame(DEGREE,       valueOf("degrees"));
+        assertSame(DEGREE,       valueOf("degrées"));
+        assertSame(DEGREE,       valueOf("DEGREES"));
+        assertSame(DEGREE,       valueOf("DEGRÉES"));
+        assertSame(DEGREE,       valueOf("degrees_east"));
+        assertSame(DEGREE,       valueOf("degrees_north"));
+        assertSame(DEGREE,       valueOf("degrées_north"));
+        assertSame(DEGREE,       valueOf("decimal_degree"));
+        assertSame(ARC_SECOND,   valueOf("arcsec"));
         assertSame(RADIAN,       valueOf("rad"));
         assertSame(RADIAN,       valueOf("radian"));
         assertSame(RADIAN,       valueOf("radians"));
@@ -269,7 +233,7 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testAdvancedValueOf() {
-        assertSame  (Units.MILLISECOND,             valueOf("ms"));
+        assertSame  (MILLISECOND,                   valueOf("ms"));
         assertEquals(METRES_PER_SECOND,             valueOf("m/s"));
         assertEquals(METRES_PER_SECOND,             valueOf("m.s-1"));
         assertEquals(SQUARE_METRE.divide(SECOND),   valueOf("m2.s-1"));
@@ -279,14 +243,14 @@ public final strictfp class UnitsTest ex
         assertSame  (HERTZ,                         valueOf("1/s"));
         assertSame  (HERTZ,                         valueOf("s-1"));
         assertSame  (PERCENT,                       valueOf("%"));
-        assertSame  (Unit.ONE,                      valueOf("kg/kg"));
-        assertSame  (Unit.ONE,                      valueOf("kg.kg-1"));
-        assertSame  (Units.PPM,                     valueOf("ppm")); // Parts 
per million
-        assertSame  (Units.PSU,                     valueOf("psu")); // 
Pratical Salinity Unit
-        assertSame  (Units.SIGMA,                   valueOf("sigma"));
+        assertSame  (ONE,                           valueOf("kg/kg"));
+        assertSame  (ONE,                           valueOf("kg.kg-1"));
+        assertSame  (PPM,                           valueOf("ppm"));           
 // Parts per million
+        assertSame  (PSU,                           valueOf("psu"));           
 // Pratical Salinity Unit
+        assertSame  (SIGMA,                         valueOf("sigma"));
 
         // Potential vorticity surface
-        
assertEquals(KELVIN.times(SQUARE_METRE).divide(KILOGRAM.times(SECOND)), 
valueOf("K.m2.kg-1.s-1"));
+        
assertEquals(KELVIN.multiply(SQUARE_METRE).divide(KILOGRAM.multiply(SECOND)), 
valueOf("K.m2.kg-1.s-1"));
     }
 
     /**
@@ -294,14 +258,14 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testValueOfEPSG() {
-        assertSame(METRE,        valueOfEPSG(9001));
-        assertSame(DEGREE_ANGLE, valueOfEPSG(9102)); // Used in prime meridian 
and operation parameters.
-        assertSame(DEGREE_ANGLE, valueOfEPSG(9122)); // Used in coordinate 
system axes.
-        assertSame(METRE,        valueOf("EPSG:9001"));
-        assertSame(DEGREE_ANGLE, valueOf(" epsg : 9102"));
-        assertSame(DEGREE_ANGLE, valueOf("urn:ogc:def:uom:EPSG::9102"));
-        assertSame(METRE,        
valueOf("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])"));
-        assertSame(METRE,        valueOf("gmxUom.xml#m"));
+        assertSame(METRE,  valueOfEPSG(9001));
+        assertSame(DEGREE, valueOfEPSG(9102));              // Used in prime 
meridian and operation parameters.
+        assertSame(DEGREE, valueOfEPSG(9122));              // Used in 
coordinate system axes.
+        assertSame(METRE,  valueOf("EPSG:9001"));
+        assertSame(DEGREE, valueOf(" epsg : 9102"));
+        assertSame(DEGREE, valueOf("urn:ogc:def:uom:EPSG::9102"));
+        assertSame(METRE,  
valueOf("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])"));
+        assertSame(METRE,  valueOf("gmxUom.xml#m"));
     }
 
     /**
@@ -309,10 +273,10 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testGetEpsgCode() {
-        assertEquals(Integer.valueOf(9001), getEpsgCode(METRE, false));
-        assertEquals(Integer.valueOf(9102), getEpsgCode(DEGREE_ANGLE, false));
-        assertEquals(Integer.valueOf(9122), getEpsgCode(DEGREE_ANGLE, true));
-        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS, false));
-        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS, true));
+        assertEquals(Integer.valueOf(9001), getEpsgCode(METRE,  false));
+        assertEquals(Integer.valueOf(9102), getEpsgCode(DEGREE, false));
+        assertEquals(Integer.valueOf(9122), getEpsgCode(DEGREE, true));
+        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,    false));
+        assertEquals(Integer.valueOf(9110), getEpsgCode(DMS,    true));
     }
 }

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/CoordinateSystemAxisMock.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/CoordinateSystemAxisMock.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/CoordinateSystemAxisMock.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/CoordinateSystemAxisMock.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -16,7 +16,7 @@
  */
 package org.apache.sis.test.mock;
 
-import javax.measure.unit.Unit;
+import javax.measure.Unit;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;

Modified: 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/mock/VerticalCRSMock.java
 [UTF-8] Thu Oct 13 13:38:49 2016
@@ -17,9 +17,7 @@
 package org.apache.sis.test.mock;
 
 import java.util.Date;
-import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
+import javax.measure.Unit;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.cs.AxisDirection;
@@ -29,6 +27,7 @@ import org.opengis.referencing.cs.Vertic
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.opengis.util.InternationalString;
+import org.apache.sis.measure.Units;
 
 
 /**
@@ -36,7 +35,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.8
  * @module
  */
 @SuppressWarnings("serial")
@@ -47,31 +46,31 @@ public final strictfp class VerticalCRSM
      * Height in metres.
      */
     public static final VerticalCRS HEIGHT = new VerticalCRSMock("Height",
-            VerticalDatumType.GEOIDAL, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY, SI.METRE, true);
+            VerticalDatumType.GEOIDAL, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY, Units.METRE, true);
 
     /**
      * Height in feet.
      */
     public static final VerticalCRS HEIGHT_ft = new VerticalCRSMock("Height",
-            VerticalDatumType.GEOIDAL, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY, NonSI.FOOT, true);
+            VerticalDatumType.GEOIDAL, Double.NEGATIVE_INFINITY, 
Double.POSITIVE_INFINITY, Units.FOOT, true);
 
     /**
      * Height estimated from hPa.
      */
     public static final VerticalCRS BAROMETRIC_HEIGHT = new 
VerticalCRSMock("Barometric height",
-            VerticalDatumType.BAROMETRIC, 0, Double.POSITIVE_INFINITY, 
SI.MetricPrefix.HECTO(SI.PASCAL), true);
+            VerticalDatumType.BAROMETRIC, 0, Double.POSITIVE_INFINITY, 
Units.HECTOPASCAL, true);
 
     /**
      * Depth in metres.
      */
     public static final VerticalCRS DEPTH = new VerticalCRSMock("Depth",
-            VerticalDatumType.DEPTH, 0, Double.POSITIVE_INFINITY, SI.METRE, 
false);
+            VerticalDatumType.DEPTH, 0, Double.POSITIVE_INFINITY, Units.METRE, 
false);
 
     /**
      * Depth as a fraction of the sea floor depth at the location of the point 
for which the depth is evaluated.
      */
     public static final VerticalCRS SIGMA_LEVEL = new VerticalCRSMock("Sigma 
level",
-            VerticalDatumType.OTHER_SURFACE, 0, 1, Unit.ONE, false);
+            VerticalDatumType.OTHER_SURFACE, 0, 1, Units.ONE, false);
 
     /**
      * The datum type (geoidal, barometric, etc.).

Modified: sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties 
[ISO-8859-1] (original)
+++ sis/branches/JDK8/ide-project/NetBeans/nbproject/project.properties 
[ISO-8859-1] Thu Oct 13 13:38:49 2016
@@ -84,8 +84,8 @@ project.GeoAPI       = ../../../../GeoAP
 # Those dependencies must exist in the local Maven repository.
 # Those numbers should match the ones declared in the pom.xml files.
 #
-unit-api.version     = 0.6.1
-jsr275.version       = 0.9.3
+jsr363.version       = 1.0
+jsr363-ri.version    = 1.0.1
 jama.version         = 1.0.3
 geometry.version     = 1.2.1
 georss.version       = 0.9.8
@@ -110,7 +110,8 @@ maven.repository   = ${user.home}/.m2/re
 endorsed.classpath=
 javac.classpath=\
     ${project.GeoAPI}/dist/geoapi.jar:\
-    
${maven.repository}/javax/measure/jsr-275/${jsr275.version}/jsr-275-${jsr275.version}.jar:\
+    
${maven.repository}/javax/measure/unit-api/${jsr363.version}/unit-api-${jsr363.version}.jar:\
+    
${maven.repository}/tec/units/unit-ri/${jsr363-ri.version}/unit-ri-${jsr363-ri.version}.jar:\
     
${maven.repository}/com/esri/geometry/esri-geometry-api/${geometry.version}/esri-geometry-api-${geometry.version}.jar:\
     
${maven.repository}/org/geonames/georss-rome/${georss.version}/georss-rome-${georss.version}.jar:\
     ${maven.repository}/rome/rome/${rome.version}/rome-${rome.version}.jar:\

Modified: sis/branches/JDK8/pom.xml
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/pom.xml?rev=1764673&r1=1764672&r2=1764673&view=diff
==============================================================================
--- sis/branches/JDK8/pom.xml (original)
+++ sis/branches/JDK8/pom.xml Thu Oct 13 13:38:49 2016
@@ -554,6 +554,7 @@ Apache SIS is a free software, Java lang
           <includes>
             <include>**/*TestSuite.java</include>
           </includes>
+          <skipTests>true</skipTests>   <!-- Temporary, while we migrate from 
JSR-275 to JSR-363. -->
           <systemProperties>
             <property>
               <name>derby.stream.error.file</name>



Reply via email to