Class UtilPRP

java.lang.Object
  |
  +--UtilPRP

public class UtilPRP
extends java.lang.Object

Class UtilPRP contains common utility fcts. for string-numeric conversions messages to the three message lines in the bottom page as well as displayURL functionality. This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government and Djamel Medjahed (SAIC-Frederick). As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file.

Version:
$Date: 2002/10/14 20:17:17 $ $Revision: $
Author:
P. Lemkin (NCI), Djamel Medjahed (SAIC), NCI-Frederick, Frederick, MD
See Also:
ProtPlot Home

This work was derived from MAExplorer under the Mozilla 1.1 Open Source Public License by Peter Lemkin of the National Cancer Institute, an agency of the United States Government subject to the limitations noted in the accompanying LEGAL file. See licence info on http://maexplorer.sourceforge.org/


Field Summary
static float defaultFloat
          Default value of float for cvs2f() calls
static int defaultInt
          Default value of int for cvs2i() calls
private  java.awt.Color lastBG1
          last foreground, background colors cached
private  java.awt.Color lastBG2
          last foreground, background colors cached
private  java.awt.Color lastBG3
          last foreground, background colors cached
private  java.awt.Color lastBG4
          last foreground, background colors cached
private  java.awt.Color lastFG1
          last foreground, background colors cached
private  java.awt.Color lastFG2
          last foreground, background colors cached
private  java.awt.Color lastFG3
          last foreground, background colors cached
private  java.awt.Color lastFG4
          last foreground, background colors cached
static java.lang.String mStatus
           
static int nStateEntries
          # of (name,value) pairs read from the "protplot.prpstate" file
private  int parseDelimChar
          current delim of "name(delim)value" pair
private  java.lang.String parseName
          current name of "name=value" pair
private  java.lang.String parseValue
          current value of "name=value" pair
private static ProtPlot prp
          instance of ProtPlot
private static ShowScatterPlotPopup spp
          instance of ShowScatterPlotPopup
 
Constructor Summary
(package private) UtilPRP(ProtPlot prp)
          Util() - constructor
 
Method Summary
(package private) static int[] bubbleSortIndex(float[] data, int len, boolean ascending)
          bubbleSortIndex() - sort copy of float[0:len-1] data with bubble sort, return index[].
(package private) static int[] bubbleSortIndex(java.lang.String[] data, int len, boolean ascending, boolean ignoreCaseFlag)
          bubbleSortIndex() - sort copy of String[0:len-1] data with bubble sort, return index[].
static java.lang.String chkDirFinalSeparator(java.lang.String sPath, java.lang.String fS)
          chkDirFinalSeparator() - make dir path end in fileSeparator.
 boolean copyFile(java.lang.String srcName, java.lang.String dstName, java.lang.String optUpdateMsg, int optEstInputFileLth)
          copyFile() - binary copy of one file or URL toa local file
static java.lang.String cvd2s(double v, int precision)
          cvd2s() - convert double to string with precision # of digits If precision > 0 then limit # of digits in fraction
static java.lang.String cvf2s(float v, int precision)
          cvf2s() - convert float to string with precision # of digits If precision > 0 then limit # of digits in fraction
static double cvs2d(java.lang.String str)
          cvs2d() - convert String to double
static float cvs2f(java.lang.String str)
          cvs2f() - convert String to float
static float cvs2f(java.lang.String str, float defVal)
          cvs2f() - convert String to float
static int cvs2i(java.lang.String str)
          cvs2i() - convert String to int
static int cvs2i(java.lang.String str, int defVal)
          cvs2i() - convert String to int
static long cvs2long(java.lang.String str)
          cvs2long() - convert String to int
(package private) static java.lang.String cvtSpacesToUnderscores(java.lang.String str)
          cvtSpacesToUnderscores() - replace spaces and other illegal file name characters with '_' chars to make file names highly portable.
static java.lang.String cvtUnderscores2Spaces(java.lang.String sInput)
          cvtUnderscores2Spaces() - change underscores to spaces
(package private) static java.lang.String cvtValueToStars(float val, float valMax, int maxStars, boolean rightFillFlag)
          cvtValueToStars() - cvt val in[0:valMax] to "****"+" " string where the maximum # of stars for v==vMax is specified.
