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 NaryFunction

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

All Implemented Interfaces:
  PostfixMathCommandI, java.io.Serializable

Direct Known Subclasses:
  Case, ConstantFunction, Mid, RoundSF, Substring, Switch, SwitchDefault

    public abstract class NaryFunction

extends PostfixMathCommand

Convenient base class for nary functions arbitrary backed by a binary operation. Defines an `Object eval(Object l,Object r)` method for calculating the result. The operation must be associative.

Author:
  Richard Morris
See Also:
  Serialized Form

Field Summary

Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
`curNumberOfParameters, name, NaN, numberOfParameters`

Constructor Summary
`NaryFunction()` Standard constructor where any number of arguments is allowed.
`NaryFunction(int nArgs)` Constructor where a fixed number of arguments is allowed

Method Summary
`abstract java.lang.Object` | `eval(java.lang.Object[] args)`
`void` | `run(java.util.Stack<java.lang.Object> stack)` Creates an array of object then calls `eval(Object[])`

Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
`asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, checkStack, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString`

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

Constructor Detail

### NaryFunction

    public NaryFunction()

  Standard constructor where any number of arguments is allowed. Use the PostfixMathCommand.checkNumberOfParameters(int) method to restrict the number of arguments allowed.

### NaryFunction

    public NaryFunction(int nArgs)

  Constructor where a fixed number of arguments is allowed

  Parameters:
    `nArgs` - number of arguments allowed

Method Detail

### run

    public void run(java.util.Stack<java.lang.Object> stack)
             throws EvaluationException

  Creates an array of object then calls `eval(Object[])`

  Throws:
    `EvaluationException`

### eval

    public abstract java.lang.Object eval(java.lang.Object[] args)
                                   throws EvaluationException

  Throws:
    `EvaluationException`

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

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