csheets.core.formula.util
Class ExpressionTreePrinter

java.lang.Object
  extended by csheets.core.formula.util.AbstractExpressionVisitor
      extended by csheets.core.formula.util.ExpressionTreePrinter
All Implemented Interfaces:
ExpressionVisitor

public class ExpressionTreePrinter
extends AbstractExpressionVisitor

A class for printing expressions on multiple lines with indentation.

Author:
Einar Pehrson

Field Summary
static int INDENT_DISTANCE
          The number of spaces to use for each indentation unit
 
Constructor Summary
ExpressionTreePrinter()
          Creates a new expression printer.
 
Method Summary
 Object visitBinaryOperation(BinaryOperation operation)
          Visits the given binary expression.
 Object visitFunctionCall(FunctionCall call)
          Visits the given function call.
 Object visitLiteral(Literal literal)
          Visits the given literal.
 Object visitReference(Reference reference)
          Visits the given cell reference.
 Object visitUnaryOperation(UnaryOperation operation)
          Visits the given unary expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT_DISTANCE

public static final int INDENT_DISTANCE
The number of spaces to use for each indentation unit

See Also:
Constant Field Values
Constructor Detail

ExpressionTreePrinter

public ExpressionTreePrinter()
Creates a new expression printer.

Method Detail

visitLiteral

public Object visitLiteral(Literal literal)
Description copied from interface: ExpressionVisitor
Visits the given literal.

Specified by:
visitLiteral in interface ExpressionVisitor
Overrides:
visitLiteral in class AbstractExpressionVisitor
Parameters:
literal - the literal to visit
Returns:
an arbitrary object

visitUnaryOperation

public Object visitUnaryOperation(UnaryOperation operation)
Description copied from interface: ExpressionVisitor
Visits the given unary expression.

Specified by:
visitUnaryOperation in interface ExpressionVisitor
Overrides:
visitUnaryOperation in class AbstractExpressionVisitor
Parameters:
operation - the operation to visit
Returns:
an arbitrary object

visitBinaryOperation

public Object visitBinaryOperation(BinaryOperation operation)
Description copied from interface: ExpressionVisitor
Visits the given binary expression.

Specified by:
visitBinaryOperation in interface ExpressionVisitor
Overrides:
visitBinaryOperation in class AbstractExpressionVisitor
Parameters:
operation - the operation to visit
Returns:
an arbitrary object

visitReference

public Object visitReference(Reference reference)
Description copied from interface: ExpressionVisitor
Visits the given cell reference.

Specified by:
visitReference in interface ExpressionVisitor
Overrides:
visitReference in class AbstractExpressionVisitor
Parameters:
reference - the reference to visit
Returns:
an arbitrary object

visitFunctionCall

public Object visitFunctionCall(FunctionCall call)
Description copied from interface: ExpressionVisitor
Visits the given function call.

Specified by:
visitFunctionCall in interface ExpressionVisitor
Overrides:
visitFunctionCall in class AbstractExpressionVisitor
Parameters:
call - the function call to visit
Returns:
an arbitrary object