*/\r
package jalview.util;\r
\r
-import java.io.*;\r
\r
\r
/**\r
left_align = false;\r
fmt = ' ';\r
\r
- int state = 0;\r
int length = s.length();\r
int parse_state = 0;\r
\r
int i = 0;\r
int sign = 1;\r
double r = 0; // integer part\r
- double f = 0; // fractional part\r
+ //double f = 0; // fractional part\r
double p = 1; // exponent of fractional part\r
int state = 0; // 0 = int part, 1 = frac part\r
\r
}\r
\r
/**\r
- * a test stub for the format class\r
- */\r
- public static void main(String[] a)\r
- {\r
- double x = 1.23456789012;\r
- double y = 123;\r
- double z = 1.2345e30;\r
- double w = 1.02;\r
- double u = 1.234e-5;\r
- int d = 0xCAFE;\r
- Format.print(System.out, "x = |%f|\n", x);\r
- Format.print(System.out, "u = |%20f|\n", u);\r
- Format.print(System.out, "x = |% .5f|\n", x);\r
- Format.print(System.out, "w = |%20.5f|\n", w);\r
- Format.print(System.out, "x = |%020.5f|\n", x);\r
- Format.print(System.out, "x = |%+20.5f|\n", x);\r
- Format.print(System.out, "x = |%+020.5f|\n", x);\r
- Format.print(System.out, "x = |% 020.5f|\n", x);\r
- Format.print(System.out, "y = |%#+20.5f|\n", y);\r
- Format.print(System.out, "y = |%-+20.5f|\n", y);\r
- Format.print(System.out, "z = |%20.5f|\n", z);\r
-\r
- Format.print(System.out, "x = |%e|\n", x);\r
- Format.print(System.out, "u = |%20e|\n", u);\r
- Format.print(System.out, "x = |% .5e|\n", x);\r
- Format.print(System.out, "w = |%20.5e|\n", w);\r
- Format.print(System.out, "x = |%020.5e|\n", x);\r
- Format.print(System.out, "x = |%+20.5e|\n", x);\r
- Format.print(System.out, "x = |%+020.5e|\n", x);\r
- Format.print(System.out, "x = |% 020.5e|\n", x);\r
- Format.print(System.out, "y = |%#+20.5e|\n", y);\r
- Format.print(System.out, "y = |%-+20.5e|\n", y);\r
-\r
- Format.print(System.out, "x = |%g|\n", x);\r
- Format.print(System.out, "z = |%g|\n", z);\r
- Format.print(System.out, "w = |%g|\n", w);\r
- Format.print(System.out, "u = |%g|\n", u);\r
- Format.print(System.out, "y = |%.2g|\n", y);\r
- Format.print(System.out, "y = |%#.2g|\n", y);\r
-\r
- Format.print(System.out, "d = |%d|\n", d);\r
- Format.print(System.out, "d = |%20d|\n", d);\r
- Format.print(System.out, "d = |%020d|\n", d);\r
- Format.print(System.out, "d = |%+20d|\n", d);\r
- Format.print(System.out, "d = |% 020d|\n", d);\r
- Format.print(System.out, "d = |%-20d|\n", d);\r
- Format.print(System.out, "d = |%20.8d|\n", d);\r
- Format.print(System.out, "d = |%x|\n", d);\r
- Format.print(System.out, "d = |%20X|\n", d);\r
- Format.print(System.out, "d = |%#20x|\n", d);\r
- Format.print(System.out, "d = |%020X|\n", d);\r
- Format.print(System.out, "d = |%20.8x|\n", d);\r
- Format.print(System.out, "d = |%o|\n", d);\r
- Format.print(System.out, "d = |%020o|\n", d);\r
- Format.print(System.out, "d = |%#20o|\n", d);\r
- Format.print(System.out, "d = |%#020o|\n", d);\r
- Format.print(System.out, "d = |%20.12o|\n", d);\r
-\r
- Format.print(System.out, "s = |%-20s|\n", "Hello");\r
- Format.print(System.out, "s = |%-20c|\n", '!');\r
-\r
- // regression test to confirm fix of reported bugs\r
- Format.print(System.out, "|%i|\n", Long.MIN_VALUE);\r
-\r
- Format.print(System.out, "|%6.2e|\n", 0.0);\r
- Format.print(System.out, "|%6.2g|\n", 0.0);\r
-\r
- Format.print(System.out, "|%6.2f|\n", 9.99);\r
- Format.print(System.out, "|%6.2f|\n", 9.999);\r
-\r
- Format.print(System.out, "|%6.0f|\n", 9.999);\r
- }\r
-\r
- /**\r
* DOCUMENT ME!\r
*\r
* @param c DOCUMENT ME!\r