Class MapBasedPrinter

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class 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.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MapBasedPrinter()
      Constructs a map-based expression printer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addMapping​(java.lang.Enum<?> op, java.lang.String[] sign)
      Adds a mapping between the operation identifier and the operation description.
      protected void addMapping​(java.lang.Enum<?> op, java.lang.String[] sign, boolean addSpaces)
      Adds a mapping between the operation identifier and the operation description.
      protected void addMapping​(java.lang.Enum<?> op, java.lang.String[] sign, boolean addSpaces, int[] order)
      Adds a mapping between the operation identifier and the operation description.
      protected void addMapping​(java.lang.Enum<?> op, java.lang.String[] sign, int[] order)
      Adds a mapping between the operation identifier and the operation description.
      protected void addMapping​(java.lang.Enum<?> 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​(java.lang.Enum<?> 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​(java.lang.Enum<?> 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​(java.lang.Enum<?> op, java.lang.String sign, OperationDescription.Type type)
      Adds a mapping between the operation identifier and the operation description.
      protected void addMapping​(java.lang.Enum<?> op, java.lang.String sign, OperationDescription.Type type, boolean addSpaces)
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapBasedPrinter

        protected MapBasedPrinter()
        Constructs a map-based expression printer.
    • Method Detail

      • getOperationDescription

        protected OperationDescription getOperationDescription​(NodeOperation expr)
        Returns operation description for the specified operation expression.
        Parameters:
        expr - Operation expression.
        Returns:
        OperationDescription object or null if the operation is not registered.
      • setVisitor

        protected void setVisitor​(MapBasedPrinter.ExprTreeVisitor visitor)
        Customizes printer behavior by setting a customized visitor.
        Parameters:
        visitor - Custom visitor implementation.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String prefix,
                                        java.lang.String[] infix,
                                        java.lang.String suffix)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        prefix - the operation prefix.
        infix - the operation infixes.
        suffix - the operation suffix.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> 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.
        Parameters:
        op - the operation identifier.
        prefix - the operation prefix.
        infix - the operation infixes.
        suffix - the operation suffix.
        order - the order of operands.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String prefix,
                                        java.lang.String infix,
                                        java.lang.String suffix)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        prefix - the operation prefix.
        infix - the operation infix.
        suffix - the operation suffix.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String sign,
                                        OperationDescription.Type type,
                                        boolean addSpaces)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        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.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String sign,
                                        OperationDescription.Type type)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        sign - the operation sign.
        type - the operation type.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String[] sign,
                                        boolean addSpaces,
                                        int[] order)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        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.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String[] sign,
                                        boolean addSpaces)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        sign - the operation signs.
        addSpaces - the flag indicating whether spaces before and after the operation sign are required.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String[] sign,
                                        int[] order)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        sign - the operation signs.
        order - the order of operands.
      • addMapping

        protected final void addMapping​(java.lang.Enum<?> op,
                                        java.lang.String[] sign)
        Adds a mapping between the operation identifier and the operation description.
        Parameters:
        op - the operation identifier.
        sign - the operation signs.
      • toString

        public final java.lang.String toString​(Node node)
        Description copied from interface: ExprTreePrinter
        Returns the string representation of the given expression tree.
        Specified by:
        toString in interface ExprTreePrinter
        Parameters:
        node - the expression tree to be printed.
        Returns:
        the string representation of the expression tree.