|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.Util
public class Util
Includes general help methods that are used by the other classes.
Field Summary | |
---|---|
static String[] |
forbiddenCharacters
Forbidden characters in file names. |
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static HashMap<Integer,Integer> |
align(Collection<Integer> serie1,
Collection<Integer> serie2)
Aligns two series of integer, minimizing the distance between them. |
static String |
color2Hex(Color color)
Converts a color to hex format for use in HTML tags. |
static boolean |
containsForbiddenCharacter(String string)
Indicates whether a string contains characters forbidden in file names. |
static void |
copyFile(File in,
File out)
Copy the content of one file to another. |
static boolean |
deleteDir(File dir)
Deletes all files and subdirectories under dir. |
static String |
getFileName(String filePath)
An OS independent getName alternative. |
static int |
getNumberOfLines(File file)
Returns the number of lines in the given file. |
static double |
getPpmError(double theoreticalMzValue,
double massError)
Returns the ppm value of the given mass error relative to its theoretical m/z value. |
static File |
getUserSelectedFile(Component parent,
String aFileEnding,
String aFileFormatDescription,
String aDialogTitle,
String lastSelectedFolder,
boolean openDialog)
Returns the file selected by the user, or null if no file was selected. |
static String |
removeForbiddenCharacters(String string)
Removes the forbidden characters from a string |
static double |
roundDouble(double d,
int places)
Rounds a double value to the wanted number of decimal places. |
static void |
tableToFile(JTable table,
String separator,
ProgressDialogX progressDialog,
boolean removeHtml,
BufferedWriter writer)
Writes the table to a file as separated text. |
static String |
tableToText(JTable table,
String separator,
ProgressDialogX progressDialog,
boolean removeHtml)
Returns the table as a separated text file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] forbiddenCharacters
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static String removeForbiddenCharacters(String string)
string
- the string of interest
public static boolean containsForbiddenCharacter(String string)
string
- the string of interest
public static double roundDouble(double d, int places)
d
- the double to round ofplaces
- number of decimal places wanted
public static boolean deleteDir(File dir)
dir
-
public static double getPpmError(double theoreticalMzValue, double massError)
theoreticalMzValue
- the theoretical massmassError
- the mass error
public static String color2Hex(Color color)
color
- the color to convert
public static String getFileName(String filePath)
filePath
- the file path as a string
public static File getUserSelectedFile(Component parent, String aFileEnding, String aFileFormatDescription, String aDialogTitle, String lastSelectedFolder, boolean openDialog)
parent
- the parent dialog or frameaFileEnding
- the file type, e.g., .txtaFileFormatDescription
- the file format description, e.g., (Mascot
Generic Format) *.mgfaDialogTitle
- the title for the dialoglastSelectedFolder
- the last selected folderopenDialog
- if true an open dialog is shown, false results in a
save dialog
public static String tableToText(JTable table, String separator, ProgressDialogX progressDialog, boolean removeHtml)
table
- the table to turn in to textseparator
- the text separatorprogressDialog
- the progress dialogremoveHtml
- if true, html is converted to text
public static void tableToFile(JTable table, String separator, ProgressDialogX progressDialog, boolean removeHtml, BufferedWriter writer) throws IOException
table
- the table to write to fileseparator
- the text separatorprogressDialog
- the progress dialogremoveHtml
- if true, html is converted to textwriter
- the writer where the file is to be written
IOException
public static void copyFile(File in, File out) throws IOException
in
- the file to copy fromout
- the file to copy to
IOException
public static int getNumberOfLines(File file) throws IOException
file
- the file to find the number of lines in
IOException
public static HashMap<Integer,Integer> align(Collection<Integer> serie1, Collection<Integer> serie2)
serie1
- first list of integerserie2
- second list of integer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |