org.nfunk.jep.function
Interface PostfixMathCommandI

All Known Subinterfaces:
BinaryOperatorI, NaryOperatorI, UnaryOperatorI
All Known Implementing Classes:
Abs, Add, ArcCosine, ArcCosineH, ArcSine, ArcSineH, ArcTangent, ArcTangent2, ArcTanH, Arg, ArrayAccess, Assign, Binomial, Ceil, Comparative, ComplexPFMC, Conjugate, Cosine, CosineH, Cross, Define, Determinant, Diagonal, Diff, Divide, Dot, Ele, Ele, ElementComparative, ElementDivide, ElementMultiply, Eval, Exp, ExteriorProduct, Floor, FromBase, GAdd, GComparative, GDivide, GenMat, GetDiagonal, GList, GLogical, GMod, GMultiply, GNot, GPower, GSubtract, GUMinus, Id, If, Imaginary, Inverse, Length, List, Logarithm, Logical, MacroFunction, MAdd, MArrayAccess, MAssign, Max, MaxArg, MDiff, MDivide, MDot, MIf, Min, MinArg, MList, MMap, MMultiply, Modulus, MPower, MSubtract, MSum, Multiply, MUMinus, NaturalLogarithm, Not, Polar, PostfixMathCommand, Power, Product, Random, Range, Rank, Real, Round, Simpson, Sine, SineH, Size, Solve, SquareRoot, Str, Subtract, Sum, Sum, SumType, Tangent, TanH, ToBase, Trace, Transpose, Trapezium, UMinus, VEle, VList, VMap, VPower, VRange, VSum, XAssign

public interface PostfixMathCommandI

All function classes must implement this interface to ensure that the run() method is implemented.


Method Summary
 boolean checkNumberOfParameters(int n)
          Checks the number of parameters of the function.
 int getNumberOfParameters()
          Returns the number of required parameters, or -1 if any number of parameters is allowed.
 void run(java.util.Stack aStack)
          Run the function on the stack.
 void setCurNumberOfParameters(int n)
          Sets the number of current number of parameters used in the next call of run().
 

Method Detail

run

void run(java.util.Stack aStack)
         throws ParseException
Run the function on the stack. Pops the arguments from the stack, and pushes the result on the top of the stack.

Throws:
ParseException

getNumberOfParameters

int getNumberOfParameters()
Returns the number of required parameters, or -1 if any number of parameters is allowed.


setCurNumberOfParameters

void setCurNumberOfParameters(int n)
Sets the number of current number of parameters used in the next call of run(). This method is only called when the reqNumberOfParameters is -1.


checkNumberOfParameters

boolean checkNumberOfParameters(int n)
Checks the number of parameters of the function. This method is called during the parsing of the equation to check syntax. Functions which set numberOfParameter=-1 should overwrite this method.

Parameters:
n - number of parameters function will be called with.
Returns:
False if an illegal number of parameters is supplied, true otherwise.


http://www.singularsys.com/jep Copyright © 2007 Singular Systems