Class IfDiffRule

  • All Implemented Interfaces:
    DiffRulesI, JepComponent, java.io.Serializable

    public class IfDiffRule
    extends java.lang.Object
    implements DiffRulesI
    Differentiates functions like if(cond,trueExpr,falseExpr) where the first argument should not be differentiated, but subsequent ones should be.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      IfDiffRule​(Jep jep, java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Node differentiate​(ASTFunNode node, java.lang.String var, Node[] children, Node[] dchildren)
      Returns the top node of of the derivative of this function wrt to variable var.
      JepComponent getLightWeightInstance()
      Gets a light-weight instance suitable for using in multiple threads.
      java.lang.String getName()
      Returns the name of the function.
      void init​(Jep jep)
      Initialize the component.
      java.lang.String toString()
      Returns a string representation of the rule.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IfDiffRule

        public IfDiffRule​(Jep jep,
                          java.lang.String name)
    • Method Detail

      • init

        public void init​(Jep jep)
        Description copied from interface: JepComponent
        Initialize the component. This methods 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 an new instance, null or 'this'.
      • differentiate

        public Node differentiate​(ASTFunNode node,
                                  java.lang.String var,
                                  Node[] children,
                                  Node[] dchildren)
                           throws ParseException,
                                  JepException
        Description copied from interface: DiffRulesI
        Returns the top node of of the derivative of this function wrt to variable var.
        Specified by:
        differentiate in interface DiffRulesI
        var - The name of variable to differentiate wrt to.
        children - the arguments of the function
        dchildren - the derivatives of each argument of the function.
        Returns:
        top node of and expression tree for the derivative.
        Throws:
        ParseException - if there is some problem in compiling the derivative.
        JepException
      • getName

        public java.lang.String getName()
        Description copied from interface: DiffRulesI
        Returns the name of the function. Used as index in hashtable and as way of linking with standard Jep functions. You probably want to specify the in the constructors.
        Specified by:
        getName in interface DiffRulesI
      • toString

        public java.lang.String toString()
        Description copied from interface: DiffRulesI
        Returns a string representation of the rule.
        Specified by:
        toString in interface DiffRulesI
        Overrides:
        toString in class java.lang.Object