org.emboss.jemboss.parser
Class ParseAcd

java.lang.Object
  extended byorg.emboss.jemboss.parser.ParseAcd

public class ParseAcd
extends java.lang.Object

ACD (Ajax command line definition) file parser.


Field Summary
private  java.lang.String attr
          parameter data type
private  Dependent[] dep
          array of dependent variables
private  java.lang.String groupList
          String of the groups application belongs to
private  boolean isPrimaryGp
          true if primary group is defined
private  boolean isSecondaryGp
          true if secondary group is defined
private  java.util.Vector listdefault
          default for list or select data type
private  int mlist
          number of list & selection fields - multiple selection
private  int nbool
          number of checkbox fields
private  int nflist
          number of filelist fields
private  int nfloat
          number of float fields
private  int nint
          number of integer fields
private  int nlist
          number of list & selection fields - single selection
private  int nrange
          number of range fields
private  int nsection
          number of sections
private  int nseqs
          number of sequence fields
private  int nsubsection
          number of subsections
private  int ntextf
          number of text fields
private  int numOfDependents
          number of dependent variables
private  int numofFields
          number of ACD fields
private  int numofParams
          number of parameters in a field
private  double nvalue
          double value of a parameter
private  java.lang.String primaryGp
          primary group
private  java.lang.String secondaryGp
          secondary group
private  java.lang.String svalue
          string value of a parameter
private  java.util.Vector vappF
          vector containing the application fields
 
Constructor Summary
ParseAcd(java.lang.String acdText, boolean groups)
          The constructor takes the ACD as a string.
 
Method Summary
protected  java.lang.String formatHelpText(java.lang.String help)
          Limits the length of the line for the help text used in the tool tips.
 double getDefaultParamValueDbl(int field)
          Return a double default parameter
 java.lang.String getDefaultParamValueStr(int field)
          Gets a String default parameter.
 Dependent[] getDependents()
          Gets the dependents associated with the ACD.
 java.lang.String getExpectedCPU()
          Finds any expected cpu level indicator (low, medium, high)
 int getGuiHandleNumber(int field)
          Gets the handle for a gui component on the Jemboss form.
 java.lang.String getHelpParamValue(int field)
          Finds the help parameter in an ACD field.
 java.lang.String getInfoParamValue(int field)
          Finds the prompt, info or help parameter in an ACD field, in that order.
 java.lang.String[] getList(int field)
          Used for a list data type to put the list items in a String array.
 java.lang.String getListLabel(int field, int index)
          For a list data type determine the appropriate String entry.
 java.util.Vector getListOrSelectDefault()
          Use this after getList or getSelect to retrieve default
 java.lang.String getMaxParam(int field)
          Locates the max parameter in a field and returns it as a String.
 java.lang.String getMinParam(int field)
          Locates the min parameter in a field and returns it as a String.
 int getNumBool()
          Gets the number of boolean data types in the ACD.
 int getNumFileList()
          Gets the number of filelist data types in the ACD
 int getNumList()
          Gets the number of list & selection data types in the ACD, using single list selection
 int getNumMList()
          Gets the number of list & selection data types in the ACD, using multiple list selection
 int getNumNfloat()
          Gets the number of float data types in the ACD.
 int getNumNint()
          Gets the number of int data types in the ACD.
 int getNumOfDependents()
          Gets the number of dependent parameters in the ACD.
 int getNumofFields()
          Gets the number of fields in the ACD file.
 int getNumofParams(int field)
          Gets the number of parameters in a ACD field.
 int getNumRange()
           
 int getNumSection()
          Gets the number of sections in the ACD
 int getNumSeq()
          Gets the number of seqset, seqall & sequence data types in the ACD
 int getNumSubsection()
          Gets the number of nested sections in the ACD
 int getNumTextf()
          Gets the number of float, string, seqout, outfile, infile, regexp, codon & featout data types in the ACD.
 java.lang.String getOutputSequenceFile(int field)
          Gets the name of the output sequence field (seqout).
 java.lang.String getParameterAttribute(int field, int param)
          Get a specified parameter attribute.
 double getParamValueDbl(int field, int param)
          Gets the double value of a parameter.
 java.lang.String getParamValueStr(int field, int param)
          Gets the String value of a parameter.
 java.lang.String[] getSelect(int field)
          Used for a selection type to put the list items in a String array.
 boolean isBatchable()
          Finds if the program is identifies as being able to run in a batch queue
 boolean isDefaultParamValueStr(int field)
          Determine if there is a default parameter in a field of the ACD.
 boolean isDependents(java.lang.String attr, int field, int numofFields)
          Always start by calling isDependents(), which calculates the number of dependents and construct the Dependent array.
 boolean isMaxParamValue(int field)
          Determine if there is a max parameter in a field of the ACD.
 boolean isMinParamValue(int field)
          Determine if there is a min parameter in a field of the ACD.
 boolean isOptionalParam()
          Determine if there is a optional parameter in any field of the ACD.
 boolean isOptionalParamValue(int field)
          Determine if there is a optional parameter in a field of the ACD.
 boolean isOutputFile(int field)
          Determine if a field is data type outfile.
 boolean isOutputGraph(int field)
          Determine if a field is data type graph or xygraph.
 boolean isOutputSequence(int field)
          Determine if data type of a field is seqout.
 boolean isParamValueStr(int field, int param)
          Determine if the value of the parameter is a String.
 int parseParam(java.io.BufferedReader in, java.io.StreamTokenizer st)
          Parses a parameter in a ACD field
private  java.lang.String resolveVariables(java.util.Vector variables, java.lang.String svalue)
          Used to replace the "variable:" or "var:" shorthand notation in the ACD to the full expression it represent
private  void setGuiHandleNumber(java.lang.String dataType, ApplicationFields appF)
          Sets the gui handle depending on the data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numofFields

private int numofFields
number of ACD fields


numofParams

private int numofParams
number of parameters in a field


vappF

private java.util.Vector vappF
vector containing the application fields


svalue

private java.lang.String svalue
string value of a parameter


nvalue

private double nvalue
double value of a parameter


attr

private java.lang.String attr
parameter data type


dep

private Dependent[] dep
array of dependent variables


numOfDependents

private int numOfDependents
number of dependent variables


groupList

private java.lang.String groupList
String of the groups application belongs to


nsection

private int nsection
number of sections


nsubsection

private int nsubsection
number of subsections


ntextf

private int ntextf
number of text fields


nint

private int nint
number of integer fields


nfloat

private int nfloat
number of float fields


nbool

private int nbool
number of checkbox fields


nseqs

private int nseqs
number of sequence fields


nflist

private int nflist
number of filelist fields


nlist

private int nlist
number of list & selection fields - single selection


mlist

private int mlist
number of list & selection fields - multiple selection


nrange

private int nrange
number of range fields


listdefault

private java.util.Vector listdefault
default for list or select data type


isPrimaryGp

private boolean isPrimaryGp
true if primary group is defined


isSecondaryGp

private boolean isSecondaryGp
true if secondary group is defined


primaryGp

private java.lang.String primaryGp
primary group


secondaryGp

private java.lang.String secondaryGp
secondary group

Constructor Detail

ParseAcd

public ParseAcd(java.lang.String acdText,
                boolean groups)
The constructor takes the ACD as a string.

Parameters:
acdText - String representation of the ACD file
groups - boolean determing whether just to retieve the groups
Method Detail

resolveVariables

private java.lang.String resolveVariables(java.util.Vector variables,
                                          java.lang.String svalue)
Used to replace the "variable:" or "var:" shorthand notation in the ACD to the full expression it represent

Parameters:
variables - ApplicationFields of var ACD fields
svalue - value to be resolved if necessary

getGuiHandleNumber

public int getGuiHandleNumber(int field)
Gets the handle for a gui component on the Jemboss form.

Parameters:
field - field number in the ACD file
Returns:
handle integer.

getNumTextf

public int getNumTextf()
Gets the number of float, string, seqout, outfile, infile, regexp, codon & featout data types in the ACD. These make up the number of JTextAreas in the Jemboss form.

Returns:
number of TextArea's in the Jemboss form.

getNumNint

public int getNumNint()
Gets the number of int data types in the ACD.

Returns:
number of TextFieldInt in the Jemboss form.

getNumNfloat

public int getNumNfloat()
Gets the number of float data types in the ACD.

Returns:
number of TextFieldFloat in the Jemboss form.

getNumBool

public int getNumBool()
Gets the number of boolean data types in the ACD.

Returns:
number of check boxes in the Jemboss form.

getNumSeq

public int getNumSeq()
Gets the number of seqset, seqall & sequence data types in the ACD

Returns:
number of sequence inputs in the Jemboss form.

getNumFileList

public int getNumFileList()
Gets the number of filelist data types in the ACD

Returns:
number of file lists in the Jemboss form.

getNumList

public int getNumList()
Gets the number of list & selection data types in the ACD, using single list selection

Returns:
number of selection lists in the Jemboss form.

getNumMList

public int getNumMList()
Gets the number of list & selection data types in the ACD, using multiple list selection

Returns:
number of selection lists in the Jemboss form.

getNumRange

public int getNumRange()
Returns:
number of range data types in the Jemboss form.

getNumSection

public int getNumSection()
Gets the number of sections in the ACD

Returns:
number of sections in the Jemboss form.

getNumSubsection

public int getNumSubsection()
Gets the number of nested sections in the ACD

Returns:
number of subsections in the Jemboss form.

getParameterAttribute

public java.lang.String getParameterAttribute(int field,
                                              int param)
Get a specified parameter attribute.

Parameters:
field - field number in the ACD file
param - parameter number in that field
Returns:
string of the value.

isParamValueStr

public boolean isParamValueStr(int field,
                               int param)
Determine if the value of the parameter is a String.

Returns:
true if the value of the parameter is a String.

getParamValueStr

public java.lang.String getParamValueStr(int field,
                                         int param)
Gets the String value of a parameter.

Returns:
String value of the parameter.

setGuiHandleNumber

private void setGuiHandleNumber(java.lang.String dataType,
                                ApplicationFields appF)
Sets the gui handle depending on the data type.

Parameters:
dataType - data type
appF - application field

getParamValueDbl

public double getParamValueDbl(int field,
                               int param)
Gets the double value of a parameter.

Returns:
double value of the parameter.

isDefaultParamValueStr

public boolean isDefaultParamValueStr(int field)
Determine if there is a default parameter in a field of the ACD.

Parameters:
field - field number
Returns:
true if the default parameter value is a String

getDefaultParamValueDbl

public double getDefaultParamValueDbl(int field)
Return a double default parameter

Parameters:
field - field number
Returns:
default parameter value as a double.

isDependents

public boolean isDependents(java.lang.String attr,
                            int field,
                            int numofFields)
Always start by calling isDependents(), which calculates the number of dependents and construct the Dependent array.

Parameters:
attr - String name of the attribute
field - field number
numofFields - total number of fields
Returns:
true if there are dependent parameters.

getDependents

public Dependent[] getDependents()
Gets the dependents associated with the ACD.

Returns:
the Dependent array for those fields with dependents

getNumOfDependents

public int getNumOfDependents()
Gets the number of dependent parameters in the ACD.

Returns:
number of Dependent making up the array

getMinParam

public java.lang.String getMinParam(int field)
Locates the min parameter in a field and returns it as a String.

Parameters:
field - field number
Returns:
minimum value defined in a field.

getMaxParam

public java.lang.String getMaxParam(int field)
Locates the max parameter in a field and returns it as a String.

Parameters:
field - field number
Returns:
maximum value defined in a field.

isMinParamValue

public boolean isMinParamValue(int field)
Determine if there is a min parameter in a field of the ACD.

Parameters:
field - field number
Returns:
true if there is a minimum value specified in a field.

isMaxParamValue

public boolean isMaxParamValue(int field)
Determine if there is a max parameter in a field of the ACD.

Parameters:
field - field number
Returns:
true if there is a maximum value specified in a field.

getInfoParamValue

public java.lang.String getInfoParamValue(int field)
Finds the prompt, info or help parameter in an ACD field, in that order.

Parameters:
field - field number
Returns:
information specified by the prompt parameter, if present else the information parameter or the help parameter.

getHelpParamValue

public java.lang.String getHelpParamValue(int field)
Finds the help parameter in an ACD field.

Parameters:
field - field number
Returns:
help parameter defined in a field or a blank String if not specified.

isBatchable

public boolean isBatchable()
Finds if the program is identifies as being able to run in a batch queue

Returns:
true if the program is suitable for putting in a batch queue

getExpectedCPU

public java.lang.String getExpectedCPU()
Finds any expected cpu level indicator (low, medium, high)

Returns:
cpu level indicator

formatHelpText

protected java.lang.String formatHelpText(java.lang.String help)
Limits the length of the line for the help text used in the tool tips.

Parameters:
help - help text
Returns:
formated help text.

isOptionalParamValue

public boolean isOptionalParamValue(int field)
Determine if there is a optional parameter in a field of the ACD.

Parameters:
field - field number
Returns:
true if this is an "optional" field.

isOutputSequence

public boolean isOutputSequence(int field)
Determine if data type of a field is seqout.

Parameters:
field - field number
Returns:
true if this is an "seqout" field.

getOutputSequenceFile

public java.lang.String getOutputSequenceFile(int field)
Gets the name of the output sequence field (seqout).

Parameters:
field - field number
Returns:
parameter name for the seqout data type.

isOutputGraph

public boolean isOutputGraph(int field)
Determine if a field is data type graph or xygraph.

Parameters:
field - field number
Returns:
true if the field is of "graph" or "xygraph" type.

isOutputFile

public boolean isOutputFile(int field)
Determine if a field is data type outfile.

Parameters:
field - field number
Returns:
true if the field is of "outfile" type.

getDefaultParamValueStr

public java.lang.String getDefaultParamValueStr(int field)
Gets a String default parameter.

Parameters:
field - field number
Returns:
default parameter for this field.

getList

public java.lang.String[] getList(int field)
Used for a list data type to put the list items in a String array.

Parameters:
field - field number
Returns:
String array representation of the list type.

getListLabel

public java.lang.String getListLabel(int field,
                                     int index)
For a list data type determine the appropriate String entry.

Parameters:
field - field number
index - index into the list
Returns:
String for that entry.

getSelect

public java.lang.String[] getSelect(int field)
Used for a selection type to put the list items in a String array.

Parameters:
field - field number
Returns:
String array representation of the select type.

getListOrSelectDefault

public java.util.Vector getListOrSelectDefault()
Use this after getList or getSelect to retrieve default

Returns:
default for list or select data type

isOptionalParam

public boolean isOptionalParam()
Determine if there is a optional parameter in any field of the ACD.


getNumofFields

public int getNumofFields()
Gets the number of fields in the ACD file.

Returns:
total number of fields in an ACD file

getNumofParams

public int getNumofParams(int field)
Gets the number of parameters in a ACD field.

Parameters:
field - field number
Returns:
number of parameters in the field.

parseParam

public int parseParam(java.io.BufferedReader in,
                      java.io.StreamTokenizer st)
               throws java.io.IOException
Parses a parameter in a ACD field

Parameters:
in - BufferedReader
st - tokenizer
Returns:
string tokenizer type or zero
Throws:
java.io.IOException