当前位置: 首页>>代码示例>>C#>>正文


C# HashMap.get方法代码示例

本文整理汇总了C#中HashMap.get方法的典型用法代码示例。如果您正苦于以下问题:C# HashMap.get方法的具体用法?C# HashMap.get怎么用?C# HashMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HashMap的用法示例。


在下文中一共展示了HashMap.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getExtensionsForFragment

        public HashMap<StyleExtensionMapEntry> getExtensionsForFragment(HtmlElement element)
        {
            var hashmap = new HashMap<StyleExtensionMapEntry>();
            //We need to loop over all of the relevant entries in the map that define some behavior
            var allEntries = map.getAllRandoriSelectorEntries();

            for ( var i=0; i<allEntries.length; i++) {
                JsArray<HtmlElement> implementingNodes = findChildNodesForCompoundSelector(element, allEntries[i]);

                //For each of those entries, we need to see if we have any elements in this DOM fragment that implement any of those classes
                for ( var j=0; j<implementingNodes.length; j++) {

                    var implementingElement = implementingNodes[ j ];
                    var value = hashmap.get( implementingElement );

                    if ( value == null ) {
                        //Get the needed entry
                        var extensionEntry = map.getExtensionEntry(allEntries[i]);

                        //give us a copy so we can screw with it at will
                        hashmap.put(implementingElement, extensionEntry.clone());
                    } else {
                        //We already have data for this node, so we need to merge the new data into the existing one
                        var extensionEntry = map.getExtensionEntry(allEntries[i]);

                        extensionEntry.mergeTo( (StyleExtensionMapEntry)value );
                    }
                }
            }

            //return the hashmap which can be queried and applied to the Dom
            return hashmap;
        }
开发者ID:griffith-computing,项目名称:Randori,代码行数:33,代码来源:StyleExtensionManager.cs

示例2: TestCache

 public void TestCache() {
    WeakCache cache = new WeakCache();
    Dictionary map = new HashMap();
    for(int i = 0; i < LOAD_COUNT; i++) {
       String key = String.valueOf(i);
       cache.cache(key, key);
       map.put(key, key);
    }
    for(int i = 0; i < LOAD_COUNT; i++) {
       String key = String.valueOf(i);
       AssertEquals(cache.fetch(key), key);
       AssertEquals(map.get(key), cache.fetch(key));
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:14,代码来源:WeakCacheTest.cs

示例3: describeElement

        public ElementDescriptor describeElement(HtmlElement element, HashMap<StyleExtensionMapEntry> possibleExtensions )
        {
            //This is purely an efficiency gain. By making a merged map for this one element, we stop everyone from cycling through
            //every class on an element to pull out their own piece of data
            var entry = possibleExtensions.get(element);
            var descriptor = new ElementDescriptor {
                context = element.getAttribute("data-context"),
                behavior = element.hasAttribute("data-mediator") ? element.getAttribute("data-mediator") : element.getAttribute("data-behavior"),
                fragment = element.getAttribute("data-fragment"),
                formatter = element.getAttribute( "data-formatter" ),
                validator = element.getAttribute( "data-validator" )
            };

            if ( entry != null ) {
                if (descriptor.context == null) {
                    descriptor.context = entry.getExtensionValue("context");
                }

                if (descriptor.behavior == null) {
                    //mediator and behavior are really the same thing and hence mutually exclusive
                    descriptor.behavior = entry.hasExtensionType("mediator")?entry.getExtensionValue("mediator"):entry.getExtensionValue("behavior");
                }

                if (descriptor.fragment == null) {
                    descriptor.fragment = entry.getExtensionValue("fragment");
                }

                if (descriptor.formatter == null) {
                    descriptor.formatter = entry.getExtensionValue("formatter");
                }

                if (descriptor.validator == null) {
                    descriptor.validator = entry.getExtensionValue("validator");
                }
            }

            return descriptor;
        }
开发者ID:griffith-computing,项目名称:Randori,代码行数:38,代码来源:ElementDescriptorFactory.cs

示例4: Main

        static void Main(string[] args)
        {
            HashMap hm = new HashMap();
            hm.put(3, 3);
            hm.put(103, 4);
            hm.put(203, 5);
            hm.put(4, 44);

            int k = hm.get(4);
            int k1 = hm.get(203);
            hm.delete(203);
            int k2 = hm.get(203);
            int k3 = hm.get(4);
            int k4 = 10;
        }
开发者ID:kerydan,项目名称:CrackingTheCodingInterview,代码行数:15,代码来源:Hash.cs


注:本文中的HashMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。