Class DefaultIR

All Implemented Interfaces:
Serializable, Iterable<Stmt>, IR, Indexer<Stmt>, ResultHolder

public class DefaultIR extends AbstractResultHolder implements IR
Default implementation of IR. The data structures in this class are immutable.
See Also:
  • Constructor Details

  • Method Details

    • getMethod

      public JMethod getMethod()
      Specified by:
      getMethod in interface IR
      Returns:
      the method that defines the content of this IR.
    • getThis

      @Nullable public Var getThis()
      Specified by:
      getThis in interface IR
      Returns:
      the "this" variable in this IR. If the method is static, then returns null.
    • getParams

      public List<Var> getParams()
      Specified by:
      getParams in interface IR
      Returns:
      the parameters in this IR ("this" variable is excluded). The order of the parameters in the resulting list is the same as the order they are declared in the method.
    • getParam

      public Var getParam(int i)
      Specified by:
      getParam in interface IR
      Returns:
      the i-th parameter in this IR. The indexes start from 0.
    • isParam

      public boolean isParam(Var var)
      Specified by:
      isParam in interface IR
      Returns:
      true if var is a parameter of this IR.
    • isThisOrParam

      public boolean isThisOrParam(Var var)
      Specified by:
      isThisOrParam in interface IR
      Returns:
      true if var is "this" variable or a parameter of this IR.
    • getReturnVars

      public List<Var> getReturnVars()
      Specified by:
      getReturnVars in interface IR
      Returns:
      all returned variables. If the method return type is void, then returns empty list.
    • getVar

      public Var getVar(int i)
      Specified by:
      getVar in interface IR
      Returns:
      the i-th Var in this IR. The indexes start from 0.
    • getVars

      public List<Var> getVars()
      Specified by:
      getVars in interface IR
      Returns:
      the variables in this IR.
    • getVarIndexer

      public Indexer<Var> getVarIndexer()
      Specified by:
      getVarIndexer in interface IR
      Returns:
      an indexer for the variables in this IR.
    • getStmt

      public Stmt getStmt(int i)
      Specified by:
      getStmt in interface IR
      Returns:
      the i-th Stmt in this IR. The indexes start from 0.
    • getStmts

      public List<Stmt> getStmts()
      Specified by:
      getStmts in interface IR
      Returns:
      a list of Stmts in this IR.
    • getIndex

      public int getIndex(Stmt s)
      Specified by:
      getIndex in interface Indexer<Stmt>
      Returns:
      the index of the given object.
    • getObject

      public Stmt getObject(int i)
      Specified by:
      getObject in interface Indexer<Stmt>
      Returns:
      the corresponding object of the given index.
    • getExceptionEntries

      public List<ExceptionEntry> getExceptionEntries()
      Specified by:
      getExceptionEntries in interface IR
      Returns:
      the exception entries in this IR.
      See Also: