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 voidappend(java.lang.Appendable appender, Sort sort)Convert a sort into an appendable.voidappend(java.lang.Appendable appender, Term term)Convert a term into an appendable.voidappend(java.lang.Appendable appender, java.lang.Object[] sexpr)Append an s-expression.static java.lang.StringquoteIdentifier(java.lang.String id)Ensure the identifier is SMTLIB 2 compliant.static java.lang.ObjectquoteObjectIfString(java.lang.Object value)Ensure that object can be used as SMT-LIB 2 compliant identifier.java.lang.StringtoString()protected voidwalkSort(Sort sort)Walk over a sort and add its components to the todo queue.protected voidwalkTerm(Term term)Walk over a term and add its components to the todo queue.
-
Field Details
-
mTodo
protected final java.util.ArrayDeque<java.lang.Object> mTodo
-
-
Constructor Details
-
PrintTerm
public PrintTerm()
-
-
Method Details
-
append
Convert a term into an appendable.- Parameters:
appender- The appendable.term- The term.
-
append
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
Walk over a term and add its components to the todo queue.- Parameters:
term- the term.
-
walkSort
Walk over a sort and add its components to the todo queue.- Parameters:
sort- the sort.
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-