|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.nfunk.jep.function.PostfixMathCommand
org.lsmp.djep.xjep.function.SumType
public abstract class SumType
Base class for functions like Sum(x^2,x,1,10) which finds the sum of x^2 with x running from 1 to 10. The first argument should be an equation, the second argument is a variable name, the third argument is the min value, the forth is the max value and the fifth argument (if present, default 1) is the increment to use. Sub classes should implement the
public abstract Object evaluate(Object elements[]) throws ParseException;method, which is passed an array of the value
Field Summary | |
---|---|
protected java.lang.String |
name
The name of the function, use in error reporting. |
Fields inherited from class org.nfunk.jep.function.PostfixMathCommand |
---|
curNumberOfParameters, numberOfParameters |
Constructor Summary | |
---|---|
SumType()
|
|
SumType(java.lang.String funName)
|
Method Summary | |
---|---|
boolean |
checkNumberOfParameters(int n)
Checks the number of parameters of the function. |
java.lang.Object |
evaluate(Node node,
EvaluatorI pv)
Evaluates the operator in given context. |
java.lang.Object |
evaluate(Node node,
Variable var,
double min,
double max,
double inc,
EvaluatorI pv)
Evaluates the node by repeatibly setting the value of the variable from min to max, and calculating the value of the first argument. |
abstract java.lang.Object |
evaluate(java.lang.Object[] elements)
Evaluates the function given the set of y values. |
void |
run(java.util.Stack s)
run method. |
Methods inherited from class org.nfunk.jep.function.PostfixMathCommand |
---|
checkStack, getNumberOfParameters, setCurNumberOfParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
Constructor Detail |
---|
public SumType(java.lang.String funName)
public SumType()
Method Detail |
---|
public boolean checkNumberOfParameters(int n)
PostfixMathCommand
checkNumberOfParameters
in interface PostfixMathCommandI
checkNumberOfParameters
in class PostfixMathCommand
n
- number of parameters function will be called with.
public java.lang.Object evaluate(Node node, EvaluatorI pv) throws ParseException
evaluate
in interface CallbackEvaluationI
node
- The current nodepv
- The visitor, can be used evaluate the children
ParseException
public java.lang.Object evaluate(Node node, Variable var, double min, double max, double inc, EvaluatorI pv) throws ParseException
evaluate(Object[])
is more useful. If they do they should follow the pattern used here.
node
- var
- min
- max
- inc
- pv
-
ParseException
public abstract java.lang.Object evaluate(java.lang.Object[] elements) throws ParseException
elements
- the y values
ParseException
public void run(java.util.Stack s) throws ParseException
run
in interface PostfixMathCommandI
run
in class PostfixMathCommand
ParseException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |