ex1
Class ParamDef

java.lang.Object
  extended byex1.ParamDef

public class ParamDef
extends java.lang.Object

This class is a generic parameter class, used for both the crops and operations which hols all information about a parameter except the data value.


Field Summary
 float addEnd
           
 java.lang.String altUnits
           
 java.util.ArrayList choices
           
 float factor
           
 java.lang.String name
           
 java.lang.String prompt
           
 java.lang.String units
           
 
Constructor Summary
ParamDef()
          Construct a new ParamDef class
 
Method Summary
 java.lang.String findChoiceString(int ind)
          Get the choice string associated with a specific value
 int findChoiceVal(java.lang.String ch)
          Get the value assigned to a specific choice list element
 java.lang.String getAltRevValue(java.lang.String pstr)
          This function converts a alternate value to its base value.
 java.lang.String getAltValue(java.lang.String pstr)
          This function converts a base value into an alternate (english) unit representation if the parameter has a factor field and an optional addEnd field.
 java.lang.String getPseudoVal()
          Get a very basic default value based on the field type
 int getType()
          Get the type of the parameter.
 void setType(int val)
          Set the type of the parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name

prompt

public java.lang.String prompt

units

public java.lang.String units

altUnits

public java.lang.String altUnits

factor

public float factor

addEnd

public float addEnd

choices

public java.util.ArrayList choices
Constructor Detail

ParamDef

public ParamDef()
Construct a new ParamDef class

Method Detail

getAltValue

public java.lang.String getAltValue(java.lang.String pstr)
This function converts a base value into an alternate (english) unit representation if the parameter has a factor field and an optional addEnd field. If the parameter does not have a factor field the original string is returned because no conversion is required.

Parameters:
pstr - String to convert to the alternate unit representation.

getAltRevValue

public java.lang.String getAltRevValue(java.lang.String pstr)
This function converts a alternate value to its base value. This would be called if the user changed a cell while in alternate (english) units so that the value saved is converted first if the parameter has a factor and/or an addEnd field. The steps are the reverse of those followed in getAltValue().

Parameters:
pstr - String to convert that may be in alternate units. If a parameter does not have an alternate unit representation setup the orginal string is returned (no conversion necessary).
Returns:
the value in base units

setType

public void setType(int val)
Set the type of the parameter

Parameters:
val - 0,1,2,3 for float, int , string, choice list

getType

public int getType()
Get the type of the parameter.

Returns:
the type of the parameter

findChoiceVal

public int findChoiceVal(java.lang.String ch)
Get the value assigned to a specific choice list element

Parameters:
ch - the choice string to find
Returns:
the value of the choice string or -1 if not found

findChoiceString

public java.lang.String findChoiceString(int ind)
Get the choice string associated with a specific value

Parameters:
ind - value to search for
Returns:
the choice string that has the value

getPseudoVal

public java.lang.String getPseudoVal()
Get a very basic default value based on the field type

Returns:
a default string base don type