Class StateSet


  • public class StateSet
    extends java.lang.Object
    A dataflow fact used in ObligationAnalysis. It is a set of State objects, plus the additional capability to represent top and bottom elements.

    Invariant: no StateSet may contain more than one State with the same ObligationSet.

    See Weimer and Necula, Finding and preventing run-time error handling mistakes, OOPSLA 2004.

    Author:
    David Hovemeyer
    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • setTop

        public void setTop()
      • isTop

        public boolean isTop()
      • setBottom

        public void setBottom()
      • isBottom

        public boolean isBottom()
      • isValid

        public boolean isValid()
      • isOnExceptionPath

        public boolean isOnExceptionPath()
      • setOnExceptionPath

        public void setOnExceptionPath​(boolean onExceptionPath)
      • clear

        public void clear()
      • stateIterator

        public java.util.Iterator<State> stateIterator()
        Return an Iterator over the States in the StateSet.
        Returns:
        an Iterator over the States in the StateSet
      • getAllObligationSets

        public java.util.Set<ObligationSet> getAllObligationSets()
        Get Set of all ObligationsSets in this StateSet.
        Returns:
        Set of all ObligationsSets in this StateSet
      • getStateWithObligationSet

        public State getStateWithObligationSet​(ObligationSet obligationSet)
        Get the State which has the given ObligationSet. Returns null if there is no such state.
        Parameters:
        obligationSet - we want to get the State with this ObligationSet
        Returns:
        the State with the given ObligationSet, or null if there is no such State
      • copyFrom

        public void copyFrom​(StateSet other)
        Make this StateSet an exact copy of the given StateSet.
        Parameters:
        other - a StateSet; this StateSet will be made identical to it
      • duplicate

        public StateSet duplicate()
        Return an exact deep copy of this StateSet.
        Returns:
        an exact deep copy of this StateSet
      • replaceMap

        public void replaceMap​(java.util.Map<ObligationSet,​State> stateMap)
        Replace the map of ObligationSets to States with the given one.
        Parameters:
        stateMap - enw map of ObligationSets to States
      • getPrefixStates

        public java.util.List<State> getPrefixStates​(Path path)
        Get all States that have Paths which are prefixes of the given Path.
        Parameters:
        path - a Path
        Returns:
        Collection of States that have Paths which are prefixes of the given Path
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • createEmptyMap

        public java.util.Map<ObligationSet,​State> createEmptyMap()
        Return a newly allocated Map of ObligationSet to State that may be passed to applyToAllStatesAndUpdateMap().