Class TerminalFunction

All Implemented Interfaces:
JepComponent, PostfixMathCommandI, Serializable

public class TerminalFunction extends UnaryFunction implements JepComponent
A terminal function constructed from an PostfixMathCommand. On evaluation the elements of stream are passed as arguments to the to the function.
jep.getFunctionTable().addFunction("vsum", new TerminalFunction(new Add()));
Since:
Jep 4.1, extensions 2.2
See Also:
  • Constructor Details

  • Method Details

    • init

      public void init(Jep jep)
      Description copied from interface: JepComponent
      Initialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.
      Specified by:
      init in interface JepComponent
      Parameters:
      jep - the current Jep instance
    • getLightWeightInstance

      public JepComponent getLightWeightInstance()
      Description copied from interface: JepComponent
      Gets a light-weight instance suitable for using in multiple threads.
      Specified by:
      getLightWeightInstance in interface JepComponent
      Returns:
      either a new instance, null or 'this'.
    • eval

      public Object eval(Object arg) throws EvaluationException
      Description copied from class: UnaryFunction
      Evaluate the function
      Specified by:
      eval in class UnaryFunction
      Parameters:
      arg - the single argument passed in
      Returns:
      the result of the function
      Throws:
      EvaluationException - on error
    • getInner

      public Object getInner()
    • getDescription

      public String getDescription()
      Description copied from class: PostfixMathCommand
      Return a description of the function from the properties file. The property name is the class name followed by ".description". The property is found using the JepMessages class, which can be configured to add additional properties files. If PostfixMathCommand.setDescription(String) has been called, return the description set by that method instead.
      Specified by:
      getDescription in interface PostfixMathCommandI
      Overrides:
      getDescription in class PostfixMathCommand
      Returns:
      the description of the function