Class PurityChecker.PurityResult

java.lang.Object
org.checkerframework.dataflow.util.PurityChecker.PurityResult
Enclosing class:
PurityChecker

public static class PurityChecker.PurityResult extends Object
Result of the PurityChecker. Can be queried regarding whether a given tree was side-effect-free, deterministic, or both; also gives reasons if the answer is "no".
  • Field Details

  • Constructor Details

    • PurityResult

      public PurityResult()
      Creates a new PurityResult.
  • Method Details

    • getKinds

      public EnumSet<PurityKind> getKinds()
      Returns the kinds of purity that the method has.
      Returns:
      the kinds of purity that the method has
    • isPure

      public boolean isPure(EnumSet<PurityKind> otherKinds)
      Is the method pure w.r.t. a given set of kinds?
      Parameters:
      otherKinds - the varieties of purity to check
      Returns:
      true if the method is pure with respect to all the given kinds
    • getNotSEFreeReasons

      public List<PurityChecker.PurityResult.ImpurityReason> getNotSEFreeReasons()
      Returns the reasons why the method is not side-effect-free.
      Returns:
      the reasons why the method is not side-effect-free
    • addNotSEFreeReason

      public void addNotSEFreeReason(Tree t, String msgId)
      Add a reason why the method is not side-effect-free.
      Parameters:
      t - a tree
      msgId - why the tree is not side-effect-free
    • getNotDetReasons

      public List<PurityChecker.PurityResult.ImpurityReason> getNotDetReasons()
      Returns the reasons why the method is not deterministic.
      Returns:
      the reasons why the method is not deterministic
    • addNotDetReason

      public void addNotDetReason(Tree t, String msgId)
      Add a reason why the method is not deterministic.
      Parameters:
      t - a tree
      msgId - why the tree is not deterministic
    • getNotBothReasons

      public List<PurityChecker.PurityResult.ImpurityReason> getNotBothReasons()
      Returns the reasons why the method is not both side-effect-free and deterministic.
      Returns:
      the reasons why the method is not both side-effect-free and deterministic
    • addNotBothReason

      public void addNotBothReason(Tree t, String msgId)
      Add a reason why the method is not both side-effect-free and deterministic.
      Parameters:
      t - tree
      msgId - why the tree is not deterministic and side-effect-free
    • toString

      public String toString()
      Overrides:
      toString in class Object