Interface ExprOps<E,V>


public interface ExprOps<E,V>
  • Method Summary

    Modifier and Type
    Method
    Description
    asVar(E expr)
    Get the expression as a variable - null if it is not a variable
    copy(E proto, List<E> subEs)
    Create a copy of an expression that serves as a prototype with the given sub expressions
    static <E, V> Set<E>
    getLeafs(ExprOps<E,V> exprOps, E expr)
    Gets the leaf expressions of the given expression - i.e.
    getSubExprs(E expr)
    Return an expression's immediate sub expressions
    boolean
    isFunction(E expr)
    Return true iff the argument is a function expression
    default boolean
    isVar(E expr)
     
    static <E, V> E
    replace(ExprOps<E,V> exprOps, E expr, Function<? super E,? extends E> fn)
     
    static <E, V> E
    replaceTopDown(ExprOps<E,V> exprOps, E expr, Function<? super E,? extends E> fn)
    Pre order is probably not that useful
    toString(E expr)
    Return a string representation of an expression
    default Set<V>
    Returns all variables mentioned in an expression.
    static <E, V> Set<V>
    varsMentioned(ExprOps<E,V> exprOps, E expr)
    Computes the used variables.
    varToExpr(V var)
    Create an expression that represents the given variable
  • Method Details

    • getSubExprs

      List<E> getSubExprs(E expr)
      Return an expression's immediate sub expressions
    • copy

      E copy(E proto, List<E> subEs)
      Create a copy of an expression that serves as a prototype with the given sub expressions
    • isFunction

      boolean isFunction(E expr)
      Return true iff the argument is a function expression
    • asVar

      V asVar(E expr)
      Get the expression as a variable - null if it is not a variable
    • varToExpr

      E varToExpr(V var)
      Create an expression that represents the given variable
    • toString

      String toString(E expr)
      Return a string representation of an expression
    • isVar

      default boolean isVar(E expr)
    • varsMentioned

      default Set<V> varsMentioned(E expr)
      Returns all variables mentioned in an expression. This method is provided for convenience.
    • varsMentioned

      static <E, V> Set<V> varsMentioned(ExprOps<E,V> exprOps, E expr)
      Computes the used variables. Prefer varsMentioned(Object) for applications.
    • getLeafs

      static <E, V> Set<E> getLeafs(ExprOps<E,V> exprOps, E expr)
      Gets the leaf expressions of the given expression - i.e. those expressions that themselves do not have any sub expressions.
    • replace

      static <E, V> E replace(ExprOps<E,V> exprOps, E expr, Function<? super E,? extends E> fn)
    • replaceTopDown

      static <E, V> E replaceTopDown(ExprOps<E,V> exprOps, E expr, Function<? super E,? extends E> fn)
      Pre order is probably not that useful