(package private) static java.lang.String dateStr()
          dateStr() - return a new Date string of the current day and time
 boolean deleteLocalFile(java.lang.String fileName)
          deleteLocalFile() - delete local file.
 void displayURL(java.lang.String url)
          displayURL() - Display a file in the system browser.
(package private)  float getFloatValFromLine(java.lang.String key, java.util.StringTokenizer parser)
          getFloatValFromLine() - get next line and parse value for key 'name='.
 java.lang.String getHelpBaseURL()
          getHelpBaseURL() - get the base URL for HELP based on prp.useLocalDocFlag It will either be the ProtPlot server or the /Doc/ directory
(package private)  int getIntValFromLine(java.lang.String key, java.util.StringTokenizer parser)
          getIntValFromLine() - get next line and parse value for key 'name='.
(package private)  long getLongValFromLine(java.lang.String key, java.util.StringTokenizer parser)
          getLongValFromLine() - get next line and parse value for key 'name='.
(package private)  int getNextInt(java.util.StringTokenizer parser)
          getNextInt() - parse next int from StringTokenizer the integers are separated by ',' or '\n'.
(package private)  boolean getNextStrNameValFromLine(java.util.StringTokenizer parser)
          getNextStrNameValFromLine() - get next line and parse 'name=value\n'.
 java.lang.String getStateStr()
          getStateStr() - generate a tab-delim ProtPlot State string The format is tab-delimted (name \t value \n) with one entry/line.
(package private)  java.lang.String getStrValFromLine(java.lang.String key)
          getStrValFromLine() - parse value for key 'name=value\n'.
(package private)  java.lang.String getStrValFromLine(java.lang.String key, java.util.StringTokenizer parser)
          getStrValFromLine() - get line and parse value for key 'name=value\n'.
static boolean isNameInList(java.lang.String[] sList, java.lang.String s)
          isNameInList() - test if String s is in a list of strings sList[].
static int nextZoomMag(int val, int maxVal)
          nextZoomMag() - modulo 1X, 2X, 5X, 10X, 20X, 30X, 40X, 50X,
 void popupAlertMsg(java.lang.String msg)
          popupAlertMsg() - popup ALERT message and then timeout.
 void popupViewer(java.net.URL urlBase, java.lang.String fileIn, java.lang.String windowName)
          popupViewer() - popup another web browser for the help HTML file.
 byte[] readBytesFromURL(java.lang.String srcName, java.lang.String optUpdateMsg)
          readBytesFromURL() - read binary data from URL
(package private)  boolean readNamedProteinSet(java.lang.String protSetName, java.lang.String destSetName)
          readNamedProteinSet() - read named protein set file and save it Cluster or Filter Save list.
 java.util.Hashtable readState(java.lang.String stateFile)
          readState() - read the ProtPlot State file stateFile
