vmm.functions
Class ComplexFunction

java.lang.Object
  extended by vmm.functions.ComplexFunction
Direct Known Subclasses:
ComplexExpression, ComplexFunction1, ComplexFunction2, ComplexFunction3

public class ComplexFunction
extends java.lang.Object

Represents a complex-valued function of any number of complex arguments. A ComplexFunction can only be created by a Parser. This class has subclasses ComplexExpression, ComplexFunction1, ComplexFunction2, and ComplexFunction3, that represent functions of zero, one, two, and three arguments; the subclasses exist only to provide more natural value() methods that take the expected number of arguments.

See Also:
Parser.parseComplexFunction(String, String, String[])

Field Summary
protected  vmm.functions.ProgFunction func
           
 
Method Summary
 int getArity()
          Gets the number of arguments that are required by this function.
 java.lang.String getName()
          Gets the name of this function.
 void setName(java.lang.String name)
          Changes the name of this function.
 Complex value(Complex[] argumentValues)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is unique to the current Thread, allowing evaluation in a thread-safe manner.
 Complex value(Complex[] argumentValues, EvalStack stack)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter.
 void value(Complex[] argumentValues, EvalStack stack, Complex answer)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter, and place the answer in an existing Complex object.
 Complex value(double... arg)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is unique to the current Thread, allowing evaluation in a thread-safe manner.
 Complex value(double[] argumentValues, EvalStack stack)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter.
 void value(double[] argumentValues, EvalStack stack, Complex answer)
          Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter, and place the answer in an existing Complex object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

func

protected vmm.functions.ProgFunction func
Method Detail

getName

public java.lang.String getName()
Gets the name of this function. The name is specified in Parser.parseComplexFunction(String, String, String[]) and can be null.


setName

public void setName(java.lang.String name)
Changes the name of this function. The name should not be changed after the function has been added to a Parser; if it is, the parser will still use the old name.


getArity

public int getArity()
Gets the number of arguments that are required by this function.


value

public Complex value(Complex[] argumentValues)
Finds the value of the function at a specified list of argument values, using an EvalStack that is unique to the current Thread, allowing evaluation in a thread-safe manner.

Parameters:
argumentValues - the values of the arguments. The length of this array must be the same as the number of arguments of the function. If the function has arrity zero, then the argumentValues array can be null. The Complex objects in this array must be non-null.

value

public Complex value(double... arg)
Finds the value of the function at a specified list of argument values, using an EvalStack that is unique to the current Thread, allowing evaluation in a thread-safe manner.

Parameters:
arg - the values of the arguments. The number of arguments passed must be equal to the arity of the function multiplied by two. The real numbers passed to this method are grouped into pairs to produce the complex arguements that are passed to the function.

value

public Complex value(Complex[] argumentValues,
                     EvalStack stack)
Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter.

Parameters:
argumentValues - the values of the arguments. The length of this array must be the same as the number of arguments of the function. If the function has arrity zero, then the argumentValues array can be null. The Complex objects in this array must be non-null.
stack - the EvalStack that is used for computing the value.

value

public Complex value(double[] argumentValues,
                     EvalStack stack)
Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter.

Parameters:
argumentValues - the values of the arguments. The length of the array must be equal to the arity of the function multiplied by two. The real numbers iin this array are grouped into pairs to produce the complex arguements that are passed to the function.
stack - the EvalStack that is used for computing the value.

value

public void value(Complex[] argumentValues,
                  EvalStack stack,
                  Complex answer)
Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter, and place the answer in an existing Complex object.

Parameters:
argumentValues - the values of the arguments. The length of this array must be the same as the number of arguments of the function. If the function has arrity zero, then the argumentValues array can be null. The Complex objects in this array must be non-null.
stack - the EvalStack that is used for computing the value.
answer - the non-null Complex object where the value will be placed

value

public void value(double[] argumentValues,
                  EvalStack stack,
                  Complex answer)
Finds the value of the function at a specified list of argument values, using an EvalStack that is passed as a parameter, and place the answer in an existing Complex object.

Parameters:
argumentValues - the values of the arguments. The length of the array must be equal to the arity of the function multiplied by two. The real numbers iin this array are grouped into pairs to produce the complex arguements that are passed to the function.
stack - the EvalStack that is used for computing the value.
answer - the non-null Complex object where the value will be placed