|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.functions.Function
public class Function
Represents a real-valued function of any number of real arguments. A Function
can only be created by a Parser
. This class has subclasses
Expression
, Function1
, Function2
, and Function3
,
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.
Parser.parseFunction(String, String, String[])
Field Summary | |
---|---|
protected vmm.functions.ProgFunction |
func
|
Method Summary | |
---|---|
int |
getArity()
Get the number of arguments required by this function. |
java.lang.String |
getName()
Get the name of the Function. |
void |
setName(java.lang.String name)
Change the name of this function. |
double |
value(double[] argumentValues)
Find the value of this function for a specified list of arguments. |
double |
value(double[] argumentValues,
EvalStack stack)
Find the value of this function for a specified list of arguments. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected vmm.functions.ProgFunction func
Method Detail |
---|
public java.lang.String getName()
Parser.parseFunction(String, String, String[])
that created this function. It can be null. A non-null name is really only
required if this Function is to be added to a Parser so that it can be used
in expressions that are parsed by that parser.
public void setName(java.lang.String name)
public int getArity()
public double value(double[] argumentValues)
argumentValues
- 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.
java.lang.IllegalArgumentException
- if the number of arguments is incorrect.public double value(double[] argumentValues, EvalStack stack)
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.stack
- a non-null EvalStack that will be used for computing the value of this Function
java.lang.IllegalArgumentException
- if the number of arguments is incorrect.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |