vmm.core
Class ComplexVariableParam

java.lang.Object
  extended by vmm.core.Parameter
      extended by vmm.core.ComplexParam
          extended by vmm.core.ComplexVariableParam
Direct Known Subclasses:
ComplexVariableParamAnimateable

public class ComplexVariableParam
extends ComplexParam

A Complex-valued parameter whose value is also the value of a ComplexVariable, as defined in the class vmm.functions.ComplexVariable. When the value of the parameter is changed, the value of the variable is changed to match, and vice-versa. Parameters of this type are mostly for use in user-defined objects. The name of a ComplexVariableParam is shared with the associated variable and therefor should probably be of human-readable form, such as "a" or "b".


Constructor Summary
ComplexVariableParam()
          Creates a ComplexVariableParam that initially has no name and has value and default value equal to 0.
ComplexVariableParam(ComplexVariable v)
          Create a ComplexVariableParam that will share the value of the specified variable.
ComplexVariableParam(java.lang.String name, Complex initialValue)
          Create a VComplexariableParam with a specified name and initial value.
ComplexVariableParam(java.lang.String name, java.lang.String value)
          Create a ComplexVariableParam with a specified name and initial value, where the initial value is given as a string.
 
Method Summary
 java.lang.Object getValueObject()
          Get the value object of this parameter.
 ComplexVariable getVariable()
          Returns the non-null variable associated with this VariableParam.
 void setName(java.lang.String name)
          Sets the name of this parameter and of the associated variable.
 void setValueObject(java.lang.Object object)
          Sets the value of this parameter and of the associated variable.
 
Methods inherited from class vmm.core.ComplexParam
getDefaultValue, getMaximumValueForInput, getMinimumValueForInput, getValue, reset, setDefaultValue, setMaximumValueForInput, setMinimumValueForInput, setValue, setValueAndDefault, stringToValueObject, valueObjectToString
 
Methods inherited from class vmm.core.Parameter
createParameterInput, getDefaultValueAsString, getDefaultValueObject, getHint, getName, getOwner, getTitle, getValueAsString, reset, reset, setDefaultValueFromString, setDefaultValueObject, setOwner, setValueAndDefaultFromString, setValueFromString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplexVariableParam

public ComplexVariableParam()
Creates a ComplexVariableParam that initially has no name and has value and default value equal to 0.


ComplexVariableParam

public ComplexVariableParam(java.lang.String name,
                            Complex initialValue)
Create a VComplexariableParam with a specified name and initial value. A variable of the same name is created that will share the value of this parameter. The variable can be retrieved with the getVariable() method.

Parameters:
name - The name of the Parameter, which can be null but ordinarily should not be. The name also becomes the name of the associated variable.
initialValue - The initial value of the parameter. This also becomes its default value. A null value is treated as zero.

ComplexVariableParam

public ComplexVariableParam(java.lang.String name,
                            java.lang.String value)
                     throws java.lang.NumberFormatException
Create a ComplexVariableParam with a specified name and initial value, where the initial value is given as a string. A variable of the same name is created that will share the value of this parameter. The variable can be retrieved with the getVariable() method.

Parameters:
name - The name of the Parameter.
value - The initial value of the parameter, given as a constant expression that represents a legal value of type double. If this is not the case, a NumberFormatException is thrown. This also becomes its default value.
Throws:
java.lang.NumberFormatException

ComplexVariableParam

public ComplexVariableParam(ComplexVariable v)
Create a ComplexVariableParam that will share the value of the specified variable. The parameter's name and initial value are copied from the variable.

Parameters:
v - the non-null variable that will be associated with the VariableParam
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of this parameter and of the associated variable.

Overrides:
setName in class Parameter

setValueObject

public void setValueObject(java.lang.Object object)
Sets the value of this parameter and of the associated variable.

Overrides:
setValueObject in class Parameter
Parameters:
object - The new value of this parameter. The value is set without checking whether the value is of the correct type for this parameter. A type-cast error might result at some later time. Subclasses might override this method to guarantee that the object is of the correct type.

getValueObject

public java.lang.Object getValueObject()
Get the value object of this parameter. This is overriden here so that when the value object is requested, the value of the associated variable is checked. If the value of the variable is different from the value object, then the value object is first reset to match the variable's value. This makes it possible for the apparent values of the parameter and of the variable to be kept in sync when the variable's value is set using the variable's setVal method.

Overrides:
getValueObject in class Parameter

getVariable

public ComplexVariable getVariable()
Returns the non-null variable associated with this VariableParam.