|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.gen.Misc
A variety of static methods.
Constructor Summary | |
Misc()
|
Method Summary | |
static java.lang.String |
addZeros(java.lang.String x)
Prepends zeros to a string such that its total length = 10. |
static java.lang.String[] |
addZeros(java.lang.String[] x)
Prepends zeros to each String such that its total length = 10. |
static java.lang.String |
capitalizeFirstLetter(java.lang.String s)
Capitalizes the first letter in a String. |
static java.lang.String |
clipUnderScore(java.lang.String string)
Removes the random digit_ proceeding a string, (ie 2432344322_fileName.txt to fileName.txt) |
static java.util.HashMap |
createHashMap(java.lang.String[] s)
Creates a HashMap from a String[] where the array is ordered such as key,value,key,value... |
static java.util.LinkedHashMap |
createLinkedHashMap(java.lang.String[] s,
int direction)
Creates a LinkedHashMap from a String[] where the array is ordered such as key,value,key,value... |
static java.lang.String |
doubleArrayToString(double[] i,
java.lang.String separator)
Returns a String separated by separator for each double[i]. |
static int |
extractIdFromConcat(java.lang.String concat)
Takes a String like testSlide:33328:testslide desc...:1 or test: gip: 2, splits on the : and looks for ID in the last String[x], if not found it returns zero, otherwise it returns a parsed int. |
static int |
extractIdFromFrontOfConcat(java.lang.String concat)
Takes a String like 1: testSlide: 33328:testslide desc etc or 2: test: gip, splits on the : and looks for ID in the first String[x], if not found it returns zero, otherwise it returns a parsed int. |
static java.lang.String[] |
extractIDsFromConcats(java.lang.String[] concats)
Ditto to extractIDFromConcat but works on String[] returning IDs as a String[]. |
static void |
fatalError(java.lang.String message)
Prints message to screen, to log4j error, then exits. |
static java.lang.String |
fetchExit(java.lang.String key,
java.util.HashMap map)
Looks for key, if not found prints error message and exists. |
static int |
fetchMatchingStringArrayIndex(java.lang.String guess,
java.lang.String[] choices)
Loose matching of substring guess from larger String[]s. |
static java.lang.String |
floatArrayToString(float[] i,
java.lang.String separator)
Returns a String separated by separator for each float[i]. |
static java.lang.String |
getDate()
Returns a nicely formated time (15 May 2004). |
static java.lang.String |
getDateNoSpaces()
Returns a nicely formated time (15May2004). |
static java.lang.String |
getFormattedTimeFromFraction(double fractionalTime)
Returns a formatted time 2:15:00 given 2.25 |
static java.lang.String[] |
hashSetToStringArray(java.util.HashSet hash)
Converts a hash to a String[] by direct cast. |
static java.lang.String |
intArrayToString(int[] i,
java.lang.String separator)
Returns a String separated by separator for each int[i]. |
static int[] |
integerArrayListToIntArray(java.util.ArrayList integerAL)
Converts an ArrayList of Integer to int[]. |
static boolean |
isEmpty(java.lang.String text)
Method to check if a string is null or empty after trimming. |
static boolean |
isNotEmpty(java.lang.String text)
Method to check if a string is not null and contains more than "". |
static boolean |
isStringEmpty(java.lang.String string)
Returns true if a String contains just white space or is empty. |
static java.util.HashSet |
loadHashSet(java.lang.Object[] s)
Loads a HashSet with and Object array. |
static java.util.ArrayList |
objectArrayToArrayList(java.lang.Object[] ob)
Converts an Object[] to an ArrayList |
static java.util.ArrayList |
parseKeyValueGroups(java.lang.String line)
Given a String of 'treat1=/file1,/file2*treat2=/file3,/file4*treat3=/file5,file6' Will return an ArrayList contining first a String[] of the keys {treat1,treat2,treat3} and second a String[][] of the parsed values matching the keys. |
static java.util.LinkedHashMap |
parseKeyValues(java.lang.String line)
Given a String of 'treat1=/file1,treat2=/file3, etc', no spaces, returns a LinkedHashMap of keys=values. |
static java.lang.String[] |
prependString(java.lang.String[] d,
java.lang.String newValue)
Returns a new array with the newValue appended on the beginning. |
static void |
printArray(java.util.ArrayList array)
Prints ArrayList to System.out |
static void |
printArray(double[] array)
Prints a double[] to System.out on a single line. |
static void |
printArray(double[][] d)
Print to System.out a double[][] |
static void |
printArray(float[] array)
Prints a int[] to System.out |
static void |
printArray(float[][] d)
Print to System.out a float[][] |
static void |
printArray(int[] array)
Prints a int[] to System.out |
static void |
printArray(int[][] d)
Print to System.out a int[][] |
static void |
printArray(java.lang.Object[] array)
Prints a Object[] to System.out |
static void |
printArray(java.lang.Object[][] array)
Prints a Object[][] to System.out |
static void |
printArray(java.lang.String[] array)
Prints a String[] to System.out |
static void |
printArrayLine(java.lang.String[] array)
Prints a String[] to System.out |
static void |
printExit(java.lang.String message)
Prints message to screen, then exits. |
static boolean |
printHashSetToFile(java.util.HashSet hash,
java.lang.String file)
Prints a HashSet to a file. |
static java.lang.String |
removeExtension(java.lang.String txt)
Removes an extension if found xxx.txt -> xxx. |
static java.lang.String |
replaceEnd(java.lang.String word,
java.lang.String match,
java.lang.String replacement)
Attempts to match the end of the word with the match, case insensitive, replaces it if found, otherwise returns null. |
static void |
sleep(int seconds)
Sleeps for given number of seconds |
static java.lang.String[] |
splitOnFirstColon(java.lang.String idColonName)
Returns a String[2] split on first colon, if no colon returns null. |
static java.lang.String[] |
splitString(java.lang.String concat,
java.lang.String regex)
Splits a String on a regular expression, watching out for escaped characters ie Cat\=Mouse would not be split when = is given as the regex, a String[0], {"Cat\=Mouse"} would be returned. |
static java.lang.String |
stringArrayListToString(java.util.ArrayList stringAL,
java.lang.String separator)
Returns a String separated by the separator given an ArrayList of String. |
static java.lang.String[] |
stringArrayListToStringArray(java.util.ArrayList stringAL)
Returns a String[] given an ArrayList of Strings. |
static java.util.ArrayList |
stringArrayToArrayList(java.lang.String[] s)
Returns an ArrayList of String given a String[] |
static java.lang.String |
stringArrayToString(java.lang.String[] s,
java.lang.String separator)
Returns a String separated by commas for each bin. |
java.lang.String[] |
toLowerCase(java.lang.String[] strings)
Lower cases a String[] |
static int |
totalLength(java.lang.Object[][] array)
Counts the total length of an Object[][] |
static java.lang.String[] |
trimCommon(java.lang.String[] lines)
Trims the comon chars from the front and back of each line, won't entirely delete line. |
static java.lang.String[] |
trimCommonStart(java.lang.String[] lines)
Trims characters common to all from start of lines. |
static java.lang.String |
trimQuotes(java.lang.String cell)
Trims "" from the beginning and end of String if both are found. |
static java.lang.String |
trimTxt(java.lang.String s)
Removes .txt from end of String if present |
static java.lang.String |
truncate(java.lang.String string,
int cutOff)
Truncates a String adding three periods if too long. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Misc()
Method Detail |
public static java.lang.String[] hashSetToStringArray(java.util.HashSet hash)
public static void sleep(int seconds)
public static java.lang.String fetchExit(java.lang.String key, java.util.HashMap map)
public static java.lang.String[] prependString(java.lang.String[] d, java.lang.String newValue)
public static java.lang.String capitalizeFirstLetter(java.lang.String s)
public static java.lang.String removeExtension(java.lang.String txt)
public static java.util.ArrayList parseKeyValueGroups(java.lang.String line)
public static java.lang.String[] trimCommonStart(java.lang.String[] lines)
public static java.lang.String[] trimCommon(java.lang.String[] lines)
public static java.util.LinkedHashMap parseKeyValues(java.lang.String line)
public static java.lang.String replaceEnd(java.lang.String word, java.lang.String match, java.lang.String replacement)
public static void fatalError(java.lang.String message)
public static void printExit(java.lang.String message)
public static int totalLength(java.lang.Object[][] array)
public static java.lang.String trimTxt(java.lang.String s)
public static java.lang.String addZeros(java.lang.String x)
public static java.lang.String[] addZeros(java.lang.String[] x)
public static java.util.HashSet loadHashSet(java.lang.Object[] s)
public static java.lang.String trimQuotes(java.lang.String cell)
public static java.lang.String[] splitString(java.lang.String concat, java.lang.String regex)
public static int fetchMatchingStringArrayIndex(java.lang.String guess, java.lang.String[] choices)
public java.lang.String[] toLowerCase(java.lang.String[] strings)
public static void printArray(java.lang.Object[] array)
public static void printArray(java.lang.Object[][] array)
public static void printArray(java.lang.String[] array)
public static void printArrayLine(java.lang.String[] array)
public static void printArray(java.util.ArrayList array)
public static void printArray(int[] array)
public static void printArray(float[] array)
public static void printArray(double[] array)
public static java.lang.String clipUnderScore(java.lang.String string)
public static java.lang.String truncate(java.lang.String string, int cutOff)
public static java.lang.String getDate()
public static java.lang.String getDateNoSpaces()
public static java.lang.String getFormattedTimeFromFraction(double fractionalTime)
public static int extractIdFromConcat(java.lang.String concat)
public static int extractIdFromFrontOfConcat(java.lang.String concat)
public static java.lang.String[] extractIDsFromConcats(java.lang.String[] concats)
public static java.lang.String[] splitOnFirstColon(java.lang.String idColonName)
public static boolean isEmpty(java.lang.String text)
public static boolean isNotEmpty(java.lang.String text)
public static int[] integerArrayListToIntArray(java.util.ArrayList integerAL)
public static java.lang.String[] stringArrayListToStringArray(java.util.ArrayList stringAL)
public static java.lang.String intArrayToString(int[] i, java.lang.String separator)
public static java.lang.String floatArrayToString(float[] i, java.lang.String separator)
public static java.lang.String doubleArrayToString(double[] i, java.lang.String separator)
public static java.util.LinkedHashMap createLinkedHashMap(java.lang.String[] s, int direction)
public static boolean printHashSetToFile(java.util.HashSet hash, java.lang.String file)
public static java.util.ArrayList objectArrayToArrayList(java.lang.Object[] ob)
public static void printArray(double[][] d)
public static void printArray(float[][] d)
public static void printArray(int[][] d)
public static java.util.ArrayList stringArrayToArrayList(java.lang.String[] s)
public static java.lang.String stringArrayListToString(java.util.ArrayList stringAL, java.lang.String separator)
public static java.lang.String stringArrayToString(java.lang.String[] s, java.lang.String separator)
public static java.util.HashMap createHashMap(java.lang.String[] s)
public static boolean isStringEmpty(java.lang.String string)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |