accrue.analysis.interprocanalysis

## Class ExitMap<T extends Ordered<T>>

- java.lang.Object
- - accrue.analysis.interprocanalysis.ExitMap<T>

- Type Parameters:
    `T` - type of context on each exit path
  Direct Known Subclasses:
    FinalVarContext

      public class ExitMap<T extends Ordered<T>>
      extends java.lang.Object

  Map giving the possible exit paths and the lattice elements along those paths

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ExitMap.ExceptionKey` Key for an exception exit path
    `static class` | `ExitMap.Key` Exit map key
    `static class` | `ExitMap.LabeledBranchKey` Labeled `break` or `continue`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<polyglot.types.ClassType>` | `exceptionTypes` Type of exceptions that can be thrown on exception exit
    `static ExitMap.Key` | `KEY_BREAK` Key for a loop break
    `static ExitMap.Key` | `KEY_CONTINUE` Key for a loop continue
    `static ExitMap.Key` | `KEY_DIVERGE` Key for divergence
    `static ExitMap.Key` | `KEY_FALSE_RESULT` Key for a false branch
    `static ExitMap.Key` | `KEY_NORM_TERM` Key for normal termination
    `static ExitMap.Key` | `KEY_RETURN` Key for exiting with a return statement
    `static ExitMap.Key` | `KEY_TRUE_RESULT` Key for a true branch
    `protected java.util.Map<ExitMap.Key,T>` | `map` Map of exit key to context

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ExitMap(java.util.Map<ExitMap.Key,T> m, java.util.Set<polyglot.types.ClassType> exTypes)` Create a new map from the constituent parts

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExitMap<T>` | `addKey(ExitMap.Key k, T c)` Functional update of an `ExitMap`.
    `ExitMap<T>` | `addToAll(T c)` Upper bound `c` with the context for each key
    `java.util.List<T>` | `allItems()`
    `java.util.Set<ExitMap.Key>` | `allKeys()`
    `T` | `branch(polyglot.ast.Branch.Kind kind)` Get the context for a `break` or a `continue`
    `T` | `branch(polyglot.ast.Branch.Kind kind, java.lang.String loopLabel)` Get the context for a `break` or a `continue`
    `ExitMap<T>` | `branch(polyglot.ast.Branch.Kind kind, T c)` Set the context for a `break` or `continue`
    `static ExitMap.Key` | `branchKey(polyglot.ast.Branch.Kind kind)` Get the key for continue or break
    `static ExitMap.Key` | `branchKey(polyglot.ast.Branch.Kind kind, java.lang.String loopLabel)` Get the branch key (`break` or `continue`) for the given kind and label
    `protected ExitMap<T>` | `copy()` Returns a copy so that it is ok to modify the map.
    `protected ExitMap<T>` | `create(java.util.Map<ExitMap.Key,T> m, java.util.Set<polyglot.types.ClassType> exTypes)` Create a new map from the constituent parts
    `ExitMap<T>` | `diverge(T c)` Add the context, `c`, to the map with a diverge key
    `boolean` | `equals(java.lang.Object o)`
    `T` | `exception(polyglot.types.ClassType exType)` Get the context for the given exception type
    `ExitMap<T>` | `exception(polyglot.types.ClassType exType, T c)` Add the exception type with the context, `c`
    `static ExitMap.ExceptionKey` | `exceptionKey(polyglot.types.ClassType exType)` Get the key for the given exception type
    `java.util.Set<polyglot.types.ClassType>` | `exceptionTypes()`
    `T` | `falseResult()` Get the context for the false branch if any, otherwise return the context for normal termination
    `ExitMap<T>` | `falseResult(T falseC)` Set the context for the false branch
    `T` | `get(ExitMap.Key key)` Get the context for the given key
    `boolean` | `hasExceptionType(polyglot.types.ClassType exType)`
    `boolean` | `hasFalseResult()`
    `int` | `hashCode()`
    `boolean` | `hasTrueFalseResult()` True if the exit map branches on exit
    `boolean` | `hasTrueResult()`
    `T` | `normalTermination()`
    `ExitMap<T>` | `normalTermination(T c)` Set the context for normal termination
    `ExitMap<T>` | `removeBranch(polyglot.ast.Branch.Kind kind)` Functionally remove the `break` or `continue` from the map
    `ExitMap<T>` | `removeBranch(polyglot.ast.Branch.Kind kind, java.lang.String loopLabel)` Functionally remove the `break` or `continue` with the given label from the map
    `ExitMap<T>` | `removeException(polyglot.types.ClassType exType)` Functionally remove the edge correspinding to the exception type
    `ExitMap<T>` | `removeNormalTermination()` Functionally remove the normal termination, true, and false results from the map
    `ExitMap<T>` | `removeReturnItem()` Functionally remove the return result from the map
    `ExitMap<T>` | `removeTrueFalseResults()` Functionally remove the true, and false results from the map
    `T` | `returnItem()`
    `ExitMap<T>` | `returnItem(T c)`
    `java.lang.String` | `toString()`
    `ExitMap<T>` | `trueFalseResult(T trueC, T falseC)` Set the contexts for the true and the false branches
    `T` | `trueResult()` Get the context for the true branch if any, otherwise return the context for normal termination
    `ExitMap<T>` | `trueResult(T trueC)` Set the context for the true branch
    `ExitMap<T>` | `upperBound(ExitMap<T> f)` Compute pairwise upper bound of `this` with `f`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### map

          protected final java.util.Map<ExitMap.Key,T extends Ordered<T>> map

      Map of exit key to context

    - #### exceptionTypes

          protected final java.util.Set<polyglot.types.ClassType> exceptionTypes

      Type of exceptions that can be thrown on exception exit

    - #### KEY_NORM_TERM

          public static final ExitMap.Key KEY_NORM_TERM

      Key for normal termination

    - #### KEY_RETURN

          public static final ExitMap.Key KEY_RETURN

      Key for exiting with a return statement

    - #### KEY_BREAK

          public static final ExitMap.Key KEY_BREAK

      Key for a loop break

    - #### KEY_CONTINUE

          public static final ExitMap.Key KEY_CONTINUE

      Key for a loop continue

    - #### KEY_DIVERGE

          public static final ExitMap.Key KEY_DIVERGE

      Key for divergence

    - #### KEY_TRUE_RESULT

          public static final ExitMap.Key KEY_TRUE_RESULT

      Key for a true branch

    - #### KEY_FALSE_RESULT

          public static final ExitMap.Key KEY_FALSE_RESULT

      Key for a false branch

  - ### Constructor Detail

    - #### ExitMap

          protected ExitMap(java.util.Map<ExitMap.Key,T> m,
                 java.util.Set<polyglot.types.ClassType> exTypes)

      Create a new map from the constituent parts
      Parameters:
        `m` - map of exit type to context
        `exTypes` - Type of exceptions that can be thrown on exception exit

  - ### Method Detail

    - #### copy

          protected ExitMap<T> copy()

      Returns a copy so that it is ok to modify the map.

    - #### create

          protected ExitMap<T> create(java.util.Map<ExitMap.Key,T> m,
                          java.util.Set<polyglot.types.ClassType> exTypes)

      Create a new map from the constituent parts
      Parameters:
        `m` - map of exit type to context
        `exTypes` - Type of exceptions that can be thrown on exception exit
      Returns:
        `ExitMap` class

    - #### hasExceptionType

          public boolean hasExceptionType(polyglot.types.ClassType exType)

      Returns:
        True if the given exception type can be thrown

    - #### exceptionTypes

          public java.util.Set<polyglot.types.ClassType> exceptionTypes()

      Returns:
        All exceptions types that can be thrown

    - #### normalTermination

          public T normalTermination()

      Returns:
        the context for normal termination

    - #### normalTermination

          public ExitMap<T> normalTermination(T c)

      Set the context for normal termination
      Parameters:
        `c` - the normal termination context
      Returns:
        An exit map with the new normal termination element

    - #### trueResult

          public T trueResult()

      Get the context for the true branch if any, otherwise return the context for normal termination

    - #### falseResult

          public T falseResult()

      Get the context for the false branch if any, otherwise return the context for normal termination

    - #### trueFalseResult

          public ExitMap<T> trueFalseResult(T trueC,
                                   T falseC)

      Set the contexts for the true and the false branches
      Parameters:
        `trueC` - new context for the true branch
        `falseC` - new context for the false branch
      Returns:
        Exit map with the branch contexts added

    - #### trueResult

          public ExitMap<T> trueResult(T trueC)

      Set the context for the true branch
      Parameters:
        `trueC` - new context for the true branch
      Returns:
        Exit map with the branch contexts added

    - #### falseResult

          public ExitMap<T> falseResult(T falseC)

      Set the context for the false branch
      Parameters:
        `falseC` - new context for the false branch
      Returns:
        Exit map with the branch contexts added

    - #### hasTrueFalseResult

          public boolean hasTrueFalseResult()

      True if the exit map branches on exit

    - #### hasTrueResult

          public boolean hasTrueResult()

    - #### hasFalseResult

          public boolean hasFalseResult()

    - #### returnItem

          public T returnItem()

      Returns:
        the context for a return statement

    - #### returnItem

          public ExitMap<T> returnItem(T c)

      Parameters:
        `c` - the context for a return statement
      Returns:
        Exit map with the return context set

    - #### branch

          public T branch(polyglot.ast.Branch.Kind kind)

      Get the context for a `break` or a `continue`
      Parameters:
        `kind` - `break` or `continue`
      Returns:
        context for the given branch

    - #### branch

          public T branch(polyglot.ast.Branch.Kind kind,
                 java.lang.String loopLabel)

      Get the context for a `break` or a `continue`
      Parameters:
        `kind` - `break` or `continue`
        `loopLabel` - label of the loop
      Returns:
        context for the given branch

    - #### branch

          public ExitMap<T> branch(polyglot.ast.Branch.Kind kind,
                          T c)

      Set the context for a `break` or `continue`
      Parameters:
        `kind` - `break` or `continue`
        `c` - context for the kind
      Returns:
        map with the added context

    - #### diverge

          public ExitMap<T> diverge(T c)

      Add the context, `c`, to the map with a diverge key
      Parameters:
        `c` - context upon diverging
      Returns:
        map with the added context

    - #### exception

          public ExitMap<T> exception(polyglot.types.ClassType exType,
                             T c)

      Add the exception type with the context, `c`
      Parameters:
        `exType` - type of exception
        `c` - context when exiting with an exception of `exType`
      Returns:
        map with the added context

    - #### exception

          public T exception(polyglot.types.ClassType exType)

      Get the context for the given exception type
      Parameters:
        `exType` - type of exception
      Returns:
        context when exiting with an exception of `exType`

    - #### exceptionKey

          public static ExitMap.ExceptionKey exceptionKey(polyglot.types.ClassType exType)

      Get the key for the given exception type
      Parameters:
        `exType` - type of exception
      Returns:
        exit key for the given exception type

    - #### addKey

          public ExitMap<T> addKey(ExitMap.Key k,
                          T c)

      Functional update of an `ExitMap`. Returns a new `ExitMap` with the new value replacing the existing value in the map at the given key similar to `Map.put(Object, Object)`. If `c` is null then the value at the given key will be removed from the returned map.
      Parameters:
        `k` - key for the map
        `c` - context to add
      Returns:
        map with the added context

    - #### removeNormalTermination

          public ExitMap<T> removeNormalTermination()

      Functionally remove the normal termination, true, and false results from the map

    - #### removeTrueFalseResults

          public ExitMap<T> removeTrueFalseResults()

      Functionally remove the true, and false results from the map

    - #### removeReturnItem

          public ExitMap<T> removeReturnItem()

      Functionally remove the return result from the map

    - #### removeBranch

          public ExitMap<T> removeBranch(polyglot.ast.Branch.Kind kind)

      Functionally remove the `break` or `continue` from the map

    - #### removeBranch

          public ExitMap<T> removeBranch(polyglot.ast.Branch.Kind kind,
                                java.lang.String loopLabel)

      Functionally remove the `break` or `continue` with the given label from the map

    - #### removeException

          public ExitMap<T> removeException(polyglot.types.ClassType exType)

      Functionally remove the edge correspinding to the exception type

    - #### upperBound

          public ExitMap<T> upperBound(ExitMap<T> f)

      Compute pairwise upper bound of `this` with `f`. If a key only exists in one then it is added as-is
      Parameters:
        `f` - map to upper bound with
      Returns:
        new map that is the upper bound of `this` with `f`

    - #### allItems

          public java.util.List<T> allItems()

      Returns:
        all the contexts from the map

    - #### allKeys

          public java.util.Set<ExitMap.Key> allKeys()

      Returns:
        all the keys for the map

    - #### addToAll

          public ExitMap<T> addToAll(T c)

      Upper bound `c` with the context for each key
      Returns:
        New map with the upper bound `c` with the context for each key

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### 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`

    - #### get

          public T get(ExitMap.Key key)

      Get the context for the given key

    - #### branchKey

          public static ExitMap.Key branchKey(polyglot.ast.Branch.Kind kind)

      Get the key for continue or break

    - #### branchKey

          public static ExitMap.Key branchKey(polyglot.ast.Branch.Kind kind,
                              java.lang.String loopLabel)

      Get the branch key (`break` or `continue`) for the given kind and label
      Parameters:
        `kind` - `break` or `continue`
        `loopLabel` - label for the loop we are breaking or continuing
      Returns:
        the (possibly labeled) key