Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Shared / MS / Utility / Maps.cs / 1 / Maps.cs
/****************************************************************************\ * * File: Maps.cs * * Description: * Contains specialized data structures for mapping a key to data. * * Copyright (C) 2002 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.Collections; using System.Windows; namespace MS.Utility { /***************************************************************************\ ***************************************************************************** * * DTypeMap (DType --> Object) * * Maps the first N used DependencyObject-derived types via an array * (low constant time lookup) for mapping. After which falls back on a * hash table. * * - Fastest gets and sets (normally single array access). * - Large memory footprint. * * Starting mapping is all map to null * ***************************************************************************** \***************************************************************************/ using MS.Internal.PresentationCore; [FriendAccessAllowed] // Built into Core, also used by Framework. internal class DTypeMap { public DTypeMap(int entryCount) { // Constant Time Lookup entries (array size) _entryCount = entryCount; _entries = new object[_entryCount]; _activeDTypes = new ItemStructList(128); } public object this[DependencyObjectType dType] { get { if (dType.Id < _entryCount) { return _entries[dType.Id]; } else { if (_overFlow != null) { return _overFlow[dType]; } return null; } } set { if (dType.Id < _entryCount) { _entries[dType.Id] = value; } else { if (_overFlow == null) { _overFlow = new Hashtable(); } _overFlow[dType] = value; } _activeDTypes.Add(dType); } } // Return list of non-null DType mappings public ItemStructList ActiveDTypes { get { return _activeDTypes; } } // Clear the data-structures to be able to start over public void Clear() { for (int i=0; i<_entryCount; i++) { _entries[i] = null; } for (int i=0; i<_activeDTypes.Count; i++) { _activeDTypes.List[i] = null; } if (_overFlow != null) { _overFlow.Clear(); } } private int _entryCount; private object[] _entries; private Hashtable _overFlow; private ItemStructList _activeDTypes; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /****************************************************************************\ * * File: Maps.cs * * Description: * Contains specialized data structures for mapping a key to data. * * Copyright (C) 2002 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.Collections; using System.Windows; namespace MS.Utility { /***************************************************************************\ ***************************************************************************** * * DTypeMap (DType --> Object) * * Maps the first N used DependencyObject-derived types via an array * (low constant time lookup) for mapping. After which falls back on a * hash table. * * - Fastest gets and sets (normally single array access). * - Large memory footprint. * * Starting mapping is all map to null * ***************************************************************************** \***************************************************************************/ using MS.Internal.PresentationCore; [FriendAccessAllowed] // Built into Core, also used by Framework. internal class DTypeMap { public DTypeMap(int entryCount) { // Constant Time Lookup entries (array size) _entryCount = entryCount; _entries = new object[_entryCount]; _activeDTypes = new ItemStructList (128); } public object this[DependencyObjectType dType] { get { if (dType.Id < _entryCount) { return _entries[dType.Id]; } else { if (_overFlow != null) { return _overFlow[dType]; } return null; } } set { if (dType.Id < _entryCount) { _entries[dType.Id] = value; } else { if (_overFlow == null) { _overFlow = new Hashtable(); } _overFlow[dType] = value; } _activeDTypes.Add(dType); } } // Return list of non-null DType mappings public ItemStructList ActiveDTypes { get { return _activeDTypes; } } // Clear the data-structures to be able to start over public void Clear() { for (int i=0; i<_entryCount; i++) { _entries[i] = null; } for (int i=0; i<_activeDTypes.Count; i++) { _activeDTypes.List[i] = null; } if (_overFlow != null) { _overFlow.Clear(); } } private int _entryCount; private object[] _entries; private Hashtable _overFlow; private ItemStructList _activeDTypes; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Convert.cs
- TrackingServices.cs
- PagerSettings.cs
- EntityKey.cs
- MappingModelBuildProvider.cs
- XmlSchemaImport.cs
- SelectionRange.cs
- DynamicControlParameter.cs
- UserControlParser.cs
- LicenseContext.cs
- FontUnitConverter.cs
- X509RawDataKeyIdentifierClause.cs
- TextPattern.cs
- List.cs
- Timer.cs
- HtmlShim.cs
- TextEndOfSegment.cs
- DCSafeHandle.cs
- WindowInteractionStateTracker.cs
- ResourceBinder.cs
- WindowsSlider.cs
- coordinatorfactory.cs
- PolyLineSegment.cs
- QueryOptionExpression.cs
- SetterBase.cs
- ConfigsHelper.cs
- BamlVersionHeader.cs
- DocComment.cs
- SmiContext.cs
- HMACRIPEMD160.cs
- _CacheStreams.cs
- StorageComplexPropertyMapping.cs
- Hash.cs
- ControlPropertyNameConverter.cs
- ContactManager.cs
- WaitForChangedResult.cs
- XmlnsCompatibleWithAttribute.cs
- SendingRequestEventArgs.cs
- PreservationFileReader.cs
- HeaderLabel.cs
- CacheSection.cs
- CookielessHelper.cs
- PingReply.cs
- ActivityDesignerLayoutSerializers.cs
- SoapCodeExporter.cs
- BinarySerializer.cs
- SymmetricAlgorithm.cs
- SecurityTimestamp.cs
- QueryAsyncResult.cs
- TaiwanLunisolarCalendar.cs
- NativeWrapper.cs
- VisualStyleElement.cs
- JavaScriptString.cs
- VisualStyleTypesAndProperties.cs
- XmlLanguage.cs
- InvokePatternIdentifiers.cs
- DefinitionUpdate.cs
- DispatcherProcessingDisabled.cs
- EmptyImpersonationContext.cs
- ParameterCollection.cs
- LineProperties.cs
- QuaternionAnimation.cs
- BulletDecorator.cs
- LinkUtilities.cs
- X509Utils.cs
- AspProxy.cs
- safex509handles.cs
- SerializationFieldInfo.cs
- HybridDictionary.cs
- DesignerView.xaml.cs
- WizardForm.cs
- TextDecorationCollectionConverter.cs
- CodeDefaultValueExpression.cs
- CollectionBuilder.cs
- ThreadBehavior.cs
- WindowsFormsLinkLabel.cs
- AspCompat.cs
- ProfileGroupSettings.cs
- RIPEMD160Managed.cs
- ISFClipboardData.cs
- SqlReorderer.cs
- FontResourceCache.cs
- SinglePageViewer.cs
- TransportSecurityBindingElement.cs
- WindowsGraphicsWrapper.cs
- HtmlButton.cs
- RewritingValidator.cs
- Property.cs
- MD5CryptoServiceProvider.cs
- LogicalChannelCollection.cs
- InvalidComObjectException.cs
- SpStreamWrapper.cs
- IOException.cs
- CapabilitiesAssignment.cs
- EditorZoneBase.cs
- CompatibleComparer.cs
- Baml2006KeyRecord.cs
- SystemIPGlobalProperties.cs
- ChineseLunisolarCalendar.cs
- XmlChildNodes.cs