|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.astro.Astroformat
cds.astro.Editing
public class Editing
Class for 'nice' edition of numbers.
This class contains options for the edition of integer / float numbers;
the edited value is appended to the StringBuffer generally specified
as the first argument.
This class is used in the various astronomical editions.
Field Summary | |
---|---|
static boolean |
DEBUG
Debugging option |
java.lang.String |
inf_string
How the Infinite is represented -- default is Inf |
Fields inherited from class cds.astro.Astroformat |
---|
DATE, DATE_alpha, DATE_COMP, DATE_DIFF, DATE_DMY, DATE_DY, DATE_MDY, DATE_MY, DATE_MYD, DATE_YD, DATE_YM, DATE_YMD, DECIMAL, EFORMAT, FACTOR, month_list, nulls, SEXA1d, SEXA1h, SEXA1o, SEXA2, SEXA2c, SEXA2d, SEXA2h, SEXA2o, SEXA3, SEXA3c, SEXA3d, SEXA3h, SEXA3o, SIGN_EDIT, TRUNCATE, ZERO_FILL |
Constructor Summary | |
---|---|
Editing()
The basic constructor: default NaN edition is "-". |
|
Editing(java.lang.String null_text)
Constructor specifying the NaN representation, and default options. |
Method Summary | |
---|---|
java.lang.StringBuffer |
edit(java.lang.StringBuffer buf,
int value,
int width)
Edition of an integer number, right-aligned, with default options. |
java.lang.StringBuffer |
editComplex(java.lang.StringBuffer buf,
double mjd,
java.lang.String pic)
Edit a complex number (date, time, angle). |
java.lang.StringBuffer |
editDate(java.lang.StringBuffer buf,
double mjd,
int time_prec,
int option)
Edition of a MJD date into an ISO-8601 date YYYY-MM-DDThh:mm:ss[...] |
java.lang.StringBuffer |
editDate(java.lang.StringBuffer buf,
int mjd)
Edition of a MJD date into an ISO-8601 date YYYY-MM-DD |
java.lang.StringBuffer |
editDate(java.lang.StringBuffer buf,
int mjd,
int option)
Edition of a MJD date into an ISO-8601 date YYYY-MM-DD |
java.lang.StringBuffer |
editDecimal(java.lang.StringBuffer buf,
double value,
int nint,
int nd,
int option)
Edition of a single floating-point number (%f). |
java.lang.StringBuffer |
editDouble(java.lang.StringBuffer buf,
double value,
int option)
Edition of a single floating-point number (%g or %e). |
java.lang.StringBuffer |
editDouble(java.lang.StringBuffer buf,
double value,
int ndig,
int nexp,
int option)
Edition of a single floating-point number (%g or %e). |
java.lang.StringBuffer |
editFlags(java.lang.StringBuffer buf,
int flags,
java.lang.String[] symbols)
Edit a number considered as a set of bits. |
java.lang.StringBuffer |
editInfinite(java.lang.StringBuffer buf,
int width,
int sign)
Assignment to Infinity represention, right-aligned. |
java.lang.StringBuffer |
editInt(java.lang.StringBuffer buf,
int value,
int width,
int option)
Edition of an integer number, right-aligned, with user-specified options. |
java.lang.StringBuffer |
editLong(java.lang.StringBuffer buf,
long value,
int width,
int option)
Edition of a long integer number, right-aligned, with user-specified options. |
java.lang.StringBuffer |
editNaN(java.lang.StringBuffer buf,
int width)
Assignment to NaN represention. |
java.lang.StringBuffer |
editSexa(java.lang.StringBuffer buf,
double value,
int nint,
int ndec,
int option)
Edition of a single floating-point number in Sexagesimal. |
void |
setInfinite(java.lang.String text)
Define the Infinite representation |
java.lang.String |
toString()
The conversion to string |
Methods inherited from class cds.astro.Astroformat |
---|
acceptAsNaN, explain, explainComplex, isAngle, isDate, isDays, isSexa, isTime, setNaN |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String inf_string
public static boolean DEBUG
Constructor Detail |
---|
public Editing()
public Editing(java.lang.String null_text)
null_text
- what to write in case of NULL (NaN) value.Method Detail |
---|
public void setInfinite(java.lang.String text)
text
- the choice for Infinitypublic java.lang.StringBuffer editFlags(java.lang.StringBuffer buf, int flags, java.lang.String[] symbols)
buf
- the buffer to which the flags are appendedflags
- the list of flags.symbols
- the table of symbolspublic java.lang.StringBuffer editNaN(java.lang.StringBuffer buf, int width)
buf
- the buffer to which the string representation is appendedwidth
- the total widthpublic java.lang.StringBuffer editInfinite(java.lang.StringBuffer buf, int width, int sign)
buf
- the buffer to which the string representation is appendedwidth
- the total widthsign
- positive(add +sign), negative(add -sign), or zero.public java.lang.StringBuffer editLong(java.lang.StringBuffer buf, long value, int width, int option)
buf
- the buffer to which the string representation is appendedvalue
- the number to editwidth
- the total widthoption
- a mixture of options like
Astroformat.ZERO_FILL
,
Astroformat.SIGN_EDIT
, ...
public java.lang.StringBuffer editInt(java.lang.StringBuffer buf, int value, int width, int option)
buf
- the buffer to which the string representation is appendedvalue
- the number to editwidth
- the total widthoption
- a mixture of options like
Astroformat.ZERO_FILL
,
Astroformat.SIGN_EDIT
, ...
public java.lang.StringBuffer edit(java.lang.StringBuffer buf, int value, int width)
buf
- the buffer to which the string representation is appendedvalue
- the number to editwidth
- the total width
public java.lang.StringBuffer editDecimal(java.lang.StringBuffer buf, double value, int nint, int nd, int option)
buf
- the buffer to which the string representation is appendedvalue
- the number to editnint
- the number of characters for the integer part.
If nint==0 a value in range ]0..1[ starts by a
decimal point (e.g. .123)nd
- the number of decimals -- use -1 to remove the decimal point
-2 to -15 to remove the non-significant zeroes.option
- a combination of
Astroformat.ZERO_FILL
/
Astroformat.SIGN_EDIT
/
Astroformat.TRUNCATE
public java.lang.StringBuffer editDouble(java.lang.StringBuffer buf, double value, int ndig, int nexp, int option)
buf
- buffer to which the string representation is appendedvalue
- number to editndig
- number of significant digits (do the best if ndig<=0)nexp
- number of characters for the exponent value (3 recommended)option
- a combination of Astroformat.EFORMAT
/ Astroformat.SIGN_EDIT
public java.lang.StringBuffer editDouble(java.lang.StringBuffer buf, double value, int option)
buf
- buffer to which the string representation is appendedvalue
- number to editoption
- a combination of Astroformat.EFORMAT
/ Astroformat.SIGN_EDIT
public java.lang.StringBuffer editSexa(java.lang.StringBuffer buf, double value, int nint, int ndec, int option)
buf
- buffer to which the string representation is appendedvalue
- number to editnint
- number of characters for the integer part (degrees)ndec
- number of 'decimals' (2=arcmin, 4=arcsec, ...)
use a negative number to specify the "maximal"
number of decimals.option
- a combination of
Astroformat.SEXA1d
(and other SEXAxx possibilities) /
Astroformat.ZERO_FILL
/
Astroformat.SIGN_EDIT
...
public java.lang.StringBuffer editDate(java.lang.StringBuffer buf, int mjd)
buf
- buffer to which the string representation is appendedmjd
- the date to edit
public java.lang.StringBuffer editDate(java.lang.StringBuffer buf, int mjd, int option)
buf
- buffer to which the string representation is appendedmjd
- the date to editoption
- the option for date editing (e.g. Astroformat.DATE_YMD)
public java.lang.StringBuffer editDate(java.lang.StringBuffer buf, double mjd, int time_prec, int option)
buf
- buffer to which the string representation is appendedmjd
- the date to edittime_prec
- the precision in the time edition.
Values are 0=no time, 2=hr, 4=min, 6=sec, 9=ms, etc.
Negative values indicate a maximal precision.option
- the option for date editing (e.g. Astroformat.DATE_YMD)
public java.lang.StringBuffer editComplex(java.lang.StringBuffer buf, double mjd, java.lang.String pic)
buf
- buffer to which the string representation is appendedmjd
- the value to edit (MJD in case of date/time)pic
- the 'picture' to use, includes
Y=year, M=month, D=day, h=hour, m=min, s=sec, d=deg f=fraction
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |