Interface PrintVisitor.PrintRulesI

All Superinterfaces:
Serializable
All Known Implementing Classes:
LatexTest.AbsRule, LatexTest.FracRule, LatexTest.FunctionWithOptionalBrackets, LatexTest.PowerRule, LatexTest.SqrtRule, MapPfmc, MapPfmc.MapEntryPfmc, ModifiedParserTest.SuffixElePrintRule, PrintVisitor.StdElePrintRule, PrintVisitor.StdListPrintRule, RangeOperator, TernaryOperator
Enclosing class:
PrintVisitor

public static interface PrintVisitor.PrintRulesI extends Serializable
This interface specifies the method needed to implement a special print rule. A special rule must implement the append method, which should call PrintVisitor.append(String) to add a string to the output, call PrintVisitor.printNoBrackets(Node) to print a node with no bracket call PrintVisitor.printBrackets(Node) to print a node surrounded by round brackets.

For example

        pv.addSpecialRule(Operator op,new PrintVisitor.PrintRulesI()
        {
        public void append(Node node, PrintVisitor pv) throws ParseException
                {
                        pv.append("[");
                        for(int i=0;i<node.jjtGetNumChildren();++i)
                        {
                                if(i>0) pv.append(",");
                                pv.visit(node.jjtGetChild(i));
                        }
                        pv.append("]");
                }});
 
Author:
Rich Morris Created on 21-Feb-2004
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The method called to append data for the rule.
  • Method Details

    • append

      void append(Node node, PrintVisitor pv) throws JepException
      The method called to append data for the rule.
      Parameters:
      node - the node to print
      pv - the PrintVisitor
      Throws:
      JepException - on error