Module JNISpice
Package spice.basic

Class Units

  • Direct Known Subclasses:
    AngularUnits, DistanceUnits

    public abstract class Units
    extends java.lang.Object
    Class Units represents physical units and supports conversions between them.

    Version 1.0.0 12-JUL-2009 (NJB)

    • Constructor Summary

      Constructors 
      Constructor Description
      Units()  
    • Method Summary

      Modifier and Type Method Description
      static double convert​(double quantity, Units fromUnits, Units toUnits)
      Convert a quantity from one set of units to another.
      abstract java.lang.String toString()
      Return a String representation of a Unit.
      • Methods inherited from class java.lang.Object

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

      • Units

        public Units()
    • Method Detail

      • toString

        public abstract java.lang.String toString()
        Return a String representation of a Unit.
        Overrides:
        toString in class java.lang.Object
        Returns:
        toString
      • convert

        public static double convert​(double quantity,
                                     Units fromUnits,
                                     Units toUnits)
                              throws SpiceException
        Convert a quantity from one set of units to another.

        The full set of units supported by the underlying conversion algorithm is shown below. However, support for many of these units is not yet implemented in the Alpha version of JNISpice.

        
                      Angles:                 "RADIANS"
                                              "DEGREES"
                                              "ARCMINUTES"
                                              "ARCSECONDS"
                                              "HOURANGLE"
                                              "MINUTEANGLE"
                                              "SECONDANGLE"
        
                      Metric Distances:       "METERS"
                                              "KM"
                                              "CM"
                                              "MM"
        
                      English Distances:      "FEET"
                                              "INCHES"
                                              "YARDS"
                                              "STATUTE_MILES"
                                              "NAUTICAL_MILES"
        
                      Astrometric Distances:  "AU"
                                              "PARSECS"
                                              "LIGHTSECS"
                                              "LIGHTYEARS" julian lightyears
        
                      Time:                   "SECONDS"
                                              "MINUTES"
                                              "HOURS"
                                              "DAYS"
                                              "JULIAN_YEARS"
                                              "TROPICAL_YEARS"
                                              "YEARS" (same as julian years)
           
        Parameters:
        quantity - Double
        fromUnits - Units
        toUnits - Units
        Returns:
        Double result
        Throws:
        SpiceException - exception