Class PrintTerm

java.lang.Object
de.uni_freiburg.informatik.ultimate.logic.PrintTerm

public class PrintTerm
extends java.lang.Object
This class converts a term into an Appendable (StringBuilder, OutputStreamWriter, etc). It is non-recursive to prevent stack overflow.
Author:
Jochen Hoenicke
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.ArrayDeque<java.lang.Object> mTodo  
  • Constructor Summary

    Constructors 
    Constructor Description
    PrintTerm()  
  • Method Summary

    Modifier and Type Method Description
    void append​(java.lang.Appendable appender, Sort sort)
    Convert a sort into an appendable.
    void append​(java.lang.Appendable appender, Term term)
    Convert a term into an appendable.
    void append​(java.lang.Appendable appender, java.lang.Object[] sexpr)
    Append an s-expression.
    static java.lang.String quoteIdentifier​(java.lang.String id)
    Ensure the identifier is SMTLIB 2 compliant.
    static java.lang.Object quoteObjectIfString​(java.lang.Object value)
    Ensure that object can be used as SMT-LIB 2 compliant identifier.
    java.lang.String toString()  
    protected void walkSort​(Sort sort)
    Walk over a sort and add its components to the todo queue.
    protected void walkTerm​(Term term)
    Walk over a term and add its components to the todo queue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • mTodo

      protected final java.util.ArrayDeque<java.lang.Object> mTodo
  • Constructor Details

  • Method Details

    • append

      public void append​(java.lang.Appendable appender, Term term)
      Convert a term into an appendable.
      Parameters:
      appender - The appendable.
      term - The term.
    • append

      public void append​(java.lang.Appendable appender, Sort sort)
      Convert a sort into an appendable. Note that sorts can get pretty long, too. Hence we do this non-recursively to prevent stack overflows.
      Parameters:
      appender - The appendable.
      sort - The sort.
    • append

      public void append​(java.lang.Appendable appender, java.lang.Object[] sexpr)
      Append an s-expression. The s-expression might contain terms.
      Parameters:
      appender - The appendable.
      sexpr - The s-expression.
    • quoteIdentifier

      public static java.lang.String quoteIdentifier​(java.lang.String id)
      Ensure the identifier is SMTLIB 2 compliant. If a symbol that is not allowed due to the SMTLIB 2 standard is encountered, the whole identifier will be quoted.
      Parameters:
      id - An unquoted identifier.
      Returns:
      SMTLIB 2 compliant identifier.
    • quoteObjectIfString

      public static java.lang.Object quoteObjectIfString​(java.lang.Object value)
      Ensure that object can be used as SMT-LIB 2 compliant identifier. otherwise the input is returned.
      Parameters:
      value - some object.
      Returns:
      quoted identifier if value is String, otherwise value (the input) is returned.
    • walkTerm

      protected void walkTerm​(Term term)
      Walk over a term and add its components to the todo queue.
      Parameters:
      term - the term.
    • walkSort

      protected void walkSort​(Sort sort)
      Walk over a sort and add its components to the todo queue.
      Parameters:
      sort - the sort.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object