Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CE948200C24 for ; Wed, 8 Feb 2017 15:31:44 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id CD583160B67; Wed, 8 Feb 2017 14:31:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F1B56160B77 for ; Wed, 8 Feb 2017 15:31:43 +0100 (CET) Received: (qmail 52737 invoked by uid 500); 8 Feb 2017 14:31:42 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 52154 invoked by uid 99); 8 Feb 2017 14:31:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2017 14:31:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 060C4E04F4; Wed, 8 Feb 2017 14:31:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Wed, 08 Feb 2017 14:31:54 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [15/53] [abbrv] lucenenet git commit: Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader refactor: Renamed IntClass > Int32Class, IntItem > Value. Made the Value non-nullable, since it is already wrapped in a reference type. Changed Int32Class a archived-at: Wed, 08 Feb 2017 14:31:44 -0000 Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyReader refactor: Renamed IntClass > Int32Class, IntItem > Value. Made the Value non-nullable, since it is already wrapped in a reference type. Changed Int32Class and constructor from internal to private, since they are not used outside of the class anyway. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ffa0fbf6 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ffa0fbf6 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ffa0fbf6 Branch: refs/heads/api-work Commit: ffa0fbf6ed9e90e25b3858ca52a5ba1c0f8e14c9 Parents: 4c08260 Author: Shad Storhaug Authored: Tue Feb 7 20:45:14 2017 +0700 Committer: Shad Storhaug Committed: Wed Feb 8 21:08:21 2017 +0700 ---------------------------------------------------------------------- .../Directory/DirectoryTaxonomyReader.cs | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ffa0fbf6/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs index 2e71b8b..b66517e 100644 --- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs +++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs @@ -47,9 +47,15 @@ namespace Lucene.Net.Facet.Taxonomy.Directory /// public class DirectoryTaxonomyReader : TaxonomyReader, IDisposable { - public class IntClass + /// + /// LUCENENET specific class to make an type into a reference type. + /// + private class Int32Class { - public int? IntItem { get; set; } + /// + /// NOTE: This was intItem (field) in Lucene + /// + public int Value { get; set; } } private const int DEFAULT_CACHE_VALUE = 4000; @@ -58,7 +64,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory private readonly DirectoryReader indexReader; // TODO: test DoubleBarrelLRUCache and consider using it instead - private LRUHashMap ordinalCache; + private LRUHashMap ordinalCache; private LRUHashMap categoryCache; private volatile TaxonomyIndexArrays taxoArrays; @@ -68,8 +74,8 @@ namespace Lucene.Net.Facet.Taxonomy.Directory /// recreated, you should pass null as the caches and parent/children /// arrays. /// - internal DirectoryTaxonomyReader(DirectoryReader indexReader, DirectoryTaxonomyWriter taxoWriter, - LRUHashMap ordinalCache, LRUHashMap categoryCache, + private DirectoryTaxonomyReader(DirectoryReader indexReader, DirectoryTaxonomyWriter taxoWriter, + LRUHashMap ordinalCache, LRUHashMap categoryCache, TaxonomyIndexArrays taxoArrays) { this.indexReader = indexReader; @@ -77,7 +83,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory this.taxoEpoch = taxoWriter == null ? -1 : taxoWriter.TaxonomyEpoch; // use the same instance of the cache, note the protective code in getOrdinal and getPath - this.ordinalCache = ordinalCache == null ? new LRUHashMap(DEFAULT_CACHE_VALUE) : ordinalCache; + this.ordinalCache = ordinalCache == null ? new LRUHashMap(DEFAULT_CACHE_VALUE) : ordinalCache; this.categoryCache = categoryCache == null ? new LRUHashMap(DEFAULT_CACHE_VALUE) : categoryCache; this.taxoArrays = taxoArrays != null ? new TaxonomyIndexArrays(indexReader, taxoArrays) : null; @@ -98,7 +104,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory // These are the default cache sizes; they can be configured after // construction with the cache's setMaxSize() method - ordinalCache = new LRUHashMap(DEFAULT_CACHE_VALUE); + ordinalCache = new LRUHashMap(DEFAULT_CACHE_VALUE); categoryCache = new LRUHashMap(DEFAULT_CACHE_VALUE); } @@ -118,7 +124,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory // These are the default cache sizes; they can be configured after // construction with the cache's setMaxSize() method - ordinalCache = new LRUHashMap(DEFAULT_CACHE_VALUE); + ordinalCache = new LRUHashMap(DEFAULT_CACHE_VALUE); categoryCache = new LRUHashMap(DEFAULT_CACHE_VALUE); } @@ -290,15 +296,15 @@ namespace Lucene.Net.Facet.Taxonomy.Directory // LUCENENET: Lock was removed here because the underlying cache is thread-safe, // and removing the lock seems to make the performance better. - IntClass res = ordinalCache.Get(cp); - if (res != null && res.IntItem != null) + Int32Class res = ordinalCache.Get(cp); + if (res != null) { - if ((int)res.IntItem.Value < indexReader.MaxDoc) + if ((int)res.Value < indexReader.MaxDoc) { // Since the cache is shared with DTR instances allocated from // doOpenIfChanged, we need to ensure that the ordinal is one that // this DTR instance recognizes. - return (int)res.IntItem.Value; + return (int)res.Value; } else { @@ -326,7 +332,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory // LUCENENET: Lock was removed here because the underlying cache is thread-safe, // and removing the lock seems to make the performance better. - ordinalCache.Put(cp, new IntClass { IntItem = Convert.ToInt32(ret) }); + ordinalCache.Put(cp, new Int32Class { Value = Convert.ToInt32(ret) }); } return ret;