com.compomics.util
Class Util

java.lang.Object
  extended by com.compomics.util.Util

public class Util
extends java.lang.Object

Includes general help methods that are used by the other classes.

Author:
Harald Barsnes

Constructor Summary
Util()
           
 
Method Summary
static java.lang.String color2Hex(java.awt.Color color)
          Converts a color to hex format for use in HTML tags.
static boolean deleteDir(java.io.File dir)
          Deletes all files and subdirectories under dir.
static java.lang.String getFileName(java.lang.String filePath)
          An OS independent getName alternative.
static double getPpmError(double theoreticalMzValue, double massError)
          Returns the ppm value of the given mass error relative to its theoretical m/z value.
static double roundDouble(double d, int places)
          Rounds a double value to the wanted number of decimalplaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

roundDouble

public static double roundDouble(double d,
                                 int places)
Rounds a double value to the wanted number of decimalplaces.

Parameters:
d - the double to round of
places - number of decimal places wanted
Returns:
double - the new double

deleteDir

public static boolean deleteDir(java.io.File dir)
Deletes all files and subdirectories under dir. Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and returns false.

Parameters:
dir -
Returns:
rue if all deletions were successful

getPpmError

public static double getPpmError(double theoreticalMzValue,
                                 double massError)
Returns the ppm value of the given mass error relative to its theoretical m/z value.

Parameters:
theoreticalMzValue - the theoretical mass
massError - the mass error
Returns:
the mass error as a ppm value relative to the theoretical mass

color2Hex

public static java.lang.String color2Hex(java.awt.Color color)
Converts a color to hex format for use in HTML tags.

Parameters:
color - the color to convert
Returns:
the color in hex format

getFileName

public static java.lang.String getFileName(java.lang.String filePath)
An OS independent getName alternative. Useful if the path is provided as a hardcoded string and opened in a different OS.

Parameters:
filePath - the file path as a string
Returns:
the file name, or the complete path of no file name is detected


Copyright © 2011. All Rights Reserved.