Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep.functions
Class PostfixMathCommand

    java.lang.Object
      com.singularsys.jep.functions.PostfixMathCommand

All Implemented Interfaces:
  PostfixMathCommandI

Direct Known Subclasses:
  Abs, Add, ArcCosine, ArcCosineH, ArcSine, ArcSineH, ArcTangent, ArcTangent2, ArcTanH, Arg, Assign, BigDecAdd, BigDecDiv, BigDecMod, BigDecMul, BigDecNegate, BigDecPow, BigDecRelational, BigDecSub, Binomial, Ceil, Comparative, ComplexPFMC, Conjugate, Cosine, CosineH, Cross, Divide, Dot, Ele, Exp, ExtendedOperatorSet.Factorial, Floor, If, Imaginary, List, Logarithm, LogBase2, Logical, Modulus, Multiply, NaturalLogarithm, Not, Polar, Power, Random, Real, Round, Sine, SineH, SquareRoot, Str, Subtract, Sum, Tangent, TanH, UMinus

    public abstract class PostfixMathCommand

extends java.lang.Object
implements PostfixMathCommandI

Function classes extend this class. It is an implementation of the PostfixMathCommandI interface.

It includes a numberOfParameters member, that is checked when parsing the expression. This member should be initialized to an appropriate value for all classes extending this class. If an arbitrary number of parameters should be allowed, initialize this member to -1.

Field Summary
`protected int` | `curNumberOfParameters` Number of parameters to be used for the next run() invocation.
`protected int` | `numberOfParameters` Number of parameters a the function requires.

Constructor Summary
`PostfixMathCommand()` Creates a new PostfixMathCommand class.

Method Summary
`boolean` | `checkNumberOfParameters(int n)` Checks the number of parameters of the function.
`protected void` | `checkStack(java.util.Stack inStack)` Check whether the stack is not null, throw a EvaluationException if it is.
`int` | `getNumberOfParameters()` Return the required number of parameters.
`void` | `setCurNumberOfParameters(int n)` Sets the number of current number of parameters used in the next call of run().

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.singularsys.jep.PostfixMathCommandI
`run`

Field Detail

### numberOfParameters

    protected int numberOfParameters

  Number of parameters a the function requires. Initialize this value to -1 if any number of parameters should be allowed.

### curNumberOfParameters

    protected int curNumberOfParameters

  Number of parameters to be used for the next run() invocation. Applies only if the required umber of parameters is variable (numberOfParameters = -1).

Constructor Detail

### PostfixMathCommand

    public PostfixMathCommand()

  Creates a new PostfixMathCommand class.

Method Detail

### checkStack

    protected void checkStack(java.util.Stack inStack)
                       throws EvaluationException

  Check whether the stack is not null, throw a EvaluationException if it is.

  Throws:
    `EvaluationException`

### getNumberOfParameters

    public int getNumberOfParameters()

  Return the required number of parameters.

  Specified by:
    `getNumberOfParameters` in interface `PostfixMathCommandI`

### setCurNumberOfParameters

    public 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.

  Specified by:
    `setCurNumberOfParameters` in interface `PostfixMathCommandI`

### checkNumberOfParameters

    public boolean checkNumberOfParameters(int n)

  Checks the number of parameters of the function. Functions which set numberOfParameter=-1 should overload this method

  Specified by:
    `checkNumberOfParameters` in interface `PostfixMathCommandI`
  Parameters:
    `n` - number of parameters function will be called with.
  Returns:
    False if an illegal number of parameters is supplied, true otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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