|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmol.util.TextFormat
public class TextFormat
Field Summary | |
---|---|
private static DecimalFormat[] |
formatters
|
private static String[] |
formattingStrings
|
private static Boolean[] |
useNumberLocalization
|
Constructor Summary | |
---|---|
TextFormat()
|
Method Summary | |
---|---|
private static String |
fdup(String f,
int pt,
int n)
fdup duplicates p or q formats for formatCheck and the format() function. |
static String |
format(double value,
int width,
int precision,
boolean alignLeft,
boolean zeroPad,
boolean allowOverflow)
|
static String |
format(float value,
int width,
int precision,
boolean alignLeft,
boolean zeroPad)
|
static String |
format(String value,
int width,
int precision,
boolean alignLeft,
boolean zeroPad)
|
static String |
formatCheck(String strFormat)
formatCheck checks p and q formats and duplicates if necessary "%10.5p xxxx" ==> "%10.5p%10.5p%10.5p xxxx" |
static String |
formatDecimal(float value,
int decimalDigits)
|
static String |
formatString(String strFormat,
String key,
float floatT)
|
static String |
formatString(String strFormat,
String key,
int intT)
|
static String |
formatString(String strFormat,
String key,
String strT)
|
private static String |
formatString(String strFormat,
String key,
String strT,
float floatT,
double doubleT,
boolean doOne)
generic string formatter based on formatLabel in Atom |
static boolean |
isMatch(String s,
String strWildcard,
boolean checkStar,
boolean allowInitialStar)
|
static boolean |
isWild(String s)
|
static String |
join(String[] s,
char c,
int i0)
|
static void |
lFill(StringBuffer s,
String s1,
String s2)
|
static String |
replaceAllCharacters(String str,
String strFrom,
char chTo)
Does a clean replace of any of the characters in str with chrTo If strTo contains strFrom, then only a single pass is done. |
static String |
replaceAllCharacters(String str,
String strFrom,
String strTo)
Does a clean replace of any of the characters in str with strTo If strTo contains strFrom, then only a single pass is done. |
static String |
replaceQuotedStrings(String s,
List list,
List newList)
|
static String |
replaceStrings(String s,
List list,
List newList)
|
static void |
rFill(StringBuffer s,
String s1,
String s2)
|
static String |
safeTruncate(float f,
int n)
|
static void |
setUseNumberLocalization(boolean TF)
|
static String |
simpleReplace(String str,
String strFrom,
String strTo)
Does a clean replace of strFrom in str with strTo If strTo contains strFrom, then only a single pass is done. |
static String[] |
split(String text,
char ch)
|
static String[] |
split(String text,
String run)
proper splitting, even for Java 1.3 -- if the text ends in the run, no new line is appended. |
static String |
sprintf(String strFormat,
Object[] values)
sprintf emulation uses (almost) c++ standard string formats 's' string 'i' or 'd' integer 'f' float/decimal 'p' point3f 'q' quaternion/plane/axisangle ' with added "i" in addion to the insipid "d" (digits?) |
static String |
trim(String str,
String chars)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final DecimalFormat[] formatters
private static final String[] formattingStrings
private static final Boolean[] useNumberLocalization
Constructor Detail |
---|
public TextFormat()
Method Detail |
---|
public static void setUseNumberLocalization(boolean TF)
public static String formatDecimal(float value, int decimalDigits)
public static String format(float value, int width, int precision, boolean alignLeft, boolean zeroPad)
public static String format(double value, int width, int precision, boolean alignLeft, boolean zeroPad, boolean allowOverflow)
public static String format(String value, int width, int precision, boolean alignLeft, boolean zeroPad)
value
- width
- number of columnsprecision
- precision > 0 ==> precision = number of characters max from left
precision < 0 ==> -1 - precision = number of char. max from rightalignLeft
- zeroPad
- generally for numbers turned strings
public static String formatString(String strFormat, String key, String strT)
public static String formatString(String strFormat, String key, float floatT)
public static String formatString(String strFormat, String key, int intT)
public static String sprintf(String strFormat, Object[] values)
strFormat
- values
-
private static String formatString(String strFormat, String key, String strT, float floatT, double doubleT, boolean doOne)
strFormat
- .... %width.precisionKEY....key
- any string to matchstrT
- replacement string or nullfloatT
- replacement float or Float.NaNdoubleT
- replacement double or Double.NaN -- for exponentialdoOne
- mimic sprintf
public static String formatCheck(String strFormat)
strFormat
-
private static String fdup(String f, int pt, int n)
f
- pt
- n
-
public static String[] split(String text, String run)
text
- run
-
public static String replaceAllCharacters(String str, String strFrom, String strTo)
str
- strFrom
- strTo
-
public static String replaceAllCharacters(String str, String strFrom, char chTo)
str
- strFrom
- chTo
-
public static String simpleReplace(String str, String strFrom, String strTo)
str
- strFrom
- strTo
-
public static String trim(String str, String chars)
public static String[] split(String text, char ch)
public static void lFill(StringBuffer s, String s1, String s2)
public static void rFill(StringBuffer s, String s1, String s2)
public static String safeTruncate(float f, int n)
public static boolean isWild(String s)
public static boolean isMatch(String s, String strWildcard, boolean checkStar, boolean allowInitialStar)
public static String join(String[] s, char c, int i0)
public static String replaceQuotedStrings(String s, List list, List newList)
public static String replaceStrings(String s, List list, List newList)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |