예제 #1
0
        public ExpressionResultCacheEntryLongArrayAndObj GetEnumerationMethodLastValue(object node)
        {
            SoftReference<ExpressionResultCacheEntryLongArrayAndObj> cacheRef = enumMethodCache.Get(node);
            if (cacheRef == null) {
                return null;
            }

            ExpressionResultCacheEntryLongArrayAndObj entry = cacheRef.Get();
            if (entry == null) {
                return null;
            }

            long[] required = entry.Reference;
            if (required.Length != lastValueCacheStack.Count) {
                return null;
            }

            IEnumerator<long> prov = lastValueCacheStack.GetEnumerator();
            for (int i = 0; i < lastValueCacheStack.Count; i++) {
                prov.MoveNext();
                if (!Equals(required[i], prov.Current)) {
                    return null;
                }
            }

            return entry;
        }
예제 #2
0
 public void SaveEnumerationMethodLastValue(
     object node,
     object result)
 {
     var snapshot = lastValueCacheStack.ToArray();
     var entry = new ExpressionResultCacheEntryLongArrayAndObj(snapshot, result);
     enumMethodCache.Put(node, new SoftReference<ExpressionResultCacheEntryLongArrayAndObj>(entry));
 }