sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Documentation updates.
Date Wed, 15 Aug 2018 15:40:22 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 879060d  Documentation updates.
879060d is described below

commit 879060dc955939ce9f02a1fb684256f596c7e59f
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Aug 15 17:18:04 2018 +0200

    Documentation updates.
---
 .../org/apache/sis/metadata/sql/Contents.sql       |  4 +++
 .../org/apache/sis/internal/util/DoubleDouble.java |  6 ++--
 .../java/org/apache/sis/measure/package-info.java  | 33 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Contents.sql
b/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Contents.sql
index 3d5fdcc..8eb153c 100644
--- a/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Contents.sql
+++ b/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Contents.sql
@@ -78,6 +78,10 @@ CREATE TABLE metadata."Band" (
   "peakResponse"         DOUBLE PRECISION)
 INHERITS (metadata."SampleDimension");
 
+--
+-- TODO: move those declarations in sis-earthobservation module.
+-- https://issues.apache.org/jira/browse/SIS-338
+--
 INSERT INTO metadata."Band" ("ID", "sequenceIdentifier", "description", "boundMin", "boundMax",
"boundUnits", "peakResponse") VALUES
   ('Landsat 8-01',  '1', 'Ultra Blue (coastal/aerosol)',         435.0,  451.0, 'nm',   443.0),
   ('Landsat 8-02',  '2', 'Blue',                                 452.0,  512.1, 'nm',   482.0),
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java
b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java
index 473d0cb..8cc0e6e 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DoubleDouble.java
@@ -267,7 +267,7 @@ public final class DoubleDouble extends Number {
     public DoubleDouble(final double value, final double error) {
         this.value = value;
         this.error = error;
-        assert !(Math.abs(error) >= Math.ulp(value)) : this; // Use ! for being tolerant
to NaN.
+        assert !(Math.abs(error) >= Math.ulp(value)) : this;            // Use ! for being
tolerant to NaN.
     }
 
     /**
@@ -1096,8 +1096,6 @@ public final class DoubleDouble extends Number {
         return false;
     }
 
-
-
     /**
      * Returns a string representation of this number for debugging purpose.
      * The returned string does not need to contains all digits that this {@code DoubleDouble}
can handle.
@@ -1106,6 +1104,6 @@ public final class DoubleDouble extends Number {
      */
     @Override
     public String toString() {
-        return String.valueOf(value);
+        return new BigDecimal(value).add(new BigDecimal(error), MathContext.DECIMAL128).toString();
     }
 }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java b/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
index 90c3631..dac8cc3 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
@@ -62,6 +62,39 @@
  *       {@link org.apache.sis.measure.UnitFormat})</li>
  * </ul>
  *
+ * Apache SIS supports arithmetic operations on units and on quantities.
+ * The unit (including SI prefix) and the quantity type resulting from
+ * those arithmetic operations are automatically inferred.
+ * For example this line of code:
+ *
+ * {@preformat java
+ *   System.out.println( Units.PASCAL.multiply(1000) );
+ * }
+ *
+ * prints <cite>"kPa"</cite>, i.e. the kilo prefix has been automatically applied
+ * (SI prefixes are applied on SI units only, not on other systems).
+ * Other example:
+ *
+ * {@preformat java
+ *   Force  f = Quantities.create(4, Units.NEWTON);
+ *   Length d = Quantities.create(6, Units.MILLIMETRE);
+ *   Time   t = Quantities.create(3, Units.SECOND);
+ *   Quantity<?> e = f.multiply(d).divide(t);
+ *   System.out.println(e);
+ *   System.out.println("Instance of Power: " + (e instanceof Power));
+ * }
+ *
+ * prints <cite>"8 mW"</cite> and <cite>"Instance of Power: true"</cite>,
+ * i.e. Apache SIS detects that the result of N⋅m∕s is Watt,
+ * inherits the milli prefix from millimetre and creates an instance
+ * of {@link javax.measure.quantity.Power}, not just {@code Quantity<Power>} (the generic
parent).
+ *
+ * <p>{@linkplain org.apache.sis.measure.Units#valueOf(String) Parsing} and formatting
use Unicode symbols by default, as in µg/m².
+ * Parenthesis are recognized at parsing time and used for denominators at formatting time,
as in kg/(m²⋅s).
+ * While uncommon, Apache SIS accepts fractional powers as in m^⅔.
+ * Some sentences like <cite>"100 feet"</cite>, <cite>"square metre"</cite>
and <cite>"degree Kelvin"</cite>
+ * are also recognized at parsing time.</p>
+ *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @version 1.0
  * @since   0.3


Mime
View raw message