|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.functions.ComplexVariable
public class ComplexVariable
A complex-valued variable. A ComplexVariable can be added to a Parser
so 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 the setVal(Complex)
or setVal(double, double)
method, which will
affect the value of any expressions and functions in which it is used.
Constructor Summary | |
---|---|
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 | |
---|---|
double |
getIm()
Gets the imaginary part of the value of this variable. |
java.lang.String |
getName()
Get the name of this variable. |
double |
getRe()
Gets the real part of the value of this variable. |
Complex |
getVal()
Returns the value of this variable as an object of type Complex. |
void |
getVal(Complex c)
Gets the current value of this variable by storing the value in a pre-existing object of type Complex. |
void |
setName(java.lang.String name)
Sets the name of this variable. |
void |
setVal(Complex c)
Set the value of this variable. |
void |
setVal(double re,
double im)
Sets the value of this variable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComplexVariable(java.lang.String name, double re, double im)
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 variablepublic ComplexVariable(java.lang.String name)
public ComplexVariable(double re, double im)
re
- the real part of the initial value of the variableim
- the imaginary part of the initial value of the variableMethod Detail |
---|
public double getRe()
public double getIm()
public Complex getVal()
public void getVal(Complex c)
c
- the object where the value will be stored. This must be non-null.public void setVal(double re, double im)
re
- the new value of the real partim
- the new value of the imaginary partpublic void setVal(Complex c)
c
- the new value of the variable. A null value is treated as zero.public java.lang.String getName()
public void setName(java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |