X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FFormat.java;h=0f12eb833a6973565eae6804d73d3c9fcc9115d0;hb=76f9992a5fd8e818f8051130e25c6aefb4ef51ad;hp=ce7ab6df184a5984bd2262536dc43799e9bf4ce9;hpb=05951a61acec617599e9a92828b8a498fab6ae32;p=jalview.git
diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java
index ce7ab6d..0f12eb8 100755
--- a/src/jalview/util/Format.java
+++ b/src/jalview/util/Format.java
@@ -29,10 +29,13 @@ package jalview.util;
import java.util.Arrays;
/**
- * DOCUMENT ME!
+ * A utility class that provides a variety of formatting methods.
*
- * @author $author$
- * @version $Revision$
+ * Principle method {@code format} formats the number following printf
+ * conventions. Main limitation: Can only handle one format parameter at a time
+ * Use multiple Format objects to format more than one number
+ *
+ * @author unknown
*/
public class Format
{
@@ -59,12 +62,59 @@ public class Format
private final String formatString;
/**
- * Creates a new Format object.
+ * Creates a new Format object given a format descriptor, which follows printf
+ * conventions The string has a prefix, a format code and a suffix. The prefix
+ * and suffix become part of the formatted output. The format code directs the
+ * formatting of the (single) parameter to be formatted. The code has the
+ * following structure
+ *
+ * - a % (required)
+ *
- a modifier (optional)
+ *
+ * - +
+ *
- forces display of + for positive numbers
+ *
- 0
+ *
- show leading zeroes
+ *
- -
+ *
- align left in the field
+ *
- space
+ *
- prepend a space in front of positive numbers
+ *
- #
+ *
- use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers.
+ * Don't suppress trailing zeroes in general floating point format.
+ *
+ * - an integer denoting field width (optional)
+ *
- a period followed by an integer denoting precision (optional)
+ *
- a format descriptor (required)
+ *
+ * - f
+ *
- floating point number in fixed format
+ *
- e, E
+ *
- floating point number in exponential notation (scientific format). The
+ * E format results in an uppercase E for the exponent (1.14130E+003), the e
+ * format in a lowercase e.
+ *
- g, G
+ *
- floating point number in general format (fixed format for small
+ * numbers, exponential format for large numbers). Trailing zeroes are
+ * suppressed. The G format results in an uppercase E for the exponent (if
+ * any), the g format in a lowercase e.
+ *
- d, i
+ *
- integer in decimal
+ *
- x
+ *
- integer in hexadecimal
+ *
- o
+ *
- integer in octal
+ *
- s
+ *
- string
+ *
- c
+ *
- character
+ *
+ *
*
* @param s
- * DOCUMENT ME!
+ * the format descriptor
*/
- public Format(String s)
+ public Format(final String s)
{
formatString = s;
width = 0;
@@ -214,63 +264,11 @@ public class Format
}
/**
- * Formats the number following printf conventions. Main limitation: Can only
- * handle one format parameter at a time Use multiple Format objects to format
- * more than one number
- *
- * @param s
- * the format string following printf conventions The string has a
- * prefix, a format code and a suffix. The prefix and suffix become
- * part of the formatted output. The format code directs the
- * formatting of the (single) parameter to be formatted. The code has
- * the following structure
- *
- * - a % (required)
- *
- a modifier (optional)
- *
- * - +
- *
- forces display of + for positive numbers
- *
- 0
- *
- show leading zeroes
- *
- -
- *
- align left in the field
- *
- space
- *
- prepend a space in front of positive numbers
- *
- #
- *
- use "alternate" format. Add 0 or 0x for octal or hexadecimal
- * numbers. Don't suppress trailing zeroes in general floating point
- * format.
- *
- * - an integer denoting field width (optional)
- *
- a period followed by an integer denoting precision (optional)
- *
- a format descriptor (required)
- *
- * - f
- *
- floating point number in fixed format
- *
- e, E
- *
- floating point number in exponential notation (scientific
- * format). The E format results in an uppercase E for the exponent
- * (1.14130E+003), the e format in a lowercase e.
- *
- g, G
- *
- floating point number in general format (fixed format for
- * small numbers, exponential format for large numbers). Trailing
- * zeroes are suppressed. The G format results in an uppercase E for
- * the exponent (if any), the g format in a lowercase e.
- *
- d, i
- *
- integer in decimal
- *
- x
- *
- integer in hexadecimal
- *
- o
- *
- integer in octal
- *
- s
- *
- string
- *
- c
- *
- character
- *
- *
- * @exception IllegalArgumentException
- * if bad format
+ * Returns a 6 character string consisting of the hex values of the colour's
+ * rgb values (left padded with zeroes if necessary)
*
+ * @param color
+ * @return
*/
public static String getHexString(java.awt.Color color)
{