|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.iastate.metnet.utils.Utils
public class Utils
Utilitiy class
| Field Summary | |
|---|---|
(package private) static org.apache.log4j.Logger |
logger
|
(package private) static int |
negativeSequence
save the sequence |
(package private) static java.net.ServerSocket |
socket
socket for single instance testing |
(package private) static Utils |
utils
the database statement instance |
| Method Summary | |
|---|---|
void |
applyTheme(java.lang.String themeName)
regardless the user options, always use the Eve's look and feel for MetNet tools. |
void |
applyTheme2(java.lang.String themeName)
apply the theme from the theme file based on metal theme |
java.util.Vector |
arrayToVector(java.lang.Object[] arr)
|
static java.lang.Object |
deepCopy(java.lang.Object orig)
Returns a copy of the object, or null if the object cannot be serialized. |
void |
dummyLabel(java.awt.Container panel,
int num_cols,
int num_rows)
|
static java.lang.String |
escapeXML(java.lang.String input)
replace all sensitive chars to special XML strings |
static java.lang.String[] |
explode(java.lang.String template,
java.lang.String delim)
similar to StringTokenize, split string by delim |
static java.lang.String |
generateGUID(java.lang.Object o)
A 32 byte GUID generator (Globally Unique ID). |
static int |
generateNegativeBasedUUID()
get the next unique id for the null vertex |
static java.lang.String |
getCurrentSQLDate()
get current data with 'yyyy-mm-dd' format |
static java.lang.String |
getDB()
|
static java.util.List |
getDifferenceWithCase(java.util.List a,
java.util.List b)
get differnece a-b, case sensitive |
static java.util.List |
getDifferenceWithoutCase(java.util.List a,
java.util.List b)
get the difference a-b, case insensitive |
static java.util.List |
getDifferenceXWithCase(java.util.List a,
java.util.List b)
get differnece of (a-b) + (b-a), case sensitive |
static java.util.List |
getDifferenceXWithoutCase(java.util.List a,
java.util.List b)
get the difference (a-b) + (b-a), case insensitive |
static java.lang.Object |
getFirst(java.util.Map map,
java.lang.Object key)
|
java.awt.Font |
getFont(java.lang.String name,
int type,
int size)
|
static Utils |
getInstance()
|
static java.util.List |
getIntersectionWithCase(java.util.List a,
java.util.List b)
get unique intersection of two vectors, case sensitive for string |
static java.util.List |
getIntersectionWithoutCase(java.util.List a,
java.util.List b)
get the intersection of two vectors, case insensitive |
java.lang.String |
getResource(java.lang.String key)
|
java.util.Vector |
getResourceVector(java.lang.String key)
|
static java.lang.String |
getServer()
get the web server and database server host |
java.util.Collection |
getSessionOrganism()
get the organism that the curator can edit |
int |
getSessionUserLevel()
current user level |
java.lang.String |
getSessionUsername()
current user name |
static java.util.List |
getUnionWithCase(java.util.List a,
java.util.List b)
get unique union of two vectors, case sensitive for strings |
static java.util.List |
getUnionWithoutCase(java.util.List a,
java.util.List b)
get the union of two vectors, case insensitive |
static java.util.List |
getUniqueWithCase(java.util.List a)
get the unique element in a colleciton, case sensitive |
static java.util.List |
getUniqueWithoutCase(java.util.List a)
case insensitive, only used for String object, to return the unique element in a collection |
static java.util.Map |
hashSet(java.util.Map map,
java.lang.Object key,
java.lang.Object value)
|
static java.lang.reflect.Method |
hasMethod(java.lang.Object object,
java.lang.String methodName)
detect if the method exists or not |
static java.lang.String |
implode(java.lang.Object[] v,
java.lang.String d)
|
static java.lang.String |
implode(java.lang.String[] v)
join string from array |
static java.lang.String |
implode(java.lang.String[] value,
java.lang.String delim)
join the string by delim |
static boolean |
isFirstRunning()
test if there is an instance of the application already |
static boolean |
isValid(java.lang.String s)
|
static java.lang.String |
join(java.util.Collection collection)
turn the vector of object to comma separate string, notice only applying for integer, not string, otherwise the string should contain the double quota already. |
static java.lang.String |
join(java.util.Collection collection,
java.lang.String delimit)
turn the vector of object to comma separate string, notice only applying for integer, not string, otherwise the string should contain the double quota already. |
void |
loadResource()
|
static java.lang.String |
makeValid(java.lang.String s)
|
static int |
maxIndex(double[] a)
|
static int |
minIndex(double[] a)
|
static java.lang.String |
mysqlEscape(java.lang.String insertString)
|
static java.lang.String |
mysqlOldPassword(java.lang.String plainText)
compute the old style encrypted mysql password from the plain text |
java.lang.String |
parseDouble(java.lang.String inputString,
java.lang.String defaultValue)
|
static java.lang.String |
prepare(java.lang.String t,
java.lang.String v)
|
static java.lang.String |
prepare(java.lang.String template,
java.lang.String[] value)
prepare the template with default mark as ? |
static java.lang.String |
prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2)
|
static java.lang.String |
prepare(java.lang.String t,
java.lang.String d,
java.lang.String[] v)
replace the mark in the template string |
static java.lang.String |
prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3)
|
static java.lang.String |
prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3,
java.lang.String v4)
|
static java.lang.String |
prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3,
java.lang.String v4,
java.lang.String v5)
|
void |
removeColumn(javax.swing.JTable tbl,
int col)
hidden the column from JTable such as serial number, if used on multiple columns, do from largest one |
java.awt.GridBagConstraints |
setConstraints(java.awt.GridBagConstraints layout,
int gridx,
int gridy,
int gridwidth,
int gridheight,
double weightx,
double weighty)
set the value of the GridBagConstraints and reuse it |
static java.lang.String |
splitEntity(java.lang.String entityName)
to facility input, we use ,, to separate name and return in () |
static java.util.Vector |
splitEntityList(java.lang.String entityName)
|
static java.lang.Double |
string2Double(java.lang.String string)
convert the string to double without throwing exception |
static java.lang.Integer |
string2Integer(java.lang.String string)
conver tth estring to integer without throwing exception |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.log4j.Logger logger
static Utils utils
static int negativeSequence
static java.net.ServerSocket socket
| Method Detail |
|---|
public static final int generateNegativeBasedUUID()
public static Utils getInstance()
public static java.lang.String join(java.util.Collection collection)
collection - the collection of the objects
public static java.lang.String join(java.util.Collection collection,
java.lang.String delimit)
collection - the collection of the objects
public static java.util.List getIntersectionWithCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
Set
public static java.lang.reflect.Method hasMethod(java.lang.Object object,
java.lang.String methodName)
object - the objectmethodName - the name of the method
public static java.util.List getIntersectionWithoutCase(java.util.List a,
java.util.List b)
a - first vectotb - second vector
Set
public static java.util.List getUnionWithCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
public static java.util.List getUnionWithoutCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
Set
public static java.util.List getDifferenceWithCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
public static java.util.List getDifferenceWithoutCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
public static java.util.List getDifferenceXWithCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
public static java.util.List getDifferenceXWithoutCase(java.util.List a,
java.util.List b)
a - first vectorb - second vector
public java.awt.GridBagConstraints setConstraints(java.awt.GridBagConstraints layout,
int gridx,
int gridy,
int gridwidth,
int gridheight,
double weightx,
double weighty)
layout - the layout instance to be reusedgridx - x position in the containergridy - y position in the containergridwidth - span width of the controlgridheight - span height of the controlweightx - weight of x direction when the size is changedweighty - weight of y direction when the size is changed
public static java.util.List getUniqueWithCase(java.util.List a)
a - the collection
public static java.util.List getUniqueWithoutCase(java.util.List a)
a - the colleciton
public void removeColumn(javax.swing.JTable tbl,
int col)
tbl - the table need to hide one of the columnscol - the index of the column, zero basedpublic static java.lang.String getCurrentSQLDate()
public int getSessionUserLevel()
public java.lang.String getSessionUsername()
public java.util.Collection getSessionOrganism()
public void applyTheme(java.lang.String themeName)
themeName - never used but leave it for compatabilitypublic void applyTheme2(java.lang.String themeName)
public void loadResource()
public java.lang.String getResource(java.lang.String key)
public java.util.Vector getResourceVector(java.lang.String key)
public static boolean isValid(java.lang.String s)
public static java.lang.String makeValid(java.lang.String s)
public java.lang.String parseDouble(java.lang.String inputString,
java.lang.String defaultValue)
public static java.lang.Object getFirst(java.util.Map map,
java.lang.Object key)
public static java.util.Map hashSet(java.util.Map map,
java.lang.Object key,
java.lang.Object value)
public static java.lang.String prepare(java.lang.String t,
java.lang.String d,
java.lang.String[] v)
t - [in] the templated - [in] the delimv - [in] the value for the markers
public static java.lang.String mysqlEscape(java.lang.String insertString)
public static java.lang.String escapeXML(java.lang.String input)
input - the input raw string
public static java.lang.String splitEntity(java.lang.String entityName)
the - entity name list to be splited
public static java.util.Vector splitEntityList(java.lang.String entityName)
public static int minIndex(double[] a)
public static int maxIndex(double[] a)
public static java.lang.String prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3)
public static java.lang.String prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3,
java.lang.String v4)
public static java.lang.String prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2,
java.lang.String v3,
java.lang.String v4,
java.lang.String v5)
public static java.lang.String prepare(java.lang.String t,
java.lang.String v1,
java.lang.String v2)
public static java.lang.String prepare(java.lang.String t,
java.lang.String v)
public static java.lang.String prepare(java.lang.String template,
java.lang.String[] value)
public static java.lang.String[] explode(java.lang.String template,
java.lang.String delim)
template - [in] the templatedelim - [in] the delim
public static java.lang.String implode(java.lang.String[] value,
java.lang.String delim)
value - [in] the array of the stringdelim - [in] delim used for joining
public static java.lang.String implode(java.lang.Object[] v,
java.lang.String d)
public static java.lang.String implode(java.lang.String[] v)
v - the strings to be joined
public static java.lang.String getDB()
public static java.lang.String getServer()
public java.util.Vector arrayToVector(java.lang.Object[] arr)
public java.awt.Font getFont(java.lang.String name,
int type,
int size)
public void dummyLabel(java.awt.Container panel,
int num_cols,
int num_rows)
public static java.lang.Double string2Double(java.lang.String string)
string - any string to be converted
public static java.lang.Integer string2Integer(java.lang.String string)
string - any string to be converted
public static java.lang.String mysqlOldPassword(java.lang.String plainText)
plainText - the plain style password
public static java.lang.Object deepCopy(java.lang.Object orig)
orig - original object
public static final java.lang.String generateGUID(java.lang.Object o)
o - the object instance
public static boolean isFirstRunning()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||