Class PurityChecker.PurityResult

  • Enclosing class:
    PurityChecker

    public static class PurityChecker.PurityResult
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.EnumSet<Pure.Kind> kinds
      Contains all the varieties of purity that the expression has.
      protected java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notBothReasons
      Reasons that the referenced method is not side-effect-free and deterministic.
      protected java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notDetReasons
      Reasons that the referenced method is not deterministic.
      protected java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notSEFreeReasons
      Reasons that the referenced method is not side-effect-free.
    • Constructor Summary

      Constructors 
      Constructor Description
      PurityResult()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addNotBothReason​(com.sun.source.tree.Tree t, java.lang.String msgId)
      Add a reason why the method is not both side-effect-free and deterministic.
      void addNotDetReason​(com.sun.source.tree.Tree t, java.lang.String msgId)
      Add a reason why the method is not deterministic.
      void addNotSEFreeReason​(com.sun.source.tree.Tree t, java.lang.String msgId)
      Add a reason why the method is not side-effect-free.
      java.util.EnumSet<Pure.Kind> getKinds()
      Return the kinds of purity that the method has.
      java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotBothReasons()
      Get the reasons why the method is not both side-effect-free and deterministic.
      java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotDetReasons()
      Get the reasons why the method is not deterministic.
      java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotSEFreeReasons()
      Get the reasons why the method is not side-effect-free.
      boolean isPure​(java.util.EnumSet<Pure.Kind> otherKinds)
      Is the method pure w.r.t.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • notSEFreeReasons

        protected final java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notSEFreeReasons
        Reasons that the referenced method is not side-effect-free.
      • notDetReasons

        protected final java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notDetReasons
        Reasons that the referenced method is not deterministic.
      • notBothReasons

        protected final java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> notBothReasons
        Reasons that the referenced method is not side-effect-free and deterministic.
      • kinds

        protected java.util.EnumSet<Pure.Kind> kinds
        Contains all the varieties of purity that the expression has. Starts out with all varieties, and elements are removed from it as violations are found.
    • Constructor Detail

      • PurityResult

        public PurityResult()
    • Method Detail

      • getKinds

        public java.util.EnumSet<Pure.Kind> getKinds()
        Return the kinds of purity that the method has.
        Returns:
        the kinds of purity that the method has
      • isPure

        public boolean isPure​(java.util.EnumSet<Pure.Kind> 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 java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotSEFreeReasons()
        Get 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​(com.sun.source.tree.Tree t,
                                       java.lang.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 java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotDetReasons()
        Get the reasons why the method is not deterministic.
        Returns:
        the reasons why the method is not deterministic
      • addNotDetReason

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

        public java.util.List<org.plumelib.util.IPair<com.sun.source.tree.Tree,​java.lang.String>> getNotBothReasons()
        Get 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​(com.sun.source.tree.Tree t,
                                     java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object