Package com.singularsys.extensions.djep
Class DPrintVisitor
java.lang.Object
com.singularsys.jep.PrintVisitor
com.singularsys.extensions.djep.DPrintVisitor
- All Implemented Interfaces:
JepComponent,ParserVisitor,Serializable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.PrintVisitor
PrintVisitor.NullPrintVisitor, PrintVisitor.PrintRulesI, PrintVisitor.StdElePrintRule, PrintVisitor.StdListPrintRule -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class com.singularsys.jep.PrintVisitor
COMPLEX_I, format, fp, FULL_BRACKET, FunctionArgSep, FunLBracket, FunRBracket, LBracket, mode, NULL_PRINT_VISITOR, ot, RBracket, sb, specialFunRules, specialRules, specialVarName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest if brackets are necessary around left-hand side.booleanTest if brackets are needed around a middle argumentx + (y) + zbooleanTests if brackets are necessary around the RHS child of an operator.visit(ASTVarNode node, Object data) Prints the variable or its equation.Methods inherited from class com.singularsys.jep.PrintVisitor
addSpecialRule, addSpecialRule, addSpecialVarName, append, formatValue, formatValue, getFunArgSep, getFunLBracket, getFunRBracket, getLBracket, getLightWeightInstance, getMaxLen, getMode, getMode, getRBracket, getSpecialFunRule, getSpecialRule, getSpecialVarName, init, print, print, printBrackets, println, println, printNoBrackets, printWrap, setFunArgSep, setFunLBracket, setFunRBracket, setLBracket, setMaxLen, setMode, setNumberFormat, setRBracket, toString, visit, visit, visit, visit, visitBinary, visitNaryBinary, visitUnary
-
Field Details
-
PRINT_PARTIAL_EQNS
public static final int PRINT_PARTIAL_EQNS- See Also:
-
PRINT_VARIABLE_EQNS
public static final int PRINT_VARIABLE_EQNS- See Also:
-
-
Constructor Details
-
DPrintVisitor
public DPrintVisitor()
-
-
Method Details
-
visit
Prints the variable or its equation. Depends on the state of the flags and whether the variable has an equation.- Specified by:
visitin interfaceParserVisitor- Overrides:
visitin classPrintVisitor- Throws:
JepException
-
testLeft
Description copied from class:PrintVisitorTest if brackets are necessary around left-hand side.- Overrides:
testLeftin classPrintVisitor- 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
Description copied from class:PrintVisitorTest if brackets are needed around a middle argumentx + (y) + z- Overrides:
testMidin classPrintVisitor- 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
Description copied from class:PrintVisitorTests if brackets are necessary around the RHS child of an operator.- Overrides:
testRightin classPrintVisitor- Parameters:
top- The operator.rhs- The right hand side node.- Returns:
- True if brackets are necessary, false otherwise.
-