org.grinvin.expr

Class ExpressionToString

Implemented Interfaces:
Expression.Visitor

public class ExpressionToString
extends java.lang.Object
implements Expression.Visitor

Visitor which converts an expression to a string.

Note: This class is not thread safe.

Method Summary

int
getStrength()
Return the strength of the resulting string.
String
getString()
Return the resulting string.
void
visitCompound(Compound compound)
void
visitIntegerLiteral(IntegerLiteral literal)
void
visitInvariant(Invariant invariant)

Method Details

getStrength

public int getStrength()
Return the strength of the resulting string. (Used to determine whether parentheses are needed.)

getString

public String getString()
Return the resulting string.

visitCompound

public void visitCompound(Compound compound)
Specified by:
visitCompound in interface Expression.Visitor

visitIntegerLiteral

public void visitIntegerLiteral(IntegerLiteral literal)
Specified by:
visitIntegerLiteral in interface Expression.Visitor

visitInvariant

public void visitInvariant(Invariant invariant)
Specified by:
visitInvariant in interface Expression.Visitor