(package private)  boolean saveNamedProteinSet(java.lang.String protSetName, java.lang.String srcSetName)
          saveNamedProteinSet() - save the named protein set as a "Set/*.set" file.
 java.lang.String setPlotModeName()
          setPlotModeName() - lookup the plot mode name
 void setText1(java.lang.String text)
          setText1() - change the text1 msg for the panel.
 void setText1(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          setText1() - change the text1 field in the panel with fg, bg colors You can save the msg as the title.
 void setText2(java.lang.String msg)
          setText2() - change the text2 field in the panel.
 void setText2(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          setText2() - change the text2 field in the panel with fg, bg colors
 void setText3(java.lang.String msg)
          setText3() - change the text3 field in the panel.
 void setText3(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          setText3() - change the text3 field in the panel with fg, bg colors
 void setText4(java.lang.String msg)
          setText4() - change the text4 field in the panel.
 void setText4(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          setText4() - change the text4 field in the panel with fg, bg colors
 void showFeatures(java.lang.String msg2, java.lang.String msg3)
          showFeatures() - print features to txtField2 and txtField3
 void showMsg(java.lang.String msg)
          showMsg() - print msg to showStatus() and to txtField1
 void showMsg(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          showMsg() - print msg to showStatus() and to txtField1
 void showMsg1(java.lang.String msg, java.awt.Color fg, java.awt.Color bg)
          showMsg1() - print msg to showStatus() and to txtField1 and change color
 void showMsg2(java.lang.String msg2)
          showMsg2() - print msg2 to txtField2
 void showMsg2(java.lang.String msg2, java.awt.Color fg, java.awt.Color bg)
          showMsg2() - print msg2 to txtField2 and change color
 void showMsg3(java.lang.String msg3)
          showMsg3() - print msg3 to txtField3
 void showMsg3(java.lang.String msg3, java.awt.Color fg, java.awt.Color bg)
          showMsg3() - print msg3 to txtField3 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white).
 void showMsg4(java.lang.String msg4)
          showMsg4() - print msg2 to txtField4
 void showMsg4(java.lang.String msg4, java.awt.Color fg, java.awt.Color bg)
          showMsg4() - print msg4 to txtField4 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white).
static void sleepMsec(int sleepMsec)
          sleepMsec() - sleep nMsec where nMsec must be >= 0 milliseconds.
(package private)  boolean updateProtPlotJarFile()
          updateProtPlotJarFile() - update ProtPlot.jar into program install area.
(package private)  boolean updateProtPlotProgram()
          updateProtPlotProgram() - verify that want to update the ProtPlot.jar file from the maexplorer.sourceforge.net server.
(package private)  boolean updateProtPlotPRPdatabase()
          updateProtPlotPRPdatabase() - verify that want to update PRP/*.prp files from the current server.
(package private)  boolean updateProtPlotPRPfile(int n, java.lang.String prpFname)
          updateProtPlotPRPfile() - update ProtPlot PRP/*.prp files into PRP/ install area.
 boolean writeState(java.lang.String stateFile)
          writeState() - write the ProtPlot State into stateFile in the same directory that the project is in.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

prp

private static ProtPlot prp
instance of ProtPlot

spp

private static ShowScatterPlotPopup spp
instance of ShowScatterPlotPopup

mStatus

public static java.lang.String mStatus

nStateEntries

public static int nStateEntries
# of (name,value) pairs read from the "protplot.prpstate" file

defaultInt

public static int defaultInt
Default value of int for cvs2i() calls

defaultFloat

public static float defaultFloat
Default value of float for cvs2f() calls

parseName

private java.lang.String parseName
current name of "name=value" pair

parseValue

private java.lang.String parseValue
current value of "name=value" pair

parseDelimChar

private int parseDelimChar
current delim of "name(delim)value" pair

lastFG1

private java.awt.Color lastFG1
last foreground, background colors cached

lastBG1

private java.awt.Color lastBG1
last foreground, background colors cached

lastFG2

private java.awt.Color lastFG2
last foreground, background colors cached

lastBG2

private java.awt.Color lastBG2
last foreground, background colors cached

lastFG3

private java.awt.Color lastFG3
last foreground, background colors cached

lastBG3

private java.awt.Color lastBG3
last foreground, background colors cached

lastFG4

private java.awt.Color lastFG4
last foreground, background colors cached

lastBG4

private java.awt.Color lastBG4
last foreground, background colors cached
Constructor Detail

UtilPRP

UtilPRP(ProtPlot prp)
Util() - constructor
Parameters:
prp - is instance of ProtPlot
Method Detail

showMsg

public void showMsg(java.lang.String msg)
showMsg() - print msg to showStatus() and to txtField1
Parameters:
msg2 - to display

showMsg

public void showMsg(java.lang.String msg,
                    java.awt.Color fg,
                    java.awt.Color bg)
showMsg() - print msg to showStatus() and to txtField1
Parameters:
msg - to display
fg - is forground color
bg - is background color

showMsg1

public void showMsg1(java.lang.String msg,
                     java.awt.Color fg,
                     java.awt.Color bg)
showMsg1() - print msg to showStatus() and to txtField1 and change color
Parameters:
msg - to display
fg - is forground color
bg - is background color

showFeatures

public void showFeatures(java.lang.String msg2,
                         java.lang.String msg3)
showFeatures() - print features to txtField2 and txtField3
Parameters:
msg2 - to display
msg3 - to display

showMsg2

public void showMsg2(java.lang.String msg2)
showMsg2() - print msg2 to txtField2
Parameters:
msg2 - to display

showMsg2

public void showMsg2(java.lang.String msg2,
                     java.awt.Color fg,
                     java.awt.Color bg)
showMsg2() - print msg2 to txtField2 and change color
Parameters:
msg2 - to display
fg - is forground color
bg - is background color

showMsg3

public void showMsg3(java.lang.String msg3)
showMsg3() - print msg3 to txtField3
Parameters:
msg3 - to display

showMsg3

public void showMsg3(java.lang.String msg3,
                     java.awt.Color fg,
                     java.awt.Color bg)
showMsg3() - print msg3 to txtField3 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white).
Parameters:
msg3 - to display
fg - is forground color
bg - is background color

showMsg4

public void showMsg4(java.lang.String msg4)
showMsg4() - print msg2 to txtField4
Parameters:
msg4 - to display

showMsg4

public void showMsg4(java.lang.String msg4,
                     java.awt.Color fg,
                     java.awt.Color bg)
showMsg4() - print msg4 to txtField4 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white).
Parameters:
msg4 - to display
fg - is forground color
bg - is background color

popupAlertMsg

public void popupAlertMsg(java.lang.String msg)
popupAlertMsg() - popup ALERT message and then timeout. Do a local timeout if localTimeoutMsec>0.
Parameters:
msg - to display in popup alert

setText1

public void setText1(java.lang.String text)
setText1() - change the text1 msg for the panel. Force foreground to BLACK and background to WHITE.
Parameters:
text - to display

setText1

public void setText1(java.lang.String msg,
                     java.awt.Color fg,
                     java.awt.Color bg)
setText1() - change the text1 field in the panel with fg, bg colors You can save the msg as the title.

setText2

public void setText2(java.lang.String msg)
setText2() - change the text2 field in the panel. Force foreground to BLACK and background to WHITE.

setText2

public void setText2(java.lang.String msg,
                     java.awt.Color fg,
                     java.awt.Color bg)
setText2() - change the text2 field in the panel with fg, bg colors

setText3

public void setText3(java.lang.String msg)
setText3() - change the text3 field in the panel. Force foreground to BLACK and background to WHITE.
Parameters:
msg - to display

setText3

public void setText3(java.lang.String msg,
                     java.awt.Color fg,
                     java.awt.Color bg)
setText3() - change the text3 field in the panel with fg, bg colors
Parameters:
msg - to display
fg - is forground color
bg - is background color

setText4

public void setText4(java.lang.String msg)
setText4() - change the text4 field in the panel. Force foreground to BLACK and background to WHITE.
Parameters:
msg - to display

setText4

public void setText4(java.lang.String msg,
                     java.awt.Color fg,
                     java.awt.Color bg)
setText4() - change the text4 field in the panel with fg, bg colors
Parameters:
msg - to display
fg - is forground color
bg - is background color

popupViewer

public void popupViewer(java.net.URL urlBase,
                        java.lang.String fileIn,
                        java.lang.String windowName)
popupViewer() - popup another web browser for the help HTML file.
Parameters:
urlBase - is the base class of the server
fileIne - is the file to display
windowName - is the optional window name if not null

displayURL

public void displayURL(java.lang.String url)
displayURL() - Display a file in the system browser. For use in standalone.
 Examples:
 displayURL("http://www.javaworld.com")
 displayURL("file://c:\\docs\\index.html")
 displayURL("file:///user/joe/index.html");

 Under Unix, the system browser is hard-coded to be 'netscape'.
 Netscape must be in your PATH for this to work.

 Under Windows, this will bring up the default browser under windows,
 usually either Netscape or Microsoft IE. The default browser is
 determined by the OS.

 adapted from :
 http://www.javaworld.com/javaworld/javatips/jw-javatip66_p.html

 NOTE: param url the file's url (the url must start with either
 "http://" or"file://").

 [TODO] Handle the Mac.
Parameters:
url - is the URL to display.

setPlotModeName

public java.lang.String setPlotModeName()
setPlotModeName() - lookup the plot mode name
Returns:
the plot mode name string

cvf2s

public static java.lang.String cvf2s(float v,
                                     int precision)
cvf2s() - convert float to string with precision # of digits If precision > 0 then limit # of digits in fraction
Parameters:
v - is the value to convert
precision - is the # of digits to display
Returns:
string approximating "%0.pd"

cvd2s

public static java.lang.String cvd2s(double v,
                                     int precision)
cvd2s() - convert double to string with precision # of digits If precision > 0 then limit # of digits in fraction
Parameters:
v - is the value to convert
precision - is the # of digits to display
Returns:
string approximating "%0.pd"

cvs2d

public static double cvs2d(java.lang.String str)
cvs2d() - convert String to double
Parameters:
str - is the string to convert to a number
Returns:
value of string

cvs2f

public static float cvs2f(java.lang.String str)
cvs2f() - convert String to float
Parameters:
str - is the string to convert to a number
Returns:
value of string

cvs2f

public static float cvs2f(java.lang.String str,
                          float defVal)
cvs2f() - convert String to float
Parameters:
str - is the string to convert to a number
defVal - is the explicit default value
Returns:
value of string

cvs2i

public static int cvs2i(java.lang.String str)
cvs2i() - convert String to int
Parameters:
str - is the string to convert to a number
Returns:
value of string

cvs2i

public static int cvs2i(java.lang.String str,
                        int defVal)
cvs2i() - convert String to int
Parameters:
str - is the string to convert to a number
defVal - is the explicit default value
Returns:
value of string

cvs2long

public static long cvs2long(java.lang.String str)
cvs2long() - convert String to int
Parameters:
str - is the string to convert to a number
Returns:
value of string

chkDirFinalSeparator

public static java.lang.String chkDirFinalSeparator(java.lang.String sPath,
                                                    java.lang.String fS)
chkDirFinalSeparator() - make dir path end in fileSeparator. Note: Mac Bug found and fixed by Jai Evans 10/12/00.
Parameters:
sPath - is the path to check
fS - is the file separator
Returns:
converted path

cvtUnderscores2Spaces

public static java.lang.String cvtUnderscores2Spaces(java.lang.String sInput)
cvtUnderscores2Spaces() - change underscores to spaces
Parameters:
sInput - is the input string
Returns:
converted path

cvtSpacesToUnderscores

static java.lang.String cvtSpacesToUnderscores(java.lang.String str)
cvtSpacesToUnderscores() - replace spaces and other illegal file name characters with '_' chars to make file names highly portable.
      : space( ) ; " { } < > = , ? \ / % * ! @ & | ' ` \t
 
Parameters:
str - to be converted
Returns:
converted string

cvtValueToStars

static java.lang.String cvtValueToStars(float val,
                                        float valMax,
                                        int maxStars,
                                        boolean rightFillFlag)
cvtValueToStars() - cvt val in[0:valMax] to "****"+" " string where the maximum # of stars for v==vMax is specified. The rest of the string is filled with spaces. maxStars is clipped at 30.
Parameters:
val - is value to be converted to starts
valMax - is maximum value expected
maxStars - is max # of stars to use for largest value
rightFillFlag - if true will right fill the string with spaces
Returns:
list of "*********"

copyFile

public boolean copyFile(java.lang.String srcName,
                        java.lang.String dstName,
                        java.lang.String optUpdateMsg,
                        int optEstInputFileLth)
copyFile() - binary copy of one file or URL toa local file
Parameters:
srcName - is either a full path local file name or a http:// prefixed URL string of the source file.
dstName - is the full path of the local destination file name
optUpdateMsg - (opt) will display message in showMsg() and increasing ... in showMsg2(). One '.' for every 10K bytes read. This only is used when reading a URL. Set to null if not used.
optEstInputFileLth - is the estimate size of the input file if known else 0. Used in progress bar.
Returns:
true if succeed.

readBytesFromURL

public byte[] readBytesFromURL(java.lang.String srcName,
                               java.lang.String optUpdateMsg)
readBytesFromURL() - read binary data from URL
Parameters:
srcName - is either a full path local file name or a http:// prefixed URL string of the source file.
optUpdateMsg - (opt) will display message in showMsg() and increasing ... in showMsg2(). One '.' for every 10K bytes read. This only is used when reading a URL. Set to null if not used.
Returns:
a byte[] if succeed, else null.

deleteLocalFile

public boolean deleteLocalFile(java.lang.String fileName)
deleteLocalFile() - delete local file.
Returns:
false if failed..

updateProtPlotJarFile

final boolean updateProtPlotJarFile()
updateProtPlotJarFile() - update ProtPlot.jar into program install area.
 [1] Define directory for ProtPlot.jar path and other file and URL names.
 [2] Backup the old ProtPlot.jar as ProtPlot.jar.bkup
 [3] Open the url: from tmapJarURL. This is hardwired to be
         "http://TMAP.sourceforge.net/ProtPlot.jar"
     and read the file from the Web into local file "ProtPlot.jar.tmp"
 [4] Move the "ProtPlot.jar.tmp" file into "ProtPlot.jar" in the program 
     directory

 Since changing the ProtPlot.jar file is a potential security risk,
 we make this procedure final and hardwire the maeJarURL!
Returns:
true if succeed
See Also:
copyFile(java.lang.String, java.lang.String, java.lang.String, int), deleteLocalFile(java.lang.String)

updateProtPlotProgram

boolean updateProtPlotProgram()
updateProtPlotProgram() - verify that want to update the ProtPlot.jar file from the maexplorer.sourceforge.net server.
Returns:
true if succeed

updateProtPlotPRPfile

final boolean updateProtPlotPRPfile(int n,
                                    java.lang.String prpFname)
updateProtPlotPRPfile() - update ProtPlot PRP/*.prp files into PRP/ install area.
 [1] Define directory for PRP/*.prp path and other file and URL names.
 [2] Backup the old PRP/*.prp files as PRP.*.prp.bkup
 [3] Open the url: from tmapJarURL. This is hardwired to be
         "http://---homepage---/TMAP/PRP/xxx.prp"
     and read the file from the Web into local file "PRP/xxx.prp.tmp"
 [4] Move the "PRP/xxx.prp.tmp" file into "PRP/xxx.prp" in the program
     directory

 Since changing the PRP/* files is a potential security risk,
 we make this procedure final and hardwire the maeJarURL!
Parameters:
n - is the nth file being update
prpFname - is the name of the .prp file to update
Returns:
true if succeed
See Also:
copyFile(java.lang.String, java.lang.String, java.lang.String, int), deleteLocalFile(java.lang.String)

updateProtPlotPRPdatabase

boolean updateProtPlotPRPdatabase()
updateProtPlotPRPdatabase() - verify that want to update PRP/*.prp files from the current server.
 First read the server PRPdir.txt file which is a list of all .prp files
 in PRP/ created when TMAP is updated using
    (cd PRP/; ls -1c *.prp | sort > ../PRPdir.txt; cd ..)
Returns:
true if succeed

isNameInList

public static boolean isNameInList(java.lang.String[] sList,
                                   java.lang.String s)
isNameInList() - test if String s is in a list of strings sList[].
Parameters:
sList - is the array of strings to test
s - is the string to test if it is in sList
Returns:
true if s is in sList[]

sleepMsec

public static void sleepMsec(int sleepMsec)
sleepMsec() - sleep nMsec where nMsec must be >= 0 milliseconds.
Parameters:
sleepMsec - # of milliseconds to sleep

bubbleSortIndex

static int[] bubbleSortIndex(float[] data,
                             int len,
                             boolean ascending)
bubbleSortIndex() - sort copy of float[0:len-1] data with bubble sort, return index[].
Parameters:
len - size of subarray array of data to be sorted [0:len-1]
ascending - sort if true
Returns:
the index[] of the sorted data

bubbleSortIndex

static int[] bubbleSortIndex(java.lang.String[] data,
                             int len,
                             boolean ascending,
                             boolean ignoreCaseFlag)
bubbleSortIndex() - sort copy of String[0:len-1] data with bubble sort, return index[]. Do NOT actually sort the original data[].
Parameters:
data - array of data to be sorted
len - size of subarray array of data to be sorted [0:len-1]
ascending - sort assending if true
ignoreCaseFlag - sort by case as well
Returns:
the index[] of the sorted data

readState

public java.util.Hashtable readState(java.lang.String stateFile)
readState() - read the ProtPlot State file stateFile
Parameters:
stateFile - is the name of the ProtPlot state file
Returns:
hashtable of the state else null if not found.

getStateStr

public java.lang.String getStateStr()
getStateStr() - generate a tab-delim ProtPlot State string The format is tab-delimted (name \t value \n) with one entry/line.
Returns:
the state string

writeState

public boolean writeState(java.lang.String stateFile)
writeState() - write the ProtPlot State into stateFile in the same directory that the project is in. The format is tab-delimted (name \t value \n) with one entry/line.
Parameters:
stateFile - is the name of the ProtPlot state file
Returns:
true if successful

getHelpBaseURL

public java.lang.String getHelpBaseURL()
getHelpBaseURL() - get the base URL for HELP based on prp.useLocalDocFlag It will either be the ProtPlot server or the /Doc/ directory

dateStr

static java.lang.String dateStr()
dateStr() - return a new Date string of the current day and time
Returns:
a new Date string of the current day and time

nextZoomMag

public static int nextZoomMag(int val,
                              int maxVal)
nextZoomMag() - modulo 1X, 2X, 5X, 10X, 20X, 30X, 40X, 50X,
Parameters:
val - is the value to use in computing next zoom value mod maxVal
maxVal - is the maximum value to use
is - the next zoom value, else 1 if failed

saveNamedProteinSet

boolean saveNamedProteinSet(java.lang.String protSetName,
                            java.lang.String srcSetName)
saveNamedProteinSet() - save the named protein set as a "Set/*.set" file.
Parameters:
protSetName - is name of the protein save set
srcSetName - is the source set "Cluster" or "Filter"
Returns:
true if succeed

readNamedProteinSet

boolean readNamedProteinSet(java.lang.String protSetName,
                            java.lang.String destSetName)
readNamedProteinSet() - read named protein set file and save it Cluster or Filter Save list. It reads it in from the "Set/*.set"file.
Parameters:
protSetName - is name of the protein save set
destSetName - is the destination set "Cluster" or "Filter"
Returns:
true if succeed

getNextStrNameValFromLine

boolean getNextStrNameValFromLine(java.util.StringTokenizer parser)
getNextStrNameValFromLine() - get next line and parse 'name=value\n'. Return false if EOF. If fail, return null. The (parseName, parseValue, parseDelimChar) is saved in the global instance.
Parameters:
parser - is the string tokenizer
Returns:
true succeed

getStrValFromLine

java.lang.String getStrValFromLine(java.lang.String key,
                                   java.util.StringTokenizer parser)
getStrValFromLine() - get line and parse value for key 'name=value\n'. If parser is not null, get data from parser else use global values for next (parseName,parseValue) data. The (parseName, parseValue, parseDelimChar) is saved in the global instance so it can be reparsed if need be.
Parameters:
key - is the key to use
parser - is the string tokenizer
Returns:
parseValue. If fail, return null.
See Also:
getNextStrNameValFromLine(java.util.StringTokenizer)

getStrValFromLine

java.lang.String getStrValFromLine(java.lang.String key)
getStrValFromLine() - parse value for key 'name=value\n'. Use global values for next (parseName,parseValue) data. The (parseName, parseValue, parseDelimChar) was saved in the global instance so it can be reparsed if need be.
Parameters:
key - is the key to use
Returns:
parseValue. If fail, return null.

getIntValFromLine

int getIntValFromLine(java.lang.String key,
                      java.util.StringTokenizer parser)
getIntValFromLine() - get next line and parse value for key 'name='.
Parameters:
key - is the key to use
parser - is the string tokenizer
Returns:
int value, else 0.
See Also:
getStrValFromLine(java.lang.String, java.util.StringTokenizer)

getLongValFromLine

long getLongValFromLine(java.lang.String key,
                        java.util.StringTokenizer parser)
getLongValFromLine() - get next line and parse value for key 'name='.
Parameters:
key - is the key to use
parser - is the string tokenizer
Returns:
long value, else 0.
See Also:
getStrValFromLine(java.lang.String, java.util.StringTokenizer)

getFloatValFromLine

float getFloatValFromLine(java.lang.String key,
                          java.util.StringTokenizer parser)
getFloatValFromLine() - get next line and parse value for key 'name='.
Parameters:
key - is the key to use
parser - is the string tokenizer
Returns:
float value.
See Also:
getStrValFromLine(java.lang.String, java.util.StringTokenizer)

getNextInt

int getNextInt(java.util.StringTokenizer parser)
getNextInt() - parse next int from StringTokenizer the integers are separated by ',' or '\n'. Return int.