public abstract class MapBasedPrinter extends java.lang.Object implements ExprTreePrinter
| Modifier and Type | Class and Description |
|---|---|
protected class |
MapBasedPrinter.ExprTreeVisitor
This class implements an expression tree visitor that prints an expression by using a map of
operation identifiers to operation descriptions.
|
| Modifier | Constructor and Description |
|---|---|
protected |
MapBasedPrinter()
Constructs a map-based expression printer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMapping(StandardOperation op,
java.lang.String[] sign)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String[] sign,
boolean addSpaces)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String[] sign,
boolean addSpaces,
int[] order)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String[] sign,
int[] order)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String sign,
OperationDescription.Type type)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String sign,
OperationDescription.Type type,
boolean addSpaces)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String prefix,
java.lang.String[] infix,
java.lang.String suffix)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String prefix,
java.lang.String[] infix,
java.lang.String suffix,
int[] order)
Adds a mapping between the operation identifier and the operation description.
|
protected void |
addMapping(StandardOperation op,
java.lang.String prefix,
java.lang.String infix,
java.lang.String suffix)
Adds a mapping between the operation identifier and the operation description.
|
protected OperationDescription |
getOperationDescription(NodeOperation expr)
Returns operation description for the specified operation expression.
|
protected void |
setVisitor(MapBasedPrinter.ExprTreeVisitor visitor)
Customizes printer behavior by setting a customized visitor.
|
java.lang.String |
toString(Node node)
Returns the string representation of the given expression tree.
|
protected MapBasedPrinter()
protected OperationDescription getOperationDescription(NodeOperation expr)
expr - Operation expression.OperationDescription object or null if the operation
is not registered.protected void setVisitor(MapBasedPrinter.ExprTreeVisitor visitor)
visitor - Custom visitor implementation.protected final void addMapping(StandardOperation op, java.lang.String prefix, java.lang.String[] infix, java.lang.String suffix)
op - the operation identifier.prefix - the operation prefix.infix - the operation infixes.suffix - the operation suffix.protected final void addMapping(StandardOperation op, java.lang.String prefix, java.lang.String[] infix, java.lang.String suffix, int[] order)
op - the operation identifier.prefix - the operation prefix.infix - the operation infixes.suffix - the operation suffix.order - the order of operands.protected final void addMapping(StandardOperation op, java.lang.String prefix, java.lang.String infix, java.lang.String suffix)
op - the operation identifier.prefix - the operation prefix.infix - the operation infix.suffix - the operation suffix.protected final void addMapping(StandardOperation op, java.lang.String sign, OperationDescription.Type type, boolean addSpaces)
op - the operation identifier.sign - the operation sign.type - the operation type.addSpaces - the flag indicating whether spaces before and after the operation sign are
required.protected final void addMapping(StandardOperation op, java.lang.String sign, OperationDescription.Type type)
op - the operation identifier.sign - the operation sign.type - the operation type.protected final void addMapping(StandardOperation op, java.lang.String[] sign, boolean addSpaces, int[] order)
op - the operation identifier.sign - the operation signs.addSpaces - the flag indicating whether spaces before and after the operation sign are
required.order - the order of operands.protected final void addMapping(StandardOperation op, java.lang.String[] sign, boolean addSpaces)
op - the operation identifier.sign - the operation signs.addSpaces - the flag indicating whether spaces before and after the operation sign are
required.protected final void addMapping(StandardOperation op, java.lang.String[] sign, int[] order)
op - the operation identifier.sign - the operation signs.order - the order of operands.protected final void addMapping(StandardOperation op, java.lang.String[] sign)
op - the operation identifier.sign - the operation signs.public final java.lang.String toString(Node node)
ExprTreePrintertoString in interface ExprTreePrinternode - the expression tree to be printed.