public abstract class CustomFunction
extends java.lang.Object
CustomFunction fooFunc = new CustomFunction("foo") {
public double applyFunction(double value) {
return value*Math.E;
}
};
double varX=12d;
Calculable calc = new ExpressionBuilder("foo(x)").withCustomFunction(fooFunc).withVariable("x",varX).build();
assertTrue(calc.calculate() == Math.E * varX);
}
| Modifier | Constructor and Description |
|---|---|
protected |
CustomFunction(java.lang.String name)
create a new single value input CustomFunction with a set name
|
protected |
CustomFunction(java.lang.String name,
int argumentCount)
create a new single value input CustomFunction with a set name
|
| Modifier and Type | Method and Description |
|---|---|
abstract double |
applyFunction(double... args) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
protected CustomFunction(java.lang.String name)
throws InvalidCustomFunctionException
value - the name of the function (e.g. foo)InvalidCustomFunctionExceptionprotected CustomFunction(java.lang.String name,
int argumentCount)
throws InvalidCustomFunctionException
value - the name of the function (e.g. foo)InvalidCustomFunctionException