Module org.apache.sis.util

# Package org.apache.sis.measure

package org.apache.sis.measure
Units of measurements, values related to measurement (like angles and ranges) and their formatters. A key class in this package is `Units`, which provides static constants for about 50 units of measurement including all the SI base units (metre, kilogram second, ampere, kelvin, mole and candela) together with some derived units (square metre, cubic metre, metres per second, hertz, pascal, newton, joule, watt, tesla, etc.) and some dimensionless units (radian, steradian, pixel, unity). In relation to units of measurement, this package also defines:

- Quantities as a `double` value value associated to a `Unit` instance.
- `Angle` and its subclasses (`Longitude`, `Latitude`, `ElevationAngle`)
- `Range` and its subclasses (`NumberRange`, `MeasurementRange`) or annotation (`ValueRange`)
- Parsers and formatters (`AngleFormat`, `RangeFormat`, `UnitFormat`)

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:

    System.out.println( Units.PASCAL.multiply(1000) );

prints "kPa", i.e. the kilo prefix has been automatically applied (SI prefixes are applied on SI units only, not on other systems). Other example:

    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 "8 mW" and "Instance of Power: true", 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 `Power`, not just `Quantity<Power>` (the generic parent).

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 "100 feet", "square metre" and "degree Kelvin" are also recognized at parsing time.

Since:
  0.3

- Class
  Description
  Angle
  An angle in decimal degrees.
  AngleFormat
  Parses and formats angles according a specified pattern.
  AngleFormat.Field
  Constants that are used as attribute keys in the iterator returned from `AngleFormat​.formatToCharacterIterator(Object)`.
  AngularVelocity
  The rate of change of an angular displacement with respect to time.
  ElevationAngle
  The angular height of an object measured from the horizontal plane.
  Latitude
  A latitude angle in decimal degrees.
  Longitude
  A longitude angle in decimal degrees.
  MeasurementRange<E extends Number & Comparable<? super E>>
  A range of numbers associated with a unit of measurement.
  NumberRange<E extends Number & Comparable<? super E>>
  A range of numbers capable of widening conversions when performing range operations.
  Quantities
  Provides static methods working on `Quantity` instances.
  QuantityFormat
  Parses and formats numbers with units of measurement.
  Range<E extends Comparable<? super E>>
  A set of minimum and maximum values of a certain class, allowing a user to determine if a value of the same class is contained inside the range.
  RangeFormat
  Parses and formats `Range` instances according the given locale.
  RangeFormat.Field
  Constants that are used as attribute keys in the iterator returned from `RangeFormat​.formatToCharacterIterator(Object)`.
  Salinity
  The Practical Salinity Scale (PSS-78).
  UnitFormat
  Parses and formats units of measurement as SI symbols, URI in OGC namespace or other symbols.
  UnitFormat.Style
  Identify whether unit formatting uses ASCII symbols, Unicode symbols or full localized names.
  Units
  Provides constants for various Units of Measurement together with static methods working on `Unit` instances.
  UnitServices
  The central point from which all unit services (parsing, formatting, listing, etc) can be obtained.
  ValueRange
  The range of values assignable to a field, or to a JavaBean property.