public final class PrintTools
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
file_sep |
static java.lang.String |
line_sep |
static java.lang.String |
path_sep |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
collectionToString(java.util.Collection coll,
java.lang.String separator)
Converts a collection of objects to a string with the given separator.
|
static int |
getVerbosity()
Returns the global verbosity level
|
static java.lang.String |
listToString(java.util.List list,
java.lang.String separator)
Converts a list of objects to a string with the given separator.
|
static java.lang.String |
listToStringWithSkip(java.util.List list,
java.lang.String separator)
Converts a list of objects to a string.
|
static java.lang.String |
mapToString(java.util.Map map,
java.lang.String separator)
Converts a map to a string.
|
static void |
print(java.lang.String message,
int min_verbosity)
Prints a string to System.out if the
verbosity level is greater than min_verbosity.
|
static void |
printList(java.util.List list,
java.io.PrintWriter w)
Prints a list of printable object to the specified print writer without
any separating string.
|
static void |
printListWithComma(java.util.List list,
java.io.PrintWriter w)
Prints a list of printable object to the specified print writer with a
separating comma.
|
static void |
printListWithSeparator(java.util.List list,
java.io.PrintWriter w,
java.lang.String sep)
Prints a list of printable object to the specified print writer with a
separating stirng.
|
static void |
printListWithSpace(java.util.List list,
java.io.PrintWriter w)
Prints a list of printable object to the specified print writer with a
separating white space.
|
static void |
println(java.lang.String message,
int min_verbosity)
Prints a string to System.out if the
verbosity level is greater than min_verbosity.
|
static void |
printlnList(java.util.List list,
java.io.PrintWriter w)
Prints a list of printable object to the specified print writer with a
separating new line character.
|
static void |
printlnStatus(int min_verbosity,
java.lang.Object... items)
Prints the specified items to
System.err with separating
white spaces if verbosity is greater than min_verbosity. |
static void |
printlnStatus(Printable p,
int min_verbosity)
Prints a Printable object to System.err if the
verbosity level is greater than min_verbosity.
|
static void |
printlnStatus(java.lang.String message,
int min_verbosity)
Prints a string to System.err if the
verbosity level is greater than min_verbosity.
|
static void |
printStatus(Printable p,
int min_verbosity)
Prints a Printable object to System.err if the
verbosity level is greater than min_verbosity.
|
static void |
printStatus(java.lang.String message,
int min_verbosity)
Prints a string to System.err if the
verbosity level is greater than min_verbosity.
|
static void |
removeVerboseParens(Traversable t)
Removes unnecessary parentheses from the given traversable object.
|
public static final java.lang.String line_sep
public static final java.lang.String file_sep
public static final java.lang.String path_sep
public static void printlnStatus(Printable p, int min_verbosity)
p - A Printable object.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void printlnStatus(java.lang.String message,
int min_verbosity)
message - The message to be printed.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void printlnStatus(int min_verbosity,
java.lang.Object... items)
System.err with separating
white spaces if verbosity is greater than min_verbosity.
This method minimizes overheads from string composition since it is done
only if the verbosity level is met.min_verbosity - the minium verbosity.items - the list of items to be printed.public static void print(java.lang.String message,
int min_verbosity)
message - The message to be printed.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void println(java.lang.String message,
int min_verbosity)
message - The message to be printed.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void printStatus(Printable p, int min_verbosity)
p - A Printable object.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void printStatus(java.lang.String message,
int min_verbosity)
message - The message to be printed.min_verbosity - An integer to compare with the value
set by the -verbosity command-line flag.public static void printListWithSeparator(java.util.List list,
java.io.PrintWriter w,
java.lang.String sep)
list - the list of printable object.w - the target print writer.sep - the separating string.public static void printListWithComma(java.util.List list,
java.io.PrintWriter w)
list - the list of printable object.w - the target print writer.public static void printListWithSpace(java.util.List list,
java.io.PrintWriter w)
list - the list of printable object.w - the target print writer.public static void printList(java.util.List list,
java.io.PrintWriter w)
list - the list of printable object.w - the target print writer.public static void printlnList(java.util.List list,
java.io.PrintWriter w)
list - the list of printable object.w - the target print writer.public static int getVerbosity()
public static java.lang.String collectionToString(java.util.Collection coll,
java.lang.String separator)
Symbol object is printed with its name.coll - the collection to be converted.separator - the separating string.public static java.lang.String listToString(java.util.List list,
java.lang.String separator)
list - the list to be converted.separator - the separating string.public static java.lang.String listToStringWithSkip(java.util.List list,
java.lang.String separator)
listToString is that this method inserts the separating string
only if the heading string length is non-zero.list - the list to be converted.separator - the separating string.public static java.lang.String mapToString(java.util.Map map,
java.lang.String separator)
public static void removeVerboseParens(Traversable t)
t - the traversable object to be processed.