Class DPrintVisitor

java.lang.Object
com.singularsys.jep.PrintVisitor
com.singularsys.extensions.djep.DPrintVisitor
All Implemented Interfaces:
JepComponent, ParserVisitor, Serializable

public class DPrintVisitor extends PrintVisitor
An extension of PrintVisitor which will print the equations of a variable if required. The behaviours of this class is determined by two modes PRINT_PARTIAL_EQNS and PRINT_VARIABLE_EQNS. When a variable or partial derivative is encountered then its equation may be printed. By default equations for PartialDerivatives are printed but equations for normal derivatives are not. TODO might want to print eqn for y=sin(x) but not x=3
Author:
Rich Morris Created on 26-Feb-2004
See Also:
  • Field Details

  • Constructor Details

    • DPrintVisitor

      public DPrintVisitor()
  • Method Details

    • visit

      public Object visit(ASTVarNode node, Object data) throws JepException
      Prints the variable or its equation. Depends on the state of the flags and whether the variable has an equation.
      Specified by:
      visit in interface ParserVisitor
      Overrides:
      visit in class PrintVisitor
      Throws:
      JepException
    • testLeft

      public boolean testLeft(Operator top, Node lhs)
      Description copied from class: PrintVisitor
      Test if brackets are necessary around left-hand side.
      Overrides:
      testLeft in class PrintVisitor
      Parameters:
      top - The current operator being printed.
      lhs - The node on the left-hand side.
      Returns:
      True if a bracket is necessary, false otherwise.
    • testMid

      public boolean testMid(Operator top, Node rhs)
      Description copied from class: PrintVisitor
      Test if brackets are needed around a middle argument x + (y) + z
      Overrides:
      testMid in class PrintVisitor
      Parameters:
      top - The current operator being printed.
      rhs - The node in the middle of a chain.
      Returns:
      True if a bracket is necessary, false otherwise.
    • testRight

      public boolean testRight(Operator top, Node rhs)
      Description copied from class: PrintVisitor
      Tests if brackets are necessary around the RHS child of an operator.
      Overrides:
      testRight in class PrintVisitor
      Parameters:
      top - The operator.
      rhs - The right hand side node.
      Returns:
      True if brackets are necessary, false otherwise.