com.ibm.geolib.unit

Class Unit

  • java.lang.Object
    • com.ibm.geolib.unit.Unit
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected Unit(java.lang.String name, double value)
      Constructor
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static <T extends Unit> 
      T
      byName(java.lang.String unitName)
      Return a unit element of a given name
      static <T extends Unit> 
      double
      convert(double value, T from, T to)
      Convert a measurement between two units
      protected double fromBase(double n) 
      java.lang.String getName() 
      protected double toBase(double n) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Unit

        protected Unit(java.lang.String name,
            double value)
        Constructor
        Parameters:
        type -
        name -
        value -
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns:
        the name of the unit
      • toBase

        protected double toBase(double n)
        Parameters:
        n -
        Returns:
        the converted value
      • fromBase

        protected double fromBase(double n)
        Parameters:
        n -
        Returns:
        the inverse conversion of the value
      • convert

        public static <T extends Unit> double convert(double value,
                                      T from,
                                      T to)
        Convert a measurement between two units
        Parameters:
        value - to be converted
        from - unit
        to - unit
        Returns:
        the conversion of 'value' from parameter 'from' to parameter 'to'
      • byName

        public static <T extends Unit> T byName(java.lang.String unitName)
        Return a unit element of a given name
        Parameters:
        unitName - the requested unit name
        Returns:
        a unit element of 'unitName'

© Copyright IBM 2017