X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Futil%2FFormat.java;h=b564706f9442e8c73e6ac9b286b53b51f6ca2aaa;hb=1d6bdfa4ce1d88c055a257e542de6b8542144d91;hp=629fbcf96577b5938f2a4844857e8359bff2dd3f;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index 629fbcf..b564706 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -27,7 +27,6 @@ */ package jalview.util; -import java.io.*; /** @@ -67,7 +66,6 @@ public class Format left_align = false; fmt = ' '; - int state = 0; int length = s.length(); int parse_state = 0; @@ -414,7 +412,7 @@ public class Format int i = 0; int sign = 1; double r = 0; // integer part - double f = 0; // fractional part + //double f = 0; // fractional part double p = 1; // exponent of fractional part int state = 0; // 0 = int part, 1 = frac part @@ -595,80 +593,6 @@ public class Format } /** - * a test stub for the format class - */ - public static void main(String[] a) - { - double x = 1.23456789012; - double y = 123; - double z = 1.2345e30; - double w = 1.02; - double u = 1.234e-5; - int d = 0xCAFE; - Format.print(System.out, "x = |%f|\n", x); - Format.print(System.out, "u = |%20f|\n", u); - Format.print(System.out, "x = |% .5f|\n", x); - Format.print(System.out, "w = |%20.5f|\n", w); - Format.print(System.out, "x = |%020.5f|\n", x); - Format.print(System.out, "x = |%+20.5f|\n", x); - Format.print(System.out, "x = |%+020.5f|\n", x); - Format.print(System.out, "x = |% 020.5f|\n", x); - Format.print(System.out, "y = |%#+20.5f|\n", y); - Format.print(System.out, "y = |%-+20.5f|\n", y); - Format.print(System.out, "z = |%20.5f|\n", z); - - Format.print(System.out, "x = |%e|\n", x); - Format.print(System.out, "u = |%20e|\n", u); - Format.print(System.out, "x = |% .5e|\n", x); - Format.print(System.out, "w = |%20.5e|\n", w); - Format.print(System.out, "x = |%020.5e|\n", x); - Format.print(System.out, "x = |%+20.5e|\n", x); - Format.print(System.out, "x = |%+020.5e|\n", x); - Format.print(System.out, "x = |% 020.5e|\n", x); - Format.print(System.out, "y = |%#+20.5e|\n", y); - Format.print(System.out, "y = |%-+20.5e|\n", y); - - Format.print(System.out, "x = |%g|\n", x); - Format.print(System.out, "z = |%g|\n", z); - Format.print(System.out, "w = |%g|\n", w); - Format.print(System.out, "u = |%g|\n", u); - Format.print(System.out, "y = |%.2g|\n", y); - Format.print(System.out, "y = |%#.2g|\n", y); - - Format.print(System.out, "d = |%d|\n", d); - Format.print(System.out, "d = |%20d|\n", d); - Format.print(System.out, "d = |%020d|\n", d); - Format.print(System.out, "d = |%+20d|\n", d); - Format.print(System.out, "d = |% 020d|\n", d); - Format.print(System.out, "d = |%-20d|\n", d); - Format.print(System.out, "d = |%20.8d|\n", d); - Format.print(System.out, "d = |%x|\n", d); - Format.print(System.out, "d = |%20X|\n", d); - Format.print(System.out, "d = |%#20x|\n", d); - Format.print(System.out, "d = |%020X|\n", d); - Format.print(System.out, "d = |%20.8x|\n", d); - Format.print(System.out, "d = |%o|\n", d); - Format.print(System.out, "d = |%020o|\n", d); - Format.print(System.out, "d = |%#20o|\n", d); - Format.print(System.out, "d = |%#020o|\n", d); - Format.print(System.out, "d = |%20.12o|\n", d); - - Format.print(System.out, "s = |%-20s|\n", "Hello"); - Format.print(System.out, "s = |%-20c|\n", '!'); - - // regression test to confirm fix of reported bugs - Format.print(System.out, "|%i|\n", Long.MIN_VALUE); - - Format.print(System.out, "|%6.2e|\n", 0.0); - Format.print(System.out, "|%6.2g|\n", 0.0); - - Format.print(System.out, "|%6.2f|\n", 9.99); - Format.print(System.out, "|%6.2f|\n", 9.999); - - Format.print(System.out, "|%6.0f|\n", 9.999); - } - - /** * DOCUMENT ME! * * @param c DOCUMENT ME!