lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [01/12] lucenenet git commit: Lucene.Net.Core.Util.Automaton.RegExp refactor: Converted flags (constants) into [Flags] enum named RegExpSyntax
Date Mon, 06 Mar 2017 14:39:54 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work 418e54402 -> 85ac68c39


Lucene.Net.Core.Util.Automaton.RegExp refactor: Converted flags (constants) into [Flags] enum
named RegExpSyntax


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/37bc447b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/37bc447b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/37bc447b

Branch: refs/heads/api-work
Commit: 37bc447b6709e7664395b97b4d018f26e56183ca
Parents: 418e544
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Mar 6 06:58:05 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Mar 6 06:58:05 2017 +0700

----------------------------------------------------------------------
 .../Analysis/Hunspell/Dictionary.cs             |   2 +-
 src/Lucene.Net.Core/Search/RegexpQuery.cs       |  11 +-
 src/Lucene.Net.Core/Util/Automaton/RegExp.cs    | 126 ++++++++++---------
 .../Util/Automaton/AutomatonTestUtil.cs         |   6 +-
 .../Util/LuceneTestCase.cs                      |   3 +-
 .../Codecs/Lucene41/TestBlockPostingsFormat3.cs |   3 +-
 src/Lucene.Net.Tests/Index/TestTermsEnum.cs     |   7 +-
 src/Lucene.Net.Tests/Index/TestTermsEnum2.cs    |   6 +-
 .../Search/TestDocTermOrdsRewriteMethod.cs      |  15 +--
 .../Search/TestFieldCacheRewriteMethod.cs       |  16 +--
 src/Lucene.Net.Tests/Search/TestRegexpQuery.cs  |   7 +-
 .../Search/TestRegexpRandom2.cs                 |  11 +-
 .../Util/Automaton/TestBasicOperations.cs       |   2 +-
 .../Util/Automaton/TestDeterminism.cs           |   2 +-
 .../Util/Automaton/TestMinimize.cs              |   2 +-
 .../Util/Automaton/TestUTF32ToUTF8.cs           |   2 +-
 src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs       |   3 +-
 17 files changed, 121 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
index 8cf3503..2bc0ccc 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -488,7 +488,7 @@ namespace Lucene.Net.Analysis.Hunspell
                         throw new System.NotSupportedException("Too many patterns, please
report this to dev@lucene.apache.org");
                     }
                     seenPatterns[regex] = patternIndex;
-                    CharacterRunAutomaton pattern = new CharacterRunAutomaton((new RegExp(regex,
RegExp.NONE)).ToAutomaton());
+                    CharacterRunAutomaton pattern = new CharacterRunAutomaton((new RegExp(regex,
RegExpSyntax.NONE)).ToAutomaton());
                     patterns.Add(pattern);
                 }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Core/Search/RegexpQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/RegexpQuery.cs b/src/Lucene.Net.Core/Search/RegexpQuery.cs
index f84d742..7516676 100644
--- a/src/Lucene.Net.Core/Search/RegexpQuery.cs
+++ b/src/Lucene.Net.Core/Search/RegexpQuery.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Util.Automaton;
 using System.Text;
 
 namespace Lucene.Net.Search
@@ -69,7 +70,7 @@ namespace Lucene.Net.Search
         /// </summary>
         /// <param name="term"> regular expression. </param>
         public RegexpQuery(Term term)
-            : this(term, RegExp.ALL)
+            : this(term, RegExpSyntax.ALL)
         {
         }
 
@@ -77,8 +78,8 @@ namespace Lucene.Net.Search
         /// Constructs a query for terms matching <code>term</code>.
         /// </summary>
         /// <param name="term"> regular expression. </param>
-        /// <param name="flags"> optional RegExp features from <seealso cref="RegExp"/>
</param>
-        public RegexpQuery(Term term, int flags)
+        /// <param name="flags"> optional RegExp features from <see cref="RegExpSyntax"/>
</param>
+        public RegexpQuery(Term term, RegExpSyntax flags)
             : this(term, flags, defaultProvider)
         {
         }
@@ -87,9 +88,9 @@ namespace Lucene.Net.Search
         /// Constructs a query for terms matching <code>term</code>.
         /// </summary>
         /// <param name="term"> regular expression. </param>
