public class Utilities
extends java.lang.Object
GUI| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ABOUTTXT_RESOURCE_PATH
about text file path from IMPACT.resources
|
static java.lang.String |
ATVExeKey
ATV program location
|
static java.lang.String |
BaseKey
GUI Base directory location
|
static java.lang.String |
CodemlExeKey
Codeml program location
|
static java.lang.String |
DatamonkeyDataKey
GUI Datamonkey data location
|
static java.lang.String |
DatamonkeyResDirName
GUI Datamonkey tab results directory name.
|
static java.lang.String |
DataSetDirName
GUI base data sets directory name.
|
static java.lang.String |
DataSetKey
GUI DataSet directory location
|
static java.lang.String |
GNUPLOTExeKey
Gnuplot program location
|
static java.lang.String |
IMAGE_ICON_RESOURCE_PATH
image icon path from IMPACT.resources
|
static java.lang.String |
IMAGE_INIT_RESOURCE_PATH
image icon path from IMPACT.resources
|
static java.lang.String |
JCOLOR_SCHEMES_HELP_RESOURCE_PATH
image icon path from IMPACT.resources
|
static java.lang.String |
JmolExeKey
Jmol program location
|
static java.lang.String |
lineSeparator
System dependant line separator
|
static java.lang.String |
mydfltDSName
Default user defined data set name.
|
static java.lang.String |
PAMLDataKey
GUI Codeml data location
|
static java.lang.String |
PAMLResDirName
GUI Codeml tab results directory name.
|
static java.lang.String |
PhyMLExeKey
PhyML program location
|
static java.lang.String |
PROGRAM_VERSION_RESOURCE_PATH
image icon path from IMPACT.resources
|
static java.lang.String |
programName
Program name used across all modules
|
static java.lang.String |
ProgramsKey
GUI Programs directory location
|
static java.lang.String |
Results3DDirName
GUI Results tab directory name.
|
static java.lang.String |
ResultsDataKey
GUI Results & 3D data location
|
static java.lang.String |
SystemKey
GUI directory location
|
static java.lang.String |
TreeSAAPDataKey
GUI TreeSAAP data location
|
static java.lang.String |
TreeSAAPExeKey
TreeSAAP program location
|
static java.lang.String |
TreeSAAPResDirName
GUI TreeSAAP tab results directory name.
|
| Constructor and Description |
|---|
Utilities()
Empty constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countCharAt(java.lang.String str,
char chsearch)
Count occurrences of char in string.
|
boolean |
downloadFile(java.lang.String uurl,
java.io.File tmpout)
Download file pointed by url to file.
|
java.lang.String |
firstCharUp(java.lang.String txt)
Get given string with only first character to upper case.
Remaining part to lower case. |
java.lang.String[] |
getArrayObjectToStr(java.lang.Object[] values)
Produce an String array from an Object array.
|
java.io.BufferedReader |
getBR(java.lang.String filepath)
Get Buffered Reader for file reading.
|
java.lang.String |
getCodemlDir()
Get codeml directory.
|
java.lang.String |
getExt(java.lang.String filename)
Get filename extension.
|
java.lang.String |
getFallBackLocation(java.lang.String key)
Get location given associated key.
|
java.lang.String |
getFileContent(java.io.InputStream file)
Get content of file, by input stream.
|
java.lang.String |
getFileContent(java.lang.String filepath)
Get file content for specified file.
|
int |
getIntegerFromStr(java.lang.String str)
Given a string comprised by text and numbers, get the first number found in string.
|
int[] |
getIntegersFrom(java.lang.String[] ints,
boolean sort,
boolean asc)
Get array of integers from array of strings consisting of only integers.
|
java.lang.String |
getLocation(java.lang.String key)
Get location given associated key.
|
java.lang.String |
getName(java.lang.String path)
Get name of file given absolute path.
For opposite see also. |
java.lang.String |
getNameNoExt(java.lang.String pathtofile)
Remove extension from filename with extension, given absolute path to filename.
|
java.lang.String |
getNewGenFile(java.lang.String filePath,
java.lang.String fileName)
For given file absolute path (with no name),
calculates new name until it is found not to exist.
If it is needed (&99) number of generation IDs may be extended. |
java.lang.String |
getPathNoName(java.lang.String path)
Get path without file name, given absolute path.
For opposite see also. |
java.lang.String |
getRGBColor(java.lang.String clrtostr,
java.lang.String useparentesis)
Get color given by Color.toString() in format r,g,b only.
|
java.lang.String |
getSubstrChopFst(java.lang.String txt)
Get substring without first character.
|
java.lang.String |
getSubstrChopLast(java.lang.String txt)
Get substring without last character.
|
java.lang.String |
getSubstringByChar(java.lang.String text,
java.lang.String ch)
Get substring from text given char.
The final string consists of all characters between 0 and index of that character. |
java.lang.String |
join(java.lang.String[] p,
java.lang.String charsep)
Build a string from an array with elements separated by charsep.
|
void |
println(java.lang.String msg) |
boolean |
renameFile(java.lang.String source,
java.lang.String dest,
boolean deletesrc)
Copies content from source file to destination file.
This way creating a rename operation. This was created to overcome limitations of File.renameTo() method. Replaces any destination file that may exist. |
java.lang.String |
replaceExtBy(java.lang.String filename,
java.lang.String newExt)
Replace extension with new given extension.
|
void |
setLocation(java.lang.String key,
java.lang.String value)
Set location to key.
|
boolean |
startUtilities()
Start initialization of necessary locations.
|
void |
updateTreeSAAPBS()
Update TreeSAAP baseml settings file.
|
void |
updateTreeSAAPDS()
Update TreeSAAP driver settings file to work with TreeSAAP tab output directory.
|
void |
updateTreeSAAPDtS()
Update TreeSAAP data settings file.
|
void |
updateTreeSAAPGS()
Update TreeSAAP gui settings file.
|
void |
updateTreeSAAPSettings()
Update TreeSAAP Settings files.
|
void |
writePreferences(boolean useds)
Save (user) preferences to file.
|
java.lang.String |
writeToFile(java.lang.String[] content,
java.lang.String header,
java.lang.String filename)
Write an array of lines to file.
|
public static final java.lang.String lineSeparator
public static final java.lang.String programName
public static final java.lang.String mydfltDSName
public static final java.lang.String BaseKey
public static final java.lang.String SystemKey
public static final java.lang.String ProgramsKey
public static final java.lang.String DataSetKey
public static final java.lang.String TreeSAAPDataKey
public static final java.lang.String DatamonkeyDataKey
public static final java.lang.String PAMLDataKey
public static final java.lang.String ResultsDataKey
public static final java.lang.String CodemlExeKey
public static final java.lang.String PhyMLExeKey
public static final java.lang.String ATVExeKey
public static final java.lang.String JmolExeKey
public static final java.lang.String TreeSAAPExeKey
public static final java.lang.String GNUPLOTExeKey
public static final java.lang.String DataSetDirName
public static final java.lang.String TreeSAAPResDirName
public static final java.lang.String DatamonkeyResDirName
public static final java.lang.String PAMLResDirName
public static final java.lang.String Results3DDirName
public static java.lang.String IMAGE_ICON_RESOURCE_PATH
public static java.lang.String IMAGE_INIT_RESOURCE_PATH
public static java.lang.String JCOLOR_SCHEMES_HELP_RESOURCE_PATH
public static java.lang.String ABOUTTXT_RESOURCE_PATH
public static java.lang.String PROGRAM_VERSION_RESOURCE_PATH
public void println(java.lang.String msg)
public boolean startUtilities()
public void writePreferences(boolean useds)
useds - true, to save Dataset locations.public java.lang.String getLocation(java.lang.String key)
key - to identify location.public java.lang.String getFallBackLocation(java.lang.String key)
key - to identify location.public void setLocation(java.lang.String key,
java.lang.String value)
key - to identify location to be changed.value - of location.public java.lang.String getCodemlDir()
public java.lang.String join(java.lang.String[] p,
java.lang.String charsep)
p - array to join.charsep - choose which character will separate contents of p. TAB is used if null.public java.lang.String getSubstrChopLast(java.lang.String txt)
txt - string 'txt'public java.lang.String getSubstrChopFst(java.lang.String txt)
txt - string 'txt'public java.lang.String getSubstringByChar(java.lang.String text,
java.lang.String ch)
text - from where to search and get final result.ch - the character to search.public java.lang.String firstCharUp(java.lang.String txt)
txt - string 'txt'public java.lang.String getName(java.lang.String path)
path - file (absolute) pathgetPathNoName(String path)public java.lang.String getPathNoName(java.lang.String path)
path - absolute path to file.getName(String path)public java.lang.String getExt(java.lang.String filename)
filename - with extension.public java.lang.String replaceExtBy(java.lang.String filename,
java.lang.String newExt)
filename - with extension.newExt - of the new extension.public java.lang.String getNameNoExt(java.lang.String pathtofile)
pathtofile - with extensionpublic java.lang.String getNewGenFile(java.lang.String filePath,
java.lang.String fileName)
filePath - path of file (only directory(ies)).fileName - name of file with extension.public java.io.BufferedReader getBR(java.lang.String filepath)
filepath - absolute path for file.public boolean renameFile(java.lang.String source,
java.lang.String dest,
boolean deletesrc)
source - absolute path to source file from where to get contents.dest - absolute path to destination file where to copy contents.deletesrc - if true delete source file; otherwise maintain file.public java.lang.String getFileContent(java.io.InputStream file)
file - input stream.public java.lang.String getFileContent(java.lang.String filepath)
filepath - absolute path.public java.lang.String writeToFile(java.lang.String[] content,
java.lang.String header,
java.lang.String filename)
content - to be written to file without newlines.header - some header to add to file (as in column names for CSV files).
If this is null or empty string nothing is written.filename - the name to be used for the file.
This file will be located at Base directory if only file name is given.public int countCharAt(java.lang.String str,
char chsearch)
str - where to search for char.chsearch - the char to search for.public boolean downloadFile(java.lang.String uurl,
java.io.File tmpout)
uurl - user url from where to download file.tmpout - file where contents will be saved.public int getIntegerFromStr(java.lang.String str)
str - string to be parsed.public java.lang.String getRGBColor(java.lang.String clrtostr,
java.lang.String useparentesis)
clrtostr - color as string. E.g.:java.awt.Color[r=200,g=0,b=0]useparentesis - choose witch parenthesis to use; use nothing if null.public java.lang.String[] getArrayObjectToStr(java.lang.Object[] values)
values - object values.public int[] getIntegersFrom(java.lang.String[] ints,
boolean sort,
boolean asc)
ints - array of integers as strings.sort - if true sort final array.asc - if sort is true, then sort by ascending (asc: true) or descending roder (asc:false).public void updateTreeSAAPSettings()
public void updateTreeSAAPDS()
public void updateTreeSAAPDtS()
public void updateTreeSAAPBS()
public void updateTreeSAAPGS()