accrue.analysis.interprocvarcontext

## Class FinalVarContext<T extends AbstractValue<T>>

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

-     public class FinalVarContext<T extends AbstractValue<T>>
      extends ExitMap<VarContext<T>>

  The analysis context produced by analyzing a command. Is a map from the possible ways to exit the command to PolContexts, and also a Policy for the result of an expression. Note that the exception types are exact: if a VarContext is associated with an exception type, then that is the suitable context when an exception of EXACTLY that type is thrown. This is a functional implementation: a FinalVarContext is immutable.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class accrue.analysis.interprocanalysis.ExitMap

      `ExitMap.ExceptionKey, ExitMap.Key, ExitMap.LabeledBranchKey`

  - ### Field Summary

    - ### Fields inherited from class accrue.analysis.interprocanalysis.ExitMap

      `exceptionTypes, KEY_BREAK, KEY_CONTINUE, KEY_DIVERGE, KEY_FALSE_RESULT, KEY_NORM_TERM, KEY_RETURN, KEY_TRUE_RESULT, map`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `FinalVarContext(java.util.Map<ExitMap.Key,VarContext<T>> m, java.util.Set<polyglot.types.ClassType> exTypes)` Create one from its parts

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FinalVarContext<T>` | `addToAll(VarContext<T> c)` Upper bound `c` with the context for each key
    `protected FinalVarContext<T>` | `copy()` Returns a copy so that it is ok to modify the map.
    `protected FinalVarContext<T>` | `create(java.util.Map<ExitMap.Key,VarContext<T>> m, java.util.Set<polyglot.types.ClassType> exTypes)` Create a new map from the constituent parts
    `FinalVarContext<T>` | `restoreContext(VarContext<T> toRestore, boolean restoreLocalsAndStack)` Restore elements of the input context into the contexts in `this`.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class accrue.analysis.interprocanalysis.ExitMap

      `addKey, allItems, allKeys, branch, branch, branch, branchKey, branchKey, diverge, equals, exception, exception, exceptionKey, exceptionTypes, falseResult, falseResult, get, hasExceptionType, hasFalseResult, hashCode, hasTrueFalseResult, hasTrueResult, normalTermination, normalTermination, removeBranch, removeBranch, removeException, removeNormalTermination, removeReturnItem, removeTrueFalseResults, returnItem, returnItem, trueFalseResult, trueResult, trueResult, upperBound`

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

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

- - ### Constructor Detail

    - #### FinalVarContext

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

      Create one from its parts
      Parameters:
        `m` - map from exit key to variable context
        `exTypes` - types of exceptions that can be thrown

  - ### Method Detail

    - #### copy

          protected FinalVarContext<T> copy()

      Returns a copy so that it is ok to modify the map.
      Overrides:
        `copy` in class `ExitMap<VarContext<T extends AbstractValue<T>>>`

    - #### create

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

      Description copied from class: `ExitMap`
      Create a new map from the constituent parts
      Overrides:
        `create` in class `ExitMap<VarContext<T extends AbstractValue<T>>>`
      Parameters:
        `m` - map of exit type to context
        `exTypes` - Type of exceptions that can be thrown on exception exit
      Returns:
        `ExitMap` class

    - #### restoreContext

          public FinalVarContext<T> restoreContext(VarContext<T> toRestore,
                                          boolean restoreLocalsAndStack)

      Restore elements of the input context into the contexts in `this`. This should be called after a procedure call is processed to restore the appropriate parts of the caller's context.

      Restores the suspended execution stack.

      If `restoreLocalsAndStack` is true then this method also restores the local variables. And restores execution stack into the normal termination context (if there is one).

      This also serves as an extension point for subclasses to allow them to restore other parts of a context.

      Parameters:
        `toRestore` - context used to get the elements to restore
        `restoreLocalsAndStack` - true if we want to restore local variables and the expression stack (the expression stack is only restored in the normal termination context)
      Returns:
        a new `FinalVarContext` with certain elements restored from the given context

    - #### addToAll

          public FinalVarContext<T> addToAll(VarContext<T> c)

      Description copied from class: `ExitMap`
      Upper bound `c` with the context for each key
      Overrides:
        `addToAll` in class `ExitMap<VarContext<T extends AbstractValue<T>>>`
      Returns:
        New map with the upper bound `c` with the context for each key

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `ExitMap<VarContext<T extends AbstractValue<T>>>`