JEphem site
jephem API
Build classes

tig
Class Formats

java.lang.Object
  |
  +--tig.Formats

public class Formats
extends java.lang.Object

Class containing constants and static methods for formatting outputs.
Called Formats to distinguish from java.text.Format.


Field Summary
static java.lang.String DEG
           
static java.lang.String MINUS
           
static java.lang.String MINUT
           
static java.lang.String SECOND
           
static java.lang.String ZERO
           
 
Constructor Summary
Formats()
           
 
Method Summary
static java.lang.String addZero(int nb)
          Formats a integer to a 2 character long String.
static java.lang.String doubleToDMS(double x)
          Expresses a number in format "DMS" (degrees, minuts, seconds).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINUS

public static final java.lang.String MINUS
See Also:
Constant Field Values

DEG

public static final java.lang.String DEG
See Also:
Constant Field Values

ZERO

public static final java.lang.String ZERO
See Also:
Constant Field Values

MINUT

public static final java.lang.String MINUT
See Also:
Constant Field Values

SECOND

public static final java.lang.String SECOND
See Also:
Constant Field Values
Constructor Detail

Formats

public Formats()
Method Detail

doubleToDMS

public static java.lang.String doubleToDMS(double x)
Expresses a number in format "DMS" (degrees, minuts, seconds).
For example, 186.5 will be transformed to 186°30'00" ;
-6.5 will be transformed to -6°30'00".
Warning : x must be reduced to its correct interval (ex [0, 360[) before calling this method.

Parameters:
x - any number.
Returns:
x expressed in "DMS" format.

addZero

public static java.lang.String addZero(int nb)
Formats a integer to a 2 character long String. Useful for date formatting.

Parameters:
nb - integer number to format.
Returns:
A String representation of nb :
  • if 0 <= nb <= 9, "0" followed by the digit ;
  • if 10 <= nb <= 99, the two digits ;
  • if nb < 0 or nb > 100, the String "xx".

  • JEphem site
    jephem API
    Build classes