Class UnitsConverter


  • public class UnitsConverter
    extends Object
    Converter between units.

    Instances of this class are immutable.

    Since:
    11.0
    Author:
    Luc Maisonobe
    • Field Detail

      • IDENTITY

        public static final UnitsConverter IDENTITY
        Identity converter.
      • PERCENTS_TO_UNIT

        public static final UnitsConverter PERCENTS_TO_UNIT
        Percents to units converter.
      • ARC_SECONDS_TO_RADIANS

        public static final UnitsConverter ARC_SECONDS_TO_RADIANS
        Arcseconds to radians converter.
      • MILLI_ARC_SECONDS_TO_RADIANS

        public static final UnitsConverter MILLI_ARC_SECONDS_TO_RADIANS
        Milli arcseconds to radians converter.
      • MILLI_SECONDS_TO_SECONDS

        public static final UnitsConverter MILLI_SECONDS_TO_SECONDS
        Milli seconds to seconds converter.
      • NANO_TESLAS_TO_TESLAS

        public static final UnitsConverter NANO_TESLAS_TO_TESLAS
        Nano Teslas to Tesla converter.
      • DAYS_TO_SECONDS

        public static final UnitsConverter DAYS_TO_SECONDS
        Days to seconds converter.
      • KILOMETRES_TO_METRES

        public static final UnitsConverter KILOMETRES_TO_METRES
        Kilometres to metres converter.
      • KILOMETRES_2_TO_METRES_2

        public static final UnitsConverter KILOMETRES_2_TO_METRES_2
        Square kilometres to square metres converter.
      • KM3_P_S2_TO_M3_P_S2

        public static final UnitsConverter KM3_P_S2_TO_M3_P_S2
        km³/s² to m³/s² converter.
    • Constructor Detail

      • UnitsConverter

        public UnitsConverter​(Unit from,
                              Unit to)
        Simple constructor.
        Parameters:
        from - source unit
        to - destination unit
    • Method Detail

      • getFrom

        public Unit getFrom()
        Get the source unit.
        Returns:
        source unit
      • getTo

        public Unit getTo()
        Get the destination unit.
        Returns:
        destination unit
      • convert

        public double convert​(double value)
        Convert a value.
        Parameters:
        value - value in the source unit
        Returns:
        value converted in the destination unit