public override bool Equals(object obj)
 {
     if (!(obj is PredictionContextCache.PredictionContextAndInt))
     {
         return(false);
     }
     else
     {
         if (obj == this)
         {
             return(true);
         }
     }
     PredictionContextCache.PredictionContextAndInt other = (PredictionContextCache.PredictionContextAndInt)obj;
     return(this.value == other.value && (this.obj == other.obj || (this.obj != null && this.obj.Equals(other.obj))));
 }
Пример #2
0
 public virtual PredictionContext GetChild(PredictionContext context, int invokingState)
 {
     if (!enableCache)
     {
         return context.GetChild(invokingState);
     }
     PredictionContextCache.PredictionContextAndInt operands = new PredictionContextCache.PredictionContextAndInt(context, invokingState);
     PredictionContext result;
     if (!childContexts.TryGetValue(operands, out result))
     {
         result = context.GetChild(invokingState);
         result = GetAsCached(result);
         childContexts[operands] = result;
     }
     return result;
 }
        public virtual PredictionContext GetChild(PredictionContext context, int invokingState)
        {
            if (!enableCache)
            {
                return(context.GetChild(invokingState));
            }
            PredictionContextCache.PredictionContextAndInt operands = new PredictionContextCache.PredictionContextAndInt(context, invokingState);
            PredictionContext result;

            if (!childContexts.TryGetValue(operands, out result))
            {
                result = context.GetChild(invokingState);
                result = GetAsCached(result);
                childContexts[operands] = result;
            }
            return(result);
        }