Package org.antlr.v4.runtime.atn
Class PredictionContextCache
- java.lang.Object
-
- org.antlr.v4.runtime.atn.PredictionContextCache
-
public class PredictionContextCache extends Object
Used to cachePredictionContext
objects. Its used for the shared context cash associated with contexts in DFA states. This cache can be used for both lexers and parsers.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<PredictionContext,PredictionContext>
cache
-
Constructor Summary
Constructors Constructor Description PredictionContextCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PredictionContext
add(PredictionContext ctx)
Add a context to the cache and return it.PredictionContext
get(PredictionContext ctx)
int
size()
-
-
-
Field Detail
-
cache
protected final Map<PredictionContext,PredictionContext> cache
-
-
Method Detail
-
add
public PredictionContext add(PredictionContext ctx)
Add a context to the cache and return it. If the context already exists, return that one instead and do not add a new context to the cache. Protect shared cache from unsafe thread access.
-
get
public PredictionContext get(PredictionContext ctx)
-
size
public int size()
-
-