Class AtnManager.AtnWrapper

java.lang.Object
org.apache.groovy.parser.antlr4.internal.atnmanager.AtnManager.AtnWrapper
Enclosing class:
AtnManager

protected class AtnManager.AtnWrapper extends Object
One ATN and the counters that decide when to retire it. The manager holds the wrapper in a SoftReference. Replacement publishes another wrapper; this instance and its ATN are left as they are so parses already using them can finish.
  • Constructor Details

    • AtnWrapper

      public AtnWrapper(org.antlr.v4.runtime.atn.ATN atn)
      Retains atn. The parse counter starts at zero and the retirement flag starts clear.
      Parameters:
      atn - the ATN whose decision DFAs this wrapper owns
  • Method Details

    • checkAndReplace

      public org.antlr.v4.runtime.atn.ATN checkAndReplace()
      Returns this wrapper's ATN. When dropping is off, that is all this does. When the parse-counter threshold is positive, the counter is incremented and a multiple of the threshold retires this wrapper before the size check. When the DFA-state ceiling is enabled and the summed states.size() of the decision DFAs is over it, one thread retires this wrapper; the flag is not cleared, so a later call does not retire it again. Retirement publishes a new wrapper for a later AtnManager.getATN(). This call still returns atn.
      Returns:
      this wrapper's ATN