vmm3d.functions
Class ComplexVariable
- java.lang.Object
-
- vmm3d.functions.ComplexVariable
-
public class ComplexVariable extends java.lang.ObjectA complex-valued variable. A ComplexVariable can be added to aParserso that it can be used in the defintion of functions and expressions that are parsed by that parser. It is possible to change the value of a variable with thesetVal(Complex)orsetVal(double, double)method, which will affect the value of any expressions and functions in which it is used.
-
-
Constructor Summary
Constructors Constructor and Description ComplexVariable(double re, double im)Create a ComplexVariable with a specified initial value and with name initially equal to null.ComplexVariable(java.lang.String name)Create a ComplexVariable with a specified name and initial value zero.ComplexVariable(java.lang.String name, double re, double im)Create a ComplexVariable with a specified name and initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetIm()Gets the imaginary part of the value of this variable.java.lang.StringgetName()Get the name of this variable.doublegetRe()Gets the real part of the value of this variable.ComplexgetVal()Returns the value of this variable as an object of type Complex.voidgetVal(Complex c)Gets the current value of this variable by storing the value in a pre-existing object of type Complex.voidsetName(java.lang.String name)Sets the name of this variable.voidsetVal(Complex c)Set the value of this variable.voidsetVal(double re, double im)Sets the value of this variable
-
-
-
Constructor Detail
-
ComplexVariable
public ComplexVariable(java.lang.String name, double re, double im)Create a ComplexVariable with a specified name and initial value.- Parameters:
name- the name of the variable. This can be null. If the variable is to be added to a Parser, then the name must be non-null and should be a legal identifier (starting with a letter and containing only letters, digits and the underscore character).re- the real part of the initial value of the variableim- the imaginary part of the initial value of the variable
-
ComplexVariable
public ComplexVariable(java.lang.String name)
Create a ComplexVariable with a specified name and initial value zero.
-
ComplexVariable
public ComplexVariable(double re, double im)Create a ComplexVariable with a specified initial value and with name initially equal to null.- Parameters:
re- the real part of the initial value of the variableim- the imaginary part of the initial value of the variable
-
-
Method Detail
-
getRe
public double getRe()
Gets the real part of the value of this variable.
-
getIm
public double getIm()
Gets the imaginary part of the value of this variable.
-
getVal
public Complex getVal()
Returns the value of this variable as an object of type Complex.
-
getVal
public void getVal(Complex c)
Gets the current value of this variable by storing the value in a pre-existing object of type Complex.- Parameters:
c- the object where the value will be stored. This must be non-null.
-
setVal
public void setVal(double re, double im)Sets the value of this variable- Parameters:
re- the new value of the real partim- the new value of the imaginary part
-
setVal
public void setVal(Complex c)
Set the value of this variable.- Parameters:
c- the new value of the variable. A null value is treated as zero.
-
getName
public java.lang.String getName()
Get the name of this variable. This can be null.
-
setName
public void setName(java.lang.String name)
Sets the name of this variable. The name should not be changed after the variable has been added to a Parser; even if the name is changed, the Parser will continue to use it under the name it had at the time it was added to the parser.
-
-
DMelt 3.0 © DataMelt by jWork.ORG