parameters
Class Parameter

java.lang.Object
  extended byparameters.Parameter

public class Parameter
extends java.lang.Object

This class holds the value of a given parameter, its upper and lower bounds, and whether it should vary linearly or logarithmically. To hold sets of parameters, use the ParameterSet class. To hold the current state of the model, use the Parameters class. Note that this class only works well after a model is loaded.


Field Summary
static int LINEAR
           
static int LOGARITHMIC
           
 float lowerBound
          The highest value this parameter can every have.
 java.lang.String name
          The name of this parameter.
static int NOT_SET
           
 float upperBound
          The lowest value this parameter can every have.
 float value
          The value of the parameter.
 int variationMode
          Can be either LINEAR or LOGARITHMIC
 
Constructor Summary
Parameter()
           
Parameter(Parameter p)
           
Parameter(java.lang.String n)
          This initializer is for use when reading from a file, where the creation of this Parameter object will happen after the parameter name is already known.
Parameter(java.lang.String n, float v, float u, float l, int vM)
           
 
Method Summary
 Parameter copy()
           
 java.lang.String getName()
           
 float getValue()
           
 int getVariationMode()
           
 void loadParameters(BetterTokenizer tokenizer)
          This loadParameters calls the other one with need_all = true
 void loadParameters(BetterTokenizer tokenizer, boolean need_all)
          This function is for loading parameters from a file.
 void setBounds(float l, float u)
           
 void setValue(float v)
           
 void setVariationMode(int v)
           
 void setVariationMode(java.lang.String mode)
           
 java.lang.String toString()
           
 java.lang.String toString(boolean printAll)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name
The name of this parameter. Needs to be the same as the name of a parameter in the currently loaded model


value

public float value
The value of the parameter.


upperBound

public float upperBound
The lowest value this parameter can every have.


lowerBound

public float lowerBound
The highest value this parameter can every have.


variationMode

public int variationMode
Can be either LINEAR or LOGARITHMIC


LINEAR

public static final int LINEAR
See Also:
Constant Field Values

LOGARITHMIC

public static final int LOGARITHMIC
See Also:
Constant Field Values

NOT_SET

public static final int NOT_SET
See Also:
Constant Field Values
Constructor Detail

Parameter

public Parameter()

Parameter

public Parameter(java.lang.String n)
This initializer is for use when reading from a file, where the creation of this Parameter object will happen after the parameter name is already known.


Parameter

public Parameter(java.lang.String n,
                 float v,
                 float u,
                 float l,
                 int vM)

Parameter

public Parameter(Parameter p)
Method Detail

copy

public Parameter copy()

loadParameters

public void loadParameters(BetterTokenizer tokenizer)
                    throws java.lang.Exception
This loadParameters calls the other one with need_all = true

Throws:
java.lang.Exception

loadParameters

public void loadParameters(BetterTokenizer tokenizer,
                           boolean need_all)
                    throws java.lang.Exception
This function is for loading parameters from a file. It assumes that the data comes in the form
value upper_bound lower_bound variation_mode
If need_all is false, then only the value of the parameter needs to be present in the file otherwise, the value and the bounds need to be present. This function always ignores the variation mode in the file and assumes its the same as what's stored in Affector Note - this function will throw an exception for any parameter whose name is not found in Affector - - so it won't work if a model isn't loaded, or if the wrong model is loaded. Not sure if this is a good idea... Note that you must set the name of the parameter before calling this (by using appropriate constructor, for instance). Thus this function assumes that all values have proper defaults already (or will when I convince myself that doesn't break anything).

Parameters:
need_all - true means value, min, and max all must be in file or exception thrown. false means only value needs to be there (but others are read if present).
Throws:
java.lang.Exception

toString

public java.lang.String toString()

toString

public java.lang.String toString(boolean printAll)

getValue

public float getValue()

setValue

public void setValue(float v)

setBounds

public void setBounds(float l,
                      float u)

setVariationMode

public void setVariationMode(int v)

setVariationMode

public void setVariationMode(java.lang.String mode)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getVariationMode

public int getVariationMode()

getName

public java.lang.String getName()