public final class Util
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
Util() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertToHexString(java.lang.String unicodeString)
Convert each character to the form "\\uHEXDIGITS".
|
static java.lang.String |
fileAndAbsolute(java.io.File file)
Returns the file if it is absolute, otherwise returns the file AND the absolute file.
|
static java.lang.String |
filenameAndAbsolute(java.lang.String filename)
Returns the filename if it is absolute, otherwise returns the filename AND the absolute
filename.
|
static java.lang.String |
hangingParagraph(java.lang.String string,
int colWidth,
int indentWidth)
Format a hanging paragraph: The first line starts at the margin, and every subsequent line
starts indented by
indentWidth . |
static boolean |
iff(boolean a,
boolean b)
Return true if a and b are equal (both true or both false).
|
static boolean |
implies(boolean a,
boolean b)
Return true if a is false or b is true.
|
static boolean |
isJavaIdentifier(java.lang.String s)
Return true if the string is a legal Java identifier.
|
static int |
occurCount(java.lang.StringBuilder text,
java.lang.String pattern)
Return the number of times that the pattern appears in the text.
|
static java.lang.String |
pathAndAbsolute(java.nio.file.Path path)
Returns the path if it is absolute, otherwise returns the path AND the absolute path.
|
static java.lang.String |
replaceWords(java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> replacements)
Replace occurrences of words from this map with corresponding replacements.
|
public static boolean iff(boolean a, boolean b)
a
- first boolean to testb
- second bject to testpublic static boolean implies(boolean a, boolean b)
a
- first boolean to testb
- second bject to testpublic static boolean isJavaIdentifier(java.lang.String s)
s
- string to testpublic static java.lang.String convertToHexString(java.lang.String unicodeString)
unicodeString
- string to convertpublic static int occurCount(java.lang.StringBuilder text, java.lang.String pattern)
text
- string to searchpattern
- string pattern to search forpublic static java.lang.String hangingParagraph(java.lang.String string, int colWidth, int indentWidth)
indentWidth
. Each line is no more than colWidth
characters
long.string
- the paragraph to formatcolWidth
- the full column widthindentWidth
- the number of spaces before each line other than the first linepublic static java.lang.String replaceWords(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> replacements)
text
- the text to search for occurrences of names in this mapreplacements
- the map of replacements to performpublic static java.lang.String pathAndAbsolute(java.nio.file.Path path)
path
- a file pathpublic static java.lang.String fileAndAbsolute(java.io.File file)
file
- a filepublic static java.lang.String filenameAndAbsolute(java.lang.String filename)
filename
- a file name