public bool Contains(uint aAddress) { if (iAddresses == null) { iAddresses = new AddressRangeCollection((IEnumerable <AddressRange>) this); RecalculationAddressRange(); } // bool found = iAddresses.Contains(aAddress); return(found); }
private void RecalculationAddressRange() { #if SYMCOL_INVARIANT_CHECK DebugCheckInvariant(); #endif // if (!InTransaction) { AddressRangeCollection range = new AddressRangeCollection(); lock ( iSymbols ) { foreach (Symbol entry in iSymbols) { range.Add(entry.AddressRange); } } // iAddresses = range; } }
private void UpdateCacheForCollection(SymbolCollection aCollection) { bool isEmpty = aCollection.IsEmptyApartFromDefaultSymbol; if (isEmpty == false) { AddressRangeCollection ranges = aCollection.AddressRangeCollection; if (ranges != null) { // This comparer will help us sort the ranges AddressCollectionPairComparer comparer = new AddressCollectionPairComparer(); int rangeCount = ranges.Count; for (int rangeIndex = 0; rangeIndex < rangeCount; rangeIndex++) { AddressRange range = ranges[rangeIndex]; AddressCollectionPair pair = new AddressCollectionPair(range, aCollection); // lock ( iLookupCache ) { int pos = iLookupCache.BinarySearch(pair, comparer); if (pos >= 0) { AddressCollectionPair overlapsWith = iLookupCache[pos]; System.Diagnostics.Debug.WriteLine(string.Format("Collection {0} [{1}] overlaps with existing collection: {2} [{3}]", pair.Collection.FileName, pair.Range, overlapsWith.Collection, overlapsWith.Range)); } else { pos = ~pos; iLookupCache.Insert(pos, pair); } } } } } }