Top Description Fields Constructors Methods
org.antlr.v4.runtime.atn

public Class PredictionContextCache

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map

Used to cache PredictionContext 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

Modifier and TypeField and Description
protected final Map<PredictionContext, PredictionContext>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PredictionContext
add(PredictionContext ctx)

Add a context to the cache and return it.

public PredictionContext
public int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
protected final Map<PredictionContext, PredictionContext> cache

Constructor Detail

PredictionContextCacheback to summary
public PredictionContextCache()

Method Detail

addback to summary
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.

getback to summary
public PredictionContext get(PredictionContext ctx)
sizeback to summary
public int size()