| 
 | 
 | |||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.utilities.output.FormatUtil
public final class FormatUtil
Utility methods for output formatting of various number objects
| Field Summary | |
|---|---|
| static String | NEWLINEThe system newline setting. | 
| static NumberFormat | NF2Number Formatter (2 digits) for output purposes. | 
| static NumberFormat | NF4Number Formatter (4 digits) for output purposes. | 
| static NumberFormat | NF8Number Formatter (8 digits) for output purposes. | 
| private static String | WHITESPACE_BUFFERWhitespace. | 
| Constructor Summary | |
|---|---|
| FormatUtil() | |
| Method Summary | |
|---|---|
| static int | findSplitpoint(String s,
               int width)Find the first space before position w or if there is none after w. | 
| static String | format(BitSet bitSet,
       int dim,
       String sep)Returns a string representation of the specified bit set. | 
| static String | format(boolean b)Formats the boolean b. | 
| static String | format(boolean[] b,
       String sep)Formats the boolean array b with ',' as separator. | 
| static String | format(byte[] a)Formats the byte array a for printing purposes. | 
| static String | format(double d)Formats the double d with 2 fraction digits. | 
| static String | format(double[] d)Formats the double array d with ',' as separator and 2 fraction digits. | 
| static String | format(double[][] d)Formats the double array d with ',' as separator and 2 fraction digits. | 
| static String | format(double[][] d,
       String sep1,
       String sep2,
       int digits)Formats the array of double arrays d with 'the specified separators and fraction digits. | 
| static String | format(double[] d,
       int digits)Formats the double array d with ', ' as separator and with the specified fraction digits. | 
| static String | format(double[] d,
       NumberFormat nf)Formats the double array d with the specified number format. | 
| static String | format(double[] d,
       String sep)Formats the double array d with the specified separator. | 
| static String | format(double[] d,
       String sep,
       int digits)Formats the double array d with the specified separator and the specified fraction digits. | 
| static String | format(double[] d,
       String sep,
       NumberFormat nf)Formats the double array d with the specified number format. | 
| static String | format(double d,
       int digits)Formats the double d with the specified fraction digits. | 
| static String | format(double d,
       NumberFormat nf)Formats the double d with the specified number format. | 
| static String | format(float[] f)Formats the float array f with ',' as separator and 2 fraction digits. | 
| static String | format(float[] f,
       String sep,
       int digits)Formats the float array f with the specified separator and the specified fraction digits. | 
| static String | format(int[] a)Formats the int array a for printing purposes. | 
| static String | format(int[] a,
       String sep)Formats the int array a for printing purposes. | 
| static String | format(int dim,
       BitSet bitSet)Returns a string representation of the specified bit set. | 
| static String | format(Integer[] a)Formats the Integer array a for printing purposes. | 
| static String | format(Integer[] a,
       String sep)Formats the Integer array a for printing purposes. | 
| static String | format(long[] a)Formats the long array a for printing purposes. | 
| static String | pad(String o,
    int len)Pad a string to a given length by adding whitespace to the right. | 
| static String | padRightAligned(String o,
                int len)Pad a string to a given length by adding whitespace to the left. | 
| static List<String> | splitAtLastBlank(String s,
                 int width)Splits the specified string at the last blank before width. | 
| static String | whitespace(int n)Returns a string with the specified number of whitespace. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final NumberFormat NF2
public static final NumberFormat NF4
public static final NumberFormat NF8
private static final String WHITESPACE_BUFFER
public static final String NEWLINE
| Constructor Detail | 
|---|
public FormatUtil()
| Method Detail | 
|---|
public static String format(double d,
                            int digits)
d - the double array to be formatteddigits - the number of fraction digits
public static String format(double d,
                            NumberFormat nf)
d - the double array to be formattednf - the number format to be used for formatting
public static String format(double d)
d - the double to be formatted
public static String format(double[] d,
                            String sep)
d - the double array to be formattedsep - the separator between the single values of the double array,
        e.g. ','
public static String format(double[] d,
                            String sep,
                            int digits)
d - the double array to be formattedsep - the separator between the single values of the double array,
        e.g. ','digits - the number of fraction digits
public static String format(double[] d,
                            NumberFormat nf)
d - the double array to be formattednf - the number format to be used for formatting
public static String format(double[] d,
                            String sep,
                            NumberFormat nf)
d - the double array to be formattedsep - the separator between the single values of the double array,
        e.g. ','nf - the number format to be used for formatting
public static String format(double[] d)
d - the double array to be formatted
public static String format(double[] d,
                            int digits)
d - the double array to be formatteddigits - the number of fraction digits
public static String format(double[][] d)
d - the double array to be formatted
public static String format(double[][] d,
                            String sep1,
                            String sep2,
                            int digits)
d - the double array to be formattedsep1 - the first separator of the outer arraysep2 - the second separator of the inner arraydigits - the number of fraction digits
public static String format(float[] f,
                            String sep,
                            int digits)
f - the float array to be formattedsep - the separator between the single values of the float array, e.g.
        ','digits - the number of fraction digits
public static String format(float[] f)
f - the float array to be formatted
public static String format(int[] a,
                            String sep)
a - the int array to be formattedsep - the separator between the single values of the float array, e.g.
        ','
public static String format(int[] a)
a - the int array to be formatted
public static String format(Integer[] a,
                            String sep)
a - the Integer array to be formattedsep - the separator between the single values of the float array, e.g.
        ','
public static String format(Integer[] a)
a - the Integer array to be formatted
public static String format(long[] a)
a - the long array to be formatted
public static String format(byte[] a)
a - the byte array to be formatted
public static String format(boolean[] b,
                            String sep)
b - the boolean array to be formattedsep - the separator between the single values of the double array,
        e.g. ','
public static String format(boolean b)
b - the boolean to be formatted
public static String format(BitSet bitSet,
                            int dim,
                            String sep)
bitSet - the bitSetdim - the overall dimensionality of the bit setsep - the separator
public static String format(int dim,
                            BitSet bitSet)
dim - the overall dimensionality of the bit setbitSet - the bitSet
public static int findSplitpoint(String s,
                                 int width)
s - Stringwidth - Width
-1 if no whitespace was
         found.
public static List<String> splitAtLastBlank(String s,
                                            int width)
s - the string to be splittedwidth - int
public static String whitespace(int n)
n - the number of whitespace characters
public static String pad(String o,
                         int len)
o - original stringlen - destination length
public static String padRightAligned(String o,
                                     int len)
o - original stringlen - destination length
| 
 | 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||