| java.lang.Object edu.hws.jcm.functions.FunctionParserExtension edu.hws.jcm.functions.WrapperFunction
WrapperFunction | public class WrapperFunction extends FunctionParserExtension (Code) | | A WrapperFunction contains another function and delegates to it
all calls to methods from the Function interface, except for calls
to setName() and getName(). (It maintains its own name, which can
be different from the name of the wrapped Function.) This has at least two
uses: A WrapperFunction is a FunctionParserExtension, so it can
be added to a parser and then used in expressions parsed in that
parser. Second, the function that is wrapped inside the WrapperFunction
object can be changed by a call to the setFunction() method.
This makes it possible to have a single function that can be used,
for example, in ValueMath objects and Graph1D's, whose definition
can be changed at will. Note that it is NOT legal to change the
arity of the function when calling the setFunction() method.
|
Constructor Summary | |
public | WrapperFunction(Function f) Create a WrapperFunction object containing a specified function. |
Method Summary | |
public void | apply(StackOfDouble stack, Cases cases) Evaluate the function applied to argument values popped from the stack,
and leave the result on the stack. | public boolean | dependsOn(Variable x) Return true if the definition of this function depends
in some way on the variable x. | public Function | derivative(int wrt) Return the derivative of the function with repect to
argument number wrt, where arguments are numbered starting from 1. | public Function | derivative(Variable x) Return the derivative of the function with respect to the
variable x (where x is NOT one of the parameters of the function). | public int | getArity() Return the number of arguments of this function. | public Function | getFunction() Return the function that is currently wrapped in this WrapperFunction. | public double | getVal(double[] arguments) Find the value of the function at the argument value
argument[0], .... | public double | getValueWithCases(double[] arguments, Cases cases) Find the value of the function at the argument values
argument[0],.... | public void | setFunction(Function f) Set the function that is contained in this WrapperFunction. |
WrapperFunction | public WrapperFunction(Function f)(Code) | | Create a WrapperFunction object containing a specified function.
Parameters: f - The non-null function that will be contained in the WrapperFunction. |
apply | public void apply(StackOfDouble stack, Cases cases)(Code) | | Evaluate the function applied to argument values popped from the stack,
and leave the result on the stack. This is not meant to be called
directly.
|
dependsOn | public boolean dependsOn(Variable x)(Code) | | Return true if the definition of this function depends
in some way on the variable x. (Note that the function does
NOT depend on the variables that are being used as its parameters!)
|
derivative | public Function derivative(int wrt)(Code) | | Return the derivative of the function with repect to
argument number wrt, where arguments are numbered starting from 1.
|
derivative | public Function derivative(Variable x)(Code) | | Return the derivative of the function with respect to the
variable x (where x is NOT one of the parameters of the function).
|
getArity | public int getArity()(Code) | | Return the number of arguments of this function.
|
getFunction | public Function getFunction()(Code) | | Return the function that is currently wrapped in this WrapperFunction.
|
getVal | public double getVal(double[] arguments)(Code) | | Find the value of the function at the argument value
argument[0], .... The number of arguments should match
the arity of the function.
|
getValueWithCases | public double getValueWithCases(double[] arguments, Cases cases)(Code) | | Find the value of the function at the argument values
argument[0],.... Information about "cases" is stored in
the Cases parameter, if it is non-null. See the Cases
class for more information.
|
setFunction | public void setFunction(Function f)(Code) | | Set the function that is contained in this WrapperFunction.
Parameters: f - The non-null function to be used in this WrapperFunction object.It must have the same arity as the current function. |
|
|