Antlr4.Runtime.Atn.ATNSimulator.getCachedContext C# (CSharp) Метод

getCachedContext() публичный Метод

public getCachedContext ( PredictionContext context ) : PredictionContext
context PredictionContext
Результат PredictionContext
        public PredictionContext getCachedContext(PredictionContext context)
        {
            if (sharedContextCache == null) return context;

            lock (sharedContextCache)
            {
                PredictionContext.IdentityHashMap visited =
                    new PredictionContext.IdentityHashMap();
                return PredictionContext.GetCachedContext(context,
                                                          sharedContextCache,
                                                          visited);
            }
        }

Usage Example

Пример #1
0
        public void OptimizeConfigs(ATNSimulator interpreter)
        {
            if (readOnly)
            {
                throw new Exception("This set is readonly");
            }
            if (configLookup.Count == 0)
            {
                return;
            }

            foreach (ATNConfig config in configs)
            {
                //			int before = PredictionContext.getAllContextNodes(config.context).size();
                config.context = interpreter.getCachedContext(config.context);
                //			int after = PredictionContext.getAllContextNodes(config.context).size();
                //			System.out.println("configs "+before+"->"+after);
            }
        }