Lucene.Net.Core.Index.DocValuesFieldUpdates.Type refactor: Renamed DocValuesFieldUpdatesType and de-nested from DocValuesFieldUpdates
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5fb89cf7 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5fb89cf7 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5fb89cf7 Branch: refs/heads/api-work Commit: 5fb89cf7f1fd19c337a24f099c5b5af0e792f2df Parents: 994e6cf Author: Shad Storhaug <[email protected]> Authored: Fri Mar 3 13:11:28 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Mar 5 17:08:35 2017 +0700 ---------------------------------------------------------------------- .../Index/BinaryDocValuesFieldUpdates.cs | 2 +- .../Index/DocValuesFieldUpdates.cs | 29 ++++++++------------ src/Lucene.Net.Core/Index/DocValuesUpdate.cs | 8 +++--- .../Index/NumericDocValuesFieldUpdates.cs | 2 +- 4 files changed, 18 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5fb89cf7/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs b/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs index 83a3608..3d56a7c 100644 --- a/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs +++ b/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs @@ -127,7 +127,7 @@ namespace Lucene.Net.Index private int size; public BinaryDocValuesFieldUpdates(string field, int maxDoc) - : base(field, DocValuesFieldUpdates.Type.BINARY) + : base(field, DocValuesFieldUpdatesType.BINARY) { docsWithField = new FixedBitSet(64); docs = new PagedMutable(1, 1024, PackedInt32s.BitsRequired(maxDoc - 1), PackedInt32s.COMPACT); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5fb89cf7/src/Lucene.Net.Core/Index/DocValuesFieldUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocValuesFieldUpdates.cs b/src/Lucene.Net.Core/Index/DocValuesFieldUpdates.cs index a2caac0..d832236 100644 --- a/src/Lucene.Net.Core/Index/DocValuesFieldUpdates.cs +++ b/src/Lucene.Net.Core/Index/DocValuesFieldUpdates.cs @@ -89,16 +89,16 @@ namespace Lucene.Net.Index get { return numericDVUpdates.Count + binaryDVUpdates.Count; } } - internal virtual AbstractDocValuesFieldUpdates GetUpdates(string field, DocValuesFieldUpdates.Type type) + internal virtual AbstractDocValuesFieldUpdates GetUpdates(string field, DocValuesFieldUpdatesType type) { switch (type) { - case DocValuesFieldUpdates.Type.NUMERIC: + case DocValuesFieldUpdatesType.NUMERIC: NumericDocValuesFieldUpdates num; numericDVUpdates.TryGetValue(field, out num); return num; - case DocValuesFieldUpdates.Type.BINARY: + case DocValuesFieldUpdatesType.BINARY: BinaryDocValuesFieldUpdates bin; binaryDVUpdates.TryGetValue(field, out bin); return bin; @@ -108,18 +108,18 @@ namespace Lucene.Net.Index } } - internal virtual AbstractDocValuesFieldUpdates NewUpdates(string field, DocValuesFieldUpdates.Type type, int maxDoc) + internal virtual AbstractDocValuesFieldUpdates NewUpdates(string field, DocValuesFieldUpdatesType type, int maxDoc) { switch (type) { - case DocValuesFieldUpdates.Type.NUMERIC: + case DocValuesFieldUpdatesType.NUMERIC: NumericDocValuesFieldUpdates numericUpdates; Debug.Assert(!numericDVUpdates.TryGetValue(field, out numericUpdates)); numericUpdates = new NumericDocValuesFieldUpdates(field, maxDoc); numericDVUpdates[field] = numericUpdates; return numericUpdates; - case DocValuesFieldUpdates.Type.BINARY: + case DocValuesFieldUpdatesType.BINARY: BinaryDocValuesFieldUpdates binaryUpdates; Debug.Assert(!binaryDVUpdates.TryGetValue(field, out binaryUpdates)); binaryUpdates = new BinaryDocValuesFieldUpdates(field, maxDoc); @@ -138,9 +138,9 @@ namespace Lucene.Net.Index } internal readonly string field; - internal readonly DocValuesFieldUpdates.Type type; + internal readonly DocValuesFieldUpdatesType type; - protected internal AbstractDocValuesFieldUpdates(string field, DocValuesFieldUpdates.Type type) + protected internal AbstractDocValuesFieldUpdates(string field, DocValuesFieldUpdatesType type) { this.field = field; this.type = type; @@ -171,16 +171,11 @@ namespace Lucene.Net.Index public abstract bool Any(); } - // LUCENENET specific class used to nest Type enumeration into the correct place + // LUCENENET specific - de-nested Type enumeration and renamed DocValuesFieldUpdatesType // primarily so it doesn't conflict with System.Type. - public class DocValuesFieldUpdates + public enum DocValuesFieldUpdatesType { - private DocValuesFieldUpdates() { } // Disallow creation - - public enum Type - { - NUMERIC, - BINARY - } + NUMERIC, + BINARY } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5fb89cf7/src/Lucene.Net.Core/Index/DocValuesUpdate.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs index fa9ac1f..17f20e8 100644 --- a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs +++ b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs @@ -36,7 +36,7 @@ namespace Lucene.Net.Index */ private static readonly int RAW_SIZE_IN_BYTES = 8 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 8 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 8 * RamUsageEstimator.NUM_BYTES_INT32; - internal readonly DocValuesFieldUpdates.Type type; + internal readonly DocValuesFieldUpdatesType type; internal readonly Term term; internal readonly string field; internal readonly object value; @@ -48,7 +48,7 @@ namespace Lucene.Net.Index /// <param name="term"> the <seealso cref="term"/> which determines the documents that will be updated </param> /// <param name="field"> the <seealso cref="NumericDocValuesField"/> to update </param> /// <param name="value"> the updated value </param> - protected DocValuesUpdate(DocValuesFieldUpdates.Type type, Term term, string field, object value) + protected DocValuesUpdate(DocValuesFieldUpdatesType type, Term term, string field, object value) { this.type = type; this.term = term; @@ -83,7 +83,7 @@ namespace Lucene.Net.Index internal static readonly BytesRef MISSING = new BytesRef(); internal BinaryDocValuesUpdate(Term term, string field, BytesRef value) - : base(DocValuesFieldUpdates.Type.BINARY, term, field, value == null ? MISSING : value) + : base(DocValuesFieldUpdatesType.BINARY, term, field, value == null ? MISSING : value) { } @@ -100,7 +100,7 @@ namespace Lucene.Net.Index internal static readonly long? MISSING = new long?(0); public NumericDocValuesUpdate(Term term, string field, long? value) - : base(DocValuesFieldUpdates.Type.NUMERIC, term, field, value == null ? MISSING : value) + : base(DocValuesFieldUpdatesType.NUMERIC, term, field, value == null ? MISSING : value) { } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5fb89cf7/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs b/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs index 50494de..a524b09 100644 --- a/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs +++ b/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs @@ -104,7 +104,7 @@ namespace Lucene.Net.Index private int size; public NumericDocValuesFieldUpdates(string field, int maxDoc) - : base(field, DocValuesFieldUpdates.Type.NUMERIC) + : base(field, DocValuesFieldUpdatesType.NUMERIC) { docsWithField = new FixedBitSet(64); docs = new PagedMutable(1, 1024, PackedInt32s.BitsRequired(maxDoc - 1), PackedInt32s.COMPACT);