-        /// <param name="flags"> optional RegExp features from <seealso cref="RegExp"/>
</param>
+        /// <param name="flags"> optional RegExp features from <see cref="RegExpSyntax"/>
</param>
         /// <param name="provider"> custom AutomatonProvider for named automata </param>
-        public RegexpQuery(Term term, int flags, IAutomatonProvider provider)
+        public RegexpQuery(Term term, RegExpSyntax flags, IAutomatonProvider provider)
             : base(term, (new RegExp(term.Text(), flags)).ToAutomaton(provider))
         {
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
index 49cba6a..6b69281 100644
--- a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
@@ -34,6 +34,54 @@ using System.Text;
 
 namespace Lucene.Net.Util.Automaton
 {
+    // LUCENENET specific - converted constants from RegExp
+    // into a flags enum.
+    [Flags]
+    public enum RegExpSyntax
+    {
+        /// <summary>
+        /// Syntax flag, enables intersection (<c>&amp;</c>).
+        /// </summary>
+        INTERSECTION = 0x0001,
+
+        /// <summary>
+        /// Syntax flag, enables complement (<c>~</c>).
+        /// </summary>
+        COMPLEMENT = 0x0002,
+
+        /// <summary>
+        /// Syntax flag, enables empty language (<c>#</c>).
+        /// </summary>
+        EMPTY = 0x0004,
+
+        /// <summary>
+        /// Syntax flag, enables anystring (<c>@</c>).
+        /// </summary>
+        ANYSTRING = 0x0008,
+
+        /// <summary>
+        /// Syntax flag, enables named automata (<c>&lt;</c>identifier<c>&gt;</c>).
+        /// </summary>
+        AUTOMATON = 0x0010,
+
+        /// <summary>
+        /// Syntax flag, enables numerical intervals (
+        /// <c>&lt;<i>n</i>-<i>m</i>&gt;</c>).
+        /// </summary>
+        INTERVAL = 0x0020,
+
+        /// <summary>
+        /// Syntax flag, enables all optional regexp syntax.
+        /// </summary>
+        ALL = 0xffff,
+
+        /// <summary>
+        /// Syntax flag, enables no optional regexp syntax.
+        /// </summary>
+        NONE = 0x0000
+    }
+
+
     /// <summary>
     /// Regular Expression extension to <code>Automaton</code>.
     /// <p>
@@ -334,48 +382,8 @@ namespace Lucene.Net.Util.Automaton
             REGEXP_INTERVAL
         }
 
-        // LUCENENET TODO: Make the following into a [Flags] enum
-
-        /// <summary>
-        /// Syntax flag, enables intersection (<tt>&amp;</tt>).
-        /// </summary>
-        public const int INTERSECTION = 0x0001;
-
-        /// <summary>
-        /// Syntax flag, enables complement (<tt>~</tt>).
-        /// </summary>
-        public const int COMPLEMENT = 0x0002;
-
-        /// <summary>
-        /// Syntax flag, enables empty language (<tt>#</tt>).
-        /// </summary>
-        public const int EMPTY = 0x0004;
-
-        /// <summary>
-        /// Syntax flag, enables anystring (<tt>@</tt>).
-        /// </summary>
-        public const int ANYSTRING = 0x0008;
-
-        /// <summary>
-        /// Syntax flag, enables named automata (<tt>&lt;</tt>identifier<tt>&gt;</tt>).
-        /// </summary>
-        public const int AUTOMATON = 0x0010;
-
-        /// <summary>
-        /// Syntax flag, enables numerical intervals (
-        /// <tt>&lt;<i>n</i>-<i>m</i>&gt;</tt>).
-        /// </summary>
-        public const int INTERVAL = 0x0020;
-
-        /// <summary>
-        /// Syntax flag, enables all optional regexp syntax.
-        /// </summary>
-        public const int ALL = 0xffff;
+        // LUCENENET specific - made flags into their own [Flags] enum named RegExpSyntax
and de-nested from this type
 
-        /// <summary>
-        /// Syntax flag, enables no optional regexp syntax.
-        /// </summary>
-        public const int NONE = 0x0000;
 
         private static bool allow_mutation = false;
 
@@ -387,7 +395,7 @@ namespace Lucene.Net.Util.Automaton
         internal int from, to;
 
         internal string b;
-        internal int flags;
+        internal RegExpSyntax flags;
         internal int pos;
 
         internal RegExp()
@@ -395,26 +403,26 @@ namespace Lucene.Net.Util.Automaton
         }
 
         /// <summary>
-        /// Constructs new <code>RegExp</code> from a string. Same as
-        /// <code>RegExp(s, ALL)</code>.
+        /// Constructs new <see cref="RegExp"/> from a string. Same as
+        /// <c>RegExp(s, RegExpSyntax.ALL)</c>.
         /// </summary>
         /// <param name="s"> regexp string </param>
-        /// <exception cref="IllegalArgumentException"> if an error occured while parsing
the
+        /// <exception cref="ArgumentException"> if an error occured while parsing
the
         ///              regular expression </exception>
         public RegExp(string s)
-            : this(s, ALL)
+            : this(s, RegExpSyntax.ALL)
         {
         }
 
         /// <summary>
-        /// Constructs new <code>RegExp</code> from a string.
+        /// Constructs new <see cref="RegExp"/> from a string.
         /// </summary>
         /// <param name="s"> regexp string </param>
-        /// <param name="syntax_flags"> boolean 'or' of optional syntax constructs
to be
+        /// <param name="syntax_flags"> boolean 'or' of optional <see cref="RegExpSyntax"/>
constructs to be
         ///          enabled </param>
-        /// <exception cref="IllegalArgumentException"> if an error occured while parsing
the
+        /// <exception cref="ArgumentException"> if an error occured while parsing
the
         ///              regular expression </exception>
-        public RegExp(string s, int syntax_flags)
+        public RegExp(string s, RegExpSyntax syntax_flags)
         {
             b = s;
             flags = syntax_flags;
@@ -995,7 +1003,7 @@ namespace Lucene.Net.Util.Automaton
             return ch;
         }
 
-        private bool Check(int flag)
+        private bool Check(RegExpSyntax flag)
         {
             return (flags & flag) != 0;
         }
@@ -1013,7 +1021,7 @@ namespace Lucene.Net.Util.Automaton
         internal RegExp ParseInterExp()
         {
             RegExp e = ParseConcatExp();
-            if (Check(INTERSECTION) && Match('&'))
+            if (Check(RegExpSyntax.INTERSECTION) && Match('&'))
             {
                 e = MakeIntersection(e, ParseInterExp());
             }
@@ -1023,7 +1031,7 @@ namespace Lucene.Net.Util.Automaton
         internal RegExp ParseConcatExp()
         {
             RegExp e = ParseRepeatExp();
-            if (More() && !Peek(")|") && (!Check(INTERSECTION) || !Peek("&")))
+            if (More() && !Peek(")|") && (!Check(RegExpSyntax.INTERSECTION)
|| !Peek("&")))
             {
                 e = MakeConcatenation(e, ParseConcatExp());
             }
@@ -1095,7 +1103,7 @@ namespace Lucene.Net.Util.Automaton
 
         internal RegExp ParseComplExp()
         {
-            if (Check(COMPLEMENT) && Match('~'))
+            if (Check(RegExpSyntax.COMPLEMENT) && Match('~'))
             {
                 return MakeComplement(ParseComplExp());
             }
@@ -1160,11 +1168,11 @@ namespace Lucene.Net.Util.Automaton
             {
                 return MakeAnyChar();
             }
-            else if (Check(EMPTY) && Match('#'))
+            else if (Check(RegExpSyntax.EMPTY) && Match('#'))
             {
                 return MakeEmpty();
             }
-            else if (Check(ANYSTRING) && Match('@'))
+            else if (Check(RegExpSyntax.ANYSTRING) && Match('@'))
             {
                 return MakeAnyString();
             }
@@ -1194,7 +1202,7 @@ namespace Lucene.Net.Util.Automaton
                 }
                 return e;
             }
-            else if ((Check(AUTOMATON) || Check(INTERVAL)) && Match('<'))
+            else if ((Check(RegExpSyntax.AUTOMATON) || Check(RegExpSyntax.INTERVAL)) &&
Match('<'))
             {
                 int start = pos;
                 while (More() && !Peek(">"))
@@ -1209,7 +1217,7 @@ namespace Lucene.Net.Util.Automaton
                 int i = s.IndexOf('-');
                 if (i == -1)
                 {
-                    if (!Check(AUTOMATON))
+                    if (!Check(RegExpSyntax.AUTOMATON))
                     {
                         throw new System.ArgumentException("interval syntax error at position
" + (pos - 1));
                     }
@@ -1217,7 +1225,7 @@ namespace Lucene.Net.Util.Automaton
                 }
                 else
                 {
-                    if (!Check(INTERVAL))
+                    if (!Check(RegExpSyntax.INTERVAL))
                     {
                         throw new System.ArgumentException("illegal identifier at position
" + (pos - 1));
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs b/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
index 2c0e1f9..9957087 100644
--- a/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
@@ -47,7 +47,7 @@ namespace Lucene.Net.Util.Automaton
                 }
                 try
                 {
-                    new RegExp(regexp, RegExp.NONE);
+                    new RegExp(regexp, RegExpSyntax.NONE);
                     return regexp;
                 }
 #pragma warning disable 168
@@ -370,13 +370,13 @@ namespace Lucene.Net.Util.Automaton
         public static Automaton RandomAutomaton(Random random)
         {
             // get two random Automata from regexps
-            Automaton a1 = (new RegExp(AutomatonTestUtil.RandomRegexp(random), RegExp.NONE)).ToAutomaton();
+            Automaton a1 = (new RegExp(AutomatonTestUtil.RandomRegexp(random), RegExpSyntax.NONE)).ToAutomaton();
             if (random.NextBoolean())
             {
                 a1 = BasicOperations.Complement(a1);
             }
 
-            Automaton a2 = (new RegExp(AutomatonTestUtil.RandomRegexp(random), RegExp.NONE)).ToAutomaton();
+            Automaton a2 = (new RegExp(AutomatonTestUtil.RandomRegexp(random), RegExpSyntax.NONE)).ToAutomaton();
             if (random.NextBoolean())
             {
                 a2 = BasicOperations.Complement(a2);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 081589e..808eb71 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -25,6 +25,7 @@ using Lucene.Net.Randomized;
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Search;
 using Lucene.Net.Support;
+using Lucene.Net.Util.Automaton;
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
@@ -1966,7 +1967,7 @@ namespace Lucene.Net.Util
                 for (int i = 0; i < numIntersections; i++)
                 {
                     string re = AutomatonTestUtil.RandomRegexp(Random());
-                    CompiledAutomaton automaton = new CompiledAutomaton((new RegExp(re, RegExp.NONE)).ToAutomaton());
+                    CompiledAutomaton automaton = new CompiledAutomaton((new RegExp(re, RegExpSyntax.NONE)).ToAutomaton());
                     if (automaton.Type == CompiledAutomaton.AUTOMATON_TYPE.NORMAL)
                     {
                         // TODO: test start term too

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat3.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat3.cs b/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat3.cs
index f074ab7..5fa01fd 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat3.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat3.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
 using Lucene.Net.Index;
 using Lucene.Net.Support;
+using Lucene.Net.Util.Automaton;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -218,7 +219,7 @@ namespace Lucene.Net.Codecs.Lucene41
                 for (int i = 0; i < numIntersections; i++)
                 {
                     string re = AutomatonTestUtil.RandomRegexp(Random());
-                    CompiledAutomaton automaton = new CompiledAutomaton((new RegExp(re, RegExp.NONE)).ToAutomaton());
+                    CompiledAutomaton automaton = new CompiledAutomaton((new RegExp(re, RegExpSyntax.NONE)).ToAutomaton());
                     if (automaton.Type == CompiledAutomaton.AUTOMATON_TYPE.NORMAL)
                     {
                         // TODO: test start term too

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
index 09a2ace..1fba210 100644
--- a/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
+++ b/src/Lucene.Net.Tests/Index/TestTermsEnum.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
 using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
 using Lucene.Net.Search;
+using Lucene.Net.Util.Automaton;
 
 namespace Lucene.Net.Index
 {
@@ -900,7 +901,7 @@ namespace Lucene.Net.Index
             w.Dispose();
             AtomicReader sub = GetOnlySegmentReader(r);
             Terms terms = sub.Fields.GetTerms("field");
-            Automaton automaton = (new RegExp(".*", RegExp.NONE)).ToAutomaton();
+            Automaton automaton = (new RegExp(".*", RegExpSyntax.NONE)).ToAutomaton();
             CompiledAutomaton ca = new CompiledAutomaton(automaton, false, false);
             TermsEnum te = terms.Intersect(ca, null);
             Assert.AreEqual("aaa", te.Next().Utf8ToString());
@@ -959,7 +960,7 @@ namespace Lucene.Net.Index
             AtomicReader sub = GetOnlySegmentReader(r);
             Terms terms = sub.Fields.GetTerms("field");
 
-            Automaton automaton = (new RegExp(".*d", RegExp.NONE)).ToAutomaton();
+            Automaton automaton = (new RegExp(".*d", RegExpSyntax.NONE)).ToAutomaton();
             CompiledAutomaton ca = new CompiledAutomaton(automaton, false, false);
             TermsEnum te;
 
@@ -1015,7 +1016,7 @@ namespace Lucene.Net.Index
             AtomicReader sub = GetOnlySegmentReader(r);
             Terms terms = sub.Fields.GetTerms("field");
 
-            Automaton automaton = (new RegExp(".*", RegExp.NONE)).ToAutomaton(); // accept
ALL
+            Automaton automaton = (new RegExp(".*", RegExpSyntax.NONE)).ToAutomaton(); //
accept ALL
             CompiledAutomaton ca = new CompiledAutomaton(automaton, false, false);
 
             TermsEnum te = terms.Intersect(ca, null);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs b/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
index 734cfe0..4e9034c 100644
--- a/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
+++ b/src/Lucene.Net.Tests/Index/TestTermsEnum2.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Index
             for (int i = 0; i < NumIterations; i++)
             {
                 string reg = AutomatonTestUtil.RandomRegexp(Random());
-                Automaton automaton = (new RegExp(reg, RegExp.NONE)).ToAutomaton();
+                Automaton automaton = (new RegExp(reg, RegExpSyntax.NONE)).ToAutomaton();
                 IList<BytesRef> matchedTerms = new List<BytesRef>();
                 foreach (BytesRef t in Terms)
                 {
@@ -123,7 +123,7 @@ namespace Lucene.Net.Index
             for (int i = 0; i < NumIterations; i++)
             {
                 string reg = AutomatonTestUtil.RandomRegexp(Random());
-                Automaton automaton = (new RegExp(reg, RegExp.NONE)).ToAutomaton();
+                Automaton automaton = (new RegExp(reg, RegExpSyntax.NONE)).ToAutomaton();
                 TermsEnum te = MultiFields.GetTerms(Reader, "field").GetIterator(null);
                 IList<BytesRef> unsortedTerms = new List<BytesRef>(Terms);
                 Collections.Shuffle(unsortedTerms);
@@ -186,7 +186,7 @@ namespace Lucene.Net.Index
             for (int i = 0; i < NumIterations; i++)
             {
                 string reg = AutomatonTestUtil.RandomRegexp(Random());
-                Automaton automaton = (new RegExp(reg, RegExp.NONE)).ToAutomaton();
+                Automaton automaton = (new RegExp(reg, RegExpSyntax.NONE)).ToAutomaton();
                 CompiledAutomaton ca = new CompiledAutomaton(automaton, SpecialOperations.IsFinite(automaton),
false);
                 TermsEnum te = MultiFields.GetTerms(Reader, "field").Intersect(ca, null);
                 Automaton expected = BasicOperations.Intersection(TermsAutomaton, automaton);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
index 7389e9e..a79772d 100644
--- a/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
+++ b/src/Lucene.Net.Tests/Search/TestDocTermOrdsRewriteMethod.cs
@@ -1,11 +1,12 @@
 using System;
 using System.Collections.Generic;
 using Lucene.Net.Documents;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Util.Automaton;
+using NUnit.Framework;
 
 namespace Lucene.Net.Search
 {
-    using Lucene.Net.Randomized.Generators;
-    using NUnit.Framework;
     using AutomatonTestUtil = Lucene.Net.Util.Automaton.AutomatonTestUtil;
     using BytesRef = Lucene.Net.Util.BytesRef;
     using Directory = Lucene.Net.Store.Directory;
@@ -134,9 +135,9 @@ namespace Lucene.Net.Search
         /// </summary>
         protected internal virtual void AssertSame(string regexp)
         {
-            RegexpQuery docValues = new RegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
+            RegexpQuery docValues = new RegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
             docValues.MultiTermRewriteMethod = (new DocTermOrdsRewriteMethod());
-            RegexpQuery inverted = new RegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
+            RegexpQuery inverted = new RegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
 
             TopDocs invertedDocs = Searcher1.Search(inverted, 25);
             TopDocs docValuesDocs = Searcher2.Search(docValues, 25);
@@ -147,9 +148,9 @@ namespace Lucene.Net.Search
         [Test]
         public virtual void TestEquals()
         {
-            RegexpQuery a1 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExp.NONE);
-            RegexpQuery a2 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExp.NONE);
-            RegexpQuery b = new RegexpQuery(new Term(FieldName, "[bB]"), RegExp.NONE);
+            RegexpQuery a1 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExpSyntax.NONE);
+            RegexpQuery a2 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExpSyntax.NONE);
+            RegexpQuery b = new RegexpQuery(new Term(FieldName, "[bB]"), RegExpSyntax.NONE);
             Assert.AreEqual(a1, a2);
             Assert.IsFalse(a1.Equals(b));
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Search/TestFieldCacheRewriteMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCacheRewriteMethod.cs b/src/Lucene.Net.Tests/Search/TestFieldCacheRewriteMethod.cs
index ee87c43..671a5b7 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCacheRewriteMethod.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCacheRewriteMethod.cs
@@ -1,7 +1,9 @@
+using Lucene.Net.Attributes;
+using Lucene.Net.Util.Automaton;
+using NUnit.Framework;
+
 namespace Lucene.Net.Search
 {
-    using Lucene.Net.Attributes;
-    using NUnit.Framework;
     using RegExp = Lucene.Net.Util.Automaton.RegExp;
 
     /*
@@ -33,10 +35,10 @@ namespace Lucene.Net.Search
         /// Test fieldcache rewrite against filter rewrite </summary>
         protected internal override void AssertSame(string regexp)
         {
-            RegexpQuery fieldCache = new RegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
+            RegexpQuery fieldCache = new RegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
             fieldCache.MultiTermRewriteMethod = (new FieldCacheRewriteMethod());
 
-            RegexpQuery filter = new RegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
+            RegexpQuery filter = new RegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
             filter.MultiTermRewriteMethod = (MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
 
             TopDocs fieldCacheDocs = Searcher1.Search(fieldCache, 25);
@@ -48,9 +50,9 @@ namespace Lucene.Net.Search
         [Test]
         public virtual void TestEquals()
         {
-            RegexpQuery a1 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExp.NONE);
-            RegexpQuery a2 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExp.NONE);
-            RegexpQuery b = new RegexpQuery(new Term(FieldName, "[bB]"), RegExp.NONE);
+            RegexpQuery a1 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExpSyntax.NONE);
+            RegexpQuery a2 = new RegexpQuery(new Term(FieldName, "[aA]"), RegExpSyntax.NONE);
+            RegexpQuery b = new RegexpQuery(new Term(FieldName, "[bB]"), RegExpSyntax.NONE);
             Assert.AreEqual(a1, a2);
             Assert.IsFalse(a1.Equals(b));
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs b/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
index 971cfa0..fc8afbc 100644
--- a/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
+++ b/src/Lucene.Net.Tests/Search/TestRegexpQuery.cs
@@ -1,9 +1,10 @@
+using Lucene.Net.Util.Automaton;
 using Lucene.Net.Documents;
+using Lucene.Net.Support;
+using NUnit.Framework;
 
 namespace Lucene.Net.Search
 {
-    using Lucene.Net.Support;
-    using NUnit.Framework;
     using Automaton = Lucene.Net.Util.Automaton.Automaton;
     using IAutomatonProvider = Lucene.Net.Util.Automaton.IAutomatonProvider;
     using BasicAutomata = Lucene.Net.Util.Automaton.BasicAutomata;
@@ -116,7 +117,7 @@ namespace Lucene.Net.Search
         public virtual void TestCustomProvider()
         {
             IAutomatonProvider myProvider = new AutomatonProviderAnonymousInnerClassHelper(this);
-            RegexpQuery query = new RegexpQuery(NewTerm("<quickBrown>"), RegExp.ALL,
myProvider);
+            RegexpQuery query = new RegexpQuery(NewTerm("<quickBrown>"), RegExpSyntax.ALL,
myProvider);
             Assert.AreEqual(1, Searcher.Search(query, 5).TotalHits);
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
index 434e75c..b4ac598 100644
--- a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
+++ b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs
@@ -1,11 +1,12 @@
 using System;
 using System.Collections.Generic;
 using Lucene.Net.Documents;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Util.Automaton;
+using NUnit.Framework;
 
 namespace Lucene.Net.Search
 {
-    using Lucene.Net.Randomized.Generators;
-    using NUnit.Framework;
     using AttributeSource = Lucene.Net.Util.AttributeSource;
     using Automaton = Lucene.Net.Util.Automaton.Automaton;
     using AutomatonTestUtil = Lucene.Net.Util.Automaton.AutomatonTestUtil;
@@ -111,7 +112,7 @@ namespace Lucene.Net.Search
         {
             private readonly Automaton Automaton;
 
-            internal DumbRegexpQuery(Term term, int flags)
+            internal DumbRegexpQuery(Term term, RegExpSyntax flags)
                 : base(term.Field)
             {
                 RegExp re = new RegExp(term.Text(), flags);
@@ -182,8 +183,8 @@ namespace Lucene.Net.Search
         /// </summary>
         protected internal virtual void AssertSame(string regexp)
         {
-            RegexpQuery smart = new RegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
-            DumbRegexpQuery dumb = new DumbRegexpQuery(new Term(FieldName, regexp), RegExp.NONE);
+            RegexpQuery smart = new RegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
+            DumbRegexpQuery dumb = new DumbRegexpQuery(new Term(FieldName, regexp), RegExpSyntax.NONE);
 
             TopDocs smartDocs = Searcher1.Search(smart, 25);
             TopDocs dumbDocs = Searcher2.Search(dumb, 25);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
index 14a961d..cc65247 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestBasicOperations.cs
@@ -146,7 +146,7 @@ namespace Lucene.Net.Util.Automaton
             int ITER2 = AtLeast(100);
             for (int i = 0; i < ITER1; i++)
             {
-                RegExp re = new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExp.NONE);
+                RegExp re = new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExpSyntax.NONE);
                 Automaton a = re.ToAutomaton();
                 Assert.IsFalse(BasicOperations.IsEmpty(a));
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Util/Automaton/TestDeterminism.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestDeterminism.cs b/src/Lucene.Net.Tests/Util/Automaton/TestDeterminism.cs
index b3a4270..d0d8df3 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestDeterminism.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestDeterminism.cs
@@ -35,7 +35,7 @@ namespace Lucene.Net.Util.Automaton
             int num = AtLeast(500);
             for (int i = 0; i < num; i++)
             {
-                AssertAutomaton((new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExp.NONE)).ToAutomaton());
+                AssertAutomaton((new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExpSyntax.NONE)).ToAutomaton());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Util/Automaton/TestMinimize.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestMinimize.cs b/src/Lucene.Net.Tests/Util/Automaton/TestMinimize.cs
index 0a01260..b2f6b52 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestMinimize.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestMinimize.cs
@@ -66,7 +66,7 @@ namespace Lucene.Net.Util.Automaton
         [Test]
         public virtual void TestMinimizeHuge()
         {
-            (new RegExp("+-*(A|.....|BC)*]", RegExp.NONE)).ToAutomaton();
+            (new RegExp("+-*(A|.....|BC)*]", RegExpSyntax.NONE)).ToAutomaton();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
index 4017c34..05f8228 100644
--- a/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
+++ b/src/Lucene.Net.Tests/Util/Automaton/TestUTF32ToUTF8.cs
@@ -242,7 +242,7 @@ namespace Lucene.Net.Util.Automaton
             int num = AtLeast(250);
             for (int i = 0; i < num; i++)
             {
-                AssertAutomaton((new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExp.NONE)).ToAutomaton());
+                AssertAutomaton((new RegExp(AutomatonTestUtil.RandomRegexp(Random()), RegExpSyntax.NONE)).ToAutomaton());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37bc447b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index caa3b6c..4762452 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Attributes;
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
+using Lucene.Net.Util.Automaton;
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
@@ -383,7 +384,7 @@ namespace Lucene.Net.Util.Fst
                 BytesRef term;
                 int ord = 0;
 
-                Automaton automaton = (new RegExp(".*", RegExp.NONE)).ToAutomaton();
+                Automaton automaton = (new RegExp(".*", RegExpSyntax.NONE)).ToAutomaton();
                 TermsEnum termsEnum2 = terms.Intersect(new CompiledAutomaton(automaton, false,
false), null);
 
                 while ((term = termsEnum.Next()) != null)


Mime
View raw message