Class ChainableBinaryFunctionSwapped

All Implemented Interfaces:
ChainedFunctionI, DirtyFunction, CallbackEvaluationI, JepComponent, PostfixMathCommandI, Serializable

public class ChainableBinaryFunctionSwapped extends AlternateFunctions implements ChainedFunctionI, DirtyFunction
Converts a BinaryFunction so it can be used in a chain or directly as binary function. If the number of arguments is 1, then the a ChainedBinaryFunction is used, otherwise the function is used normally.
See Also:
  • Constructor Details

    • ChainableBinaryFunctionSwapped

      public ChainableBinaryFunctionSwapped(BinaryFunction function)
  • Method Details

    • evaluate

      public Object evaluate(Node node, Evaluator pv) throws EvaluationException
      Description copied from interface: CallbackEvaluationI
      Performs some special evaluation on the node. This method has the responsibility for evaluating the children of the node, and it should generally call
       pv.eval(node.jjtGetChild(i))   
       
      for each child. The SymbolTable is not passed as an argument. This is because it is better practice to get and set variable values by using node.getVar().setValue() rather that through the SymbolTable with requires a hashtable lookup.
      Specified by:
      evaluate in interface CallbackEvaluationI
      Overrides:
      evaluate in class AlternateFunctions
      Parameters:
      node - The current node
      pv - The visitor, can be used evaluate the children
      Returns:
      the value after evaluation. This value will be passed to other functions higher up the node tree. The value can be any type including Double or Vector<Object>
      Throws:
      EvaluationException - if the calculation cannot be performed
      See Also:
    • apply

      public Object apply(Evaluator ev, Node node, Object arg) throws EvaluationException
      Description copied from interface: ChainedFunctionI
      Evaluate a chained function using an additional argument.
      Specified by:
      apply in interface ChainedFunctionI
      Parameters:
      ev - the evaluator
      node - top node of function
      arg - additional argument from previous element in the chain
      Returns:
      Throws:
      EvaluationException
    • 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
      Overrides:
      getLightWeightInstance in class AlternateFunctions
      Returns:
      either a new instance, null or 'this'.
    • 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 AlternateFunctions
      Returns:
      the description of the function
    • getRootFunction

      public BinaryFunction getRootFunction()
      Get the original binary function that is wrapped by this chainable function.
      Returns:
      the original binary function