|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.simbad.MFormatElement
Class defining format elements for the measurements. A format element is kept by a CFormat object. It can be either a part of regular text, or a compiled version of a format element having the following syntax:
... %[+|-][0]mmm[.nn]s|c|d{fieldname} ...which is a C-like format syntax:
[] means a optional field | means an alternative ----- '+' : forces to display the plus sign for positive numbers '-' : left justifies the data item in its field ('+' and '-' can be combined for numbers). '0' : before the 'mmm' length triggers the number to be filled with zeroes if it is right justified. mmm : total length of the field. nn : number of decimal digits for a numerical item. As these items are already strings, dd helps also to align on the decimal point. 's' : a string 'c' : a unique char 'd' : a number (with decimal digits, if '.dd' is present. Otherwise an integer. {fieldname} defines the fieldname of the measurement, and is not really part of the format definition.
Field Summary | |
protected int |
dec
|
protected boolean |
displaysign
|
protected java.lang.String |
fieldname
|
protected int |
fieldnum
|
protected boolean |
headingZero
|
protected boolean |
leftjustified
|
protected int |
len
|
protected java.lang.String |
text
|
protected char |
type
|
Constructor Summary | |
protected |
MFormatElement(java.lang.String text)
Constructor for a regular text string. |
protected |
MFormatElement(java.lang.String format,
java.lang.String fieldname)
Constructor for a format element. |
Method Summary | |
private boolean |
belongsToNumber(char c)
|
private java.lang.String |
fill(char c,
int nb)
|
protected java.lang.String |
format(java.lang.String text)
Formats the string according to the parameters of this format element |
protected java.lang.String |
getFieldname()
Returns the field name |
protected java.lang.String |
getText()
|
protected boolean |
isText()
|
private java.lang.String |
justify(java.lang.String str,
int maxlen,
boolean left)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String text
protected boolean displaysign
protected boolean leftjustified
protected boolean headingZero
protected int len
protected int dec
protected char type
protected java.lang.String fieldname
protected int fieldnum
Constructor Detail |
protected MFormatElement(java.lang.String text)
text
- simple text stringprotected MFormatElement(java.lang.String format, java.lang.String fieldname)
format
- format definition %[+-]0999.99[sdc]fieldname
- name of the fieldMethod Detail |
private java.lang.String fill(char c, int nb)
private final boolean belongsToNumber(char c)
private java.lang.String justify(java.lang.String str, int maxlen, boolean left)
protected java.lang.String format(java.lang.String text)
text
- text to format
protected java.lang.String getText()
protected boolean isText()
protected java.lang.String getFieldname()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |