lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dougs...@apache.org
Subject svn commit: r798995 [17/35] - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/ Lucene.Net/Analysis/ Lucene.Net/Analysis/Standard/ Lucene.Net/Document/ Lucene.Net/Index/ Lucene.Net/QueryParser/ Lucene.Net/Search/ Lucene.Net/Search/Function/ Lucene.Net...
Date Wed, 29 Jul 2009 18:04:24 GMT
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParser.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs Wed Jul 29 18:04:12 2009
@@ -91,12 +91,6 @@
 	/// <p>Note that QueryParser is <em>not</em> thread-safe.</p>
 	/// 
 	/// </summary>
-	/// <author>  Brian Goetz
-	/// </author>
-	/// <author>  Peter Halacsy
-	/// </author>
-	/// <author>  Tatu Saloranta
-	/// </author>
 	public class QueryParser : QueryParserConstants
 	{
 		private void  InitBlock()
@@ -141,7 +135,13 @@
 		internal DateTools.Resolution dateResolution = null;
 		// maps field names to date resolutions
 		internal System.Collections.IDictionary fieldToDateResolution = null;
-		
+
+        /// <summary>
+        /// The Collator to use when determining range inclusion, for use
+        /// when constructin RangeQuerys and ConstantScoreRangeQuerys
+        /// </summary>
+        internal System.Globalization.CompareInfo rangeCollator = null;
+
 		/// <summary>The default operator for parsing queries. 
 		/// Use {@link QueryParser#setDefaultOperator} to change it.
 		/// </summary>
@@ -178,7 +178,7 @@
 			{
 				// TopLevelQuery is a Query followed by the end-of-input (EOF)
 				Query res = TopLevelQuery(field);
-				return res != null ? res : new BooleanQuery();
+				return res != null ? res : newBooleanQuery(false);
 			}
 			catch (ParseException tme)
 			{
@@ -189,7 +189,7 @@
 			{
 				throw new ParseException("Cannot parse '" + query + "': " + tme.Message);
 			}
-			catch (BooleanQuery.TooManyClauses tmc)
+			catch (BooleanQuery.TooManyClauses)
 			{
 				throw new ParseException("Cannot parse '" + query + "': too many boolean clauses");
 			}
@@ -345,8 +345,7 @@
 		public virtual void  SetUseOldRangeQuery(bool useOldRangeQuery)
 		{
 			this.useOldRangeQuery = useOldRangeQuery;
-		}
-		
+		}	
 		
 		/// <seealso cref="SetUseOldRangeQuery(boolean)">
 		/// </seealso>
@@ -355,7 +354,6 @@
 			return useOldRangeQuery;
 		}
 		
-		
 		/// <summary> Set locale used by date range parsing.</summary>
 		public virtual void  SetLocale(System.Globalization.CultureInfo locale)
 		{
@@ -430,7 +428,36 @@
 			
 			return resolution;
 		}
-		
+
+        /// <summary>
+        /// Sets the collator used to determine index term inclusion in ranges
+        /// specified either for ConstantScoreRangeQuery or RangeQuery (if SetUseOldRangeQuery(bool)
+        /// is called with a parameter of true.
+        /// <para>
+        /// WARNING: Setting the rangeCollator to a non-null
+        /// collator using this method will cause every single index Term in the
+        /// Field referenced by lowerTerm and/or upperTerm to be examined.
+        /// Depending on the number of index Terms in this Field, the operation
+        /// could be very slow.
+        /// </para>
+        /// </summary>
+        /// <param name="rc">the collator to use when constructing RangeQuery and ConstantScoreRangeQuery</param>
+        public void SetRangeCollator(System.Globalization.CompareInfo rc)
+        {
+            rangeCollator = rc;
+        }
+
+        /// <summary>
+        /// Returns the collator used to determine index term inclusion in ranges
+        /// specified either for ConstantScoreRangeQuery or RangeQuery (if
+        /// SetUseOldRangeQuery(bool) is called with the parameter true).
+        /// </summary>
+        /// <returns></returns>
+        public System.Globalization.CompareInfo GetRangeCollator()
+        {
+            return rangeCollator;
+        }
+
 		public virtual void  AddClause(System.Collections.ArrayList clauses, int conj, int mods, Query q)
 		{
 			bool required, prohibited;
@@ -497,8 +524,8 @@
 			// PhraseQuery, or nothing based on the term count
 			
 			TokenStream source = analyzer.TokenStream(field, new System.IO.StringReader(queryText));
-			System.Collections.ArrayList v = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
-			Lucene.Net.Analysis.Token t;
+			System.Collections.ArrayList list = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
+			Lucene.Net.Analysis.Token nextToken;
 			int positionCount = 0;
 			bool severalTokensAtSamePosition = false;
 			
@@ -506,17 +533,17 @@
 			{
 				try
 				{
-					t = source.Next();
+                    nextToken = source.Next();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
-					t = null;
+                    nextToken = null;
 				}
-				if (t == null)
+                if (nextToken == null)
 					break;
-				v.Add(t);
-				if (t.GetPositionIncrement() != 0)
-					positionCount += t.GetPositionIncrement();
+                list.Add(nextToken);
+                if (nextToken.GetPositionIncrement() != 0)
+                    positionCount += nextToken.GetPositionIncrement();
 				else
 					severalTokensAtSamePosition = true;
 			}
@@ -524,17 +551,17 @@
 			{
 				source.Close();
 			}
-			catch (System.IO.IOException e)
+			catch (System.IO.IOException)
 			{
 				// ignore
 			}
 			
-			if (v.Count == 0)
+			if (list.Count == 0)
 				return null;
-			else if (v.Count == 1)
+			else if (list.Count == 1)
 			{
-				t = (Lucene.Net.Analysis.Token) v[0];
-				return new TermQuery(new Term(field, t.TermText()));
+                nextToken = (Lucene.Net.Analysis.Token)list[0];
+                return newTermQuery(new Term(field, nextToken.Term()));
 			}
 			else
 			{
@@ -544,10 +571,10 @@
 					{
 						// no phrase query:
 						BooleanQuery q = new BooleanQuery(true);
-						for (int i = 0; i < v.Count; i++)
+						for (int i = 0; i < list.Count; i++)
 						{
-							t = (Lucene.Net.Analysis.Token) v[i];
-							TermQuery currentQuery = new TermQuery(new Term(field, t.TermText()));
+                            nextToken = (Lucene.Net.Analysis.Token)list[i];
+                            Query currentQuery = newTermQuery(new Term(field, nextToken.Term()));
 							q.Add(currentQuery, BooleanClause.Occur.SHOULD);
 						}
 						return q;
@@ -559,10 +586,10 @@
 						mpq.SetSlop(phraseSlop);
 						System.Collections.ArrayList multiTerms = new System.Collections.ArrayList();
 						int position = - 1;
-						for (int i = 0; i < v.Count; i++)
+						for (int i = 0; i < list.Count; i++)
 						{
-							t = (Lucene.Net.Analysis.Token) v[i];
-							if (t.GetPositionIncrement() > 0 && multiTerms.Count > 0)
+                            nextToken = (Lucene.Net.Analysis.Token)list[i];
+                            if (nextToken.GetPositionIncrement() > 0 && multiTerms.Count > 0)
 							{
 								if (enablePositionIncrements)
 								{
@@ -574,8 +601,8 @@
 								}
 								multiTerms.Clear();
 							}
-							position += t.GetPositionIncrement();
-							multiTerms.Add(new Term(field, t.TermText()));
+                            position += nextToken.GetPositionIncrement();
+                            multiTerms.Add(new Term(field, nextToken.Term()));
 						}
 						if (enablePositionIncrements)
 						{
@@ -590,20 +617,20 @@
 				}
 				else
 				{
-					PhraseQuery pq = new PhraseQuery();
+					PhraseQuery pq = newPhraseQuery();
 					pq.SetSlop(phraseSlop);
 					int position = - 1;
-					for (int i = 0; i < v.Count; i++)
+					for (int i = 0; i < list.Count; i++)
 					{
-						t = (Lucene.Net.Analysis.Token) v[i];
+						nextToken = (Lucene.Net.Analysis.Token) list[i];
 						if (enablePositionIncrements)
 						{
-							position += t.GetPositionIncrement();
-							pq.Add(new Term(field, t.TermText()), position);
+							position += nextToken.GetPositionIncrement();
+							pq.Add(new Term(field, nextToken.Term()), position);
 						}
 						else
 						{
-							pq.Add(new Term(field, t.TermText()));
+							pq.Add(new Term(field, nextToken.Term()));
 						}
 					}
 					return pq;
@@ -694,21 +721,124 @@
 					part2 = DateTools.DateToString(d2, resolution);
 				}
 			}
-			catch (System.Exception e)
+			catch (System.Exception)
 			{
 			}
-			
-			if (useOldRangeQuery)
+
+            return newRangeQuery(field, part1, part2, inclusive);
+        }
+
+        /// <summary>
+        /// Builds a new BooleanQuery instance.
+        /// </summary>
+        /// <param name="disableCoord"></param>
+        /// <returns>new BooleanQuery instance</returns>
+        protected BooleanQuery newBooleanQuery(bool disableCoord)
+        {
+            return new BooleanQuery(disableCoord);
+        }
+
+        /// <summary>
+        /// Builds a new BooleanClause instance.
+        /// </summary>
+        /// <param name="q"></param>
+        /// <param name="occur"></param>
+        /// <returns>new BooleanClause instance</returns>
+        protected BooleanClause newBooleanClause(Query q, BooleanClause.Occur occur)
+        {
+            return new BooleanClause(q, occur);
+        }
+
+        /// <summary>
+        /// Builds a new TermQuery instance.
+        /// </summary>
+        /// <param name="term"></param>
+        /// <returns>new TermQuery instance</returns>
+        protected Query newTermQuery(Term term)
+        {
+            return new TermQuery(term);
+        }
+
+        /// <summary>
+        /// Builds a new PhraseQuery instance.
+        /// </summary>
+        /// <returns>new PhraseQuery instance</returns>
+        protected PhraseQuery newPhraseQuery()
+        {
+            return new PhraseQuery();
+        }
+
+        /// <summary>
+        /// Builds a new MultiPhraseQuery instance.
+        /// </summary>
+        /// <returns>new MultiPhraseQuery instance</returns>
+        protected MultiPhraseQuery newMultiPhraseQuery()
+        {
+            return new MultiPhraseQuery();
+        }
+
+        /// <summary>
+        /// Builds a new PrefixQuery instance.
+        /// </summary>
+        /// <param name="prefix"></param>
+        /// <returns>new PrefixQuery instance</returns>
+        protected Query newPrefixQuery(Term prefix)
+        {
+            return new PrefixQuery(prefix);
+        }
+
+        /// <summary>
+        /// Builds a new FuzzyQuery instance.
+        /// </summary>
+        /// <param name="term"></param>
+        /// <param name="minimumSimilarity"></param>
+        /// <param name="prefixLength"></param>
+        /// <returns>new FuzzyQuery instance</returns>
+        protected Query newFuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
+        {
+            return new FuzzyQuery(term, minimumSimilarity, prefixLength);
+        }
+
+        /// <summary>
+        /// Builds a new RangeQuery instance.
+        /// </summary>
+        /// <param name="field"></param>
+        /// <param name="part1"></param>
+        /// <param name="part2"></param>
+        /// <param name="inclusive"></param>
+        /// <returns>new RangeQuery instance</returns>
+        protected Query newRangeQuery(String field, String part1, String part2, bool inclusive)
+        {
+            if (useOldRangeQuery)
 			{
-				return new RangeQuery(new Term(field, part1), new Term(field, part2), inclusive);
+				return new RangeQuery(new Term(field, part1), new Term(field, part2), inclusive, rangeCollator);
 			}
 			else
 			{
-				return new ConstantScoreRangeQuery(field, part1, part2, inclusive, inclusive);
+				return new ConstantScoreRangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
 			}
 		}
-		
-		/// <summary> Factory method for generating query, given a set of clauses.
+
+        /// <summary>
+        /// Builds a new MatchAllDocsQuery instance.
+        /// </summary>
+        /// <returns>new MatchAllDocsQuery instance</returns>
+        protected Query newMatchAllDocsQuery()
+        {
+            return new MatchAllDocsQuery();
+        }
+
+        /// <summary>
+        /// Builds a new WildcardQuery instance.
+        /// </summary>
+        /// <param name="term"></param>
+        /// <returns>new WildcardQuery instance</returns>
+        protected Query newWildcardQuery(Term t)
+        {
+            return new WildcardQuery(t);
+        }
+
+        /// <summary> Factory method for generating query, given a set of clauses.
 		/// By default creates a boolean query composed of clauses passed in.
 		/// 
 		/// Can be overridden by extending classes, to modify query being
@@ -788,7 +918,7 @@
 			if ("*".Equals(field))
 			{
 				if ("*".Equals(termStr))
-					return new MatchAllDocsQuery();
+					return newMatchAllDocsQuery();
 			}
 			if (!allowLeadingWildcard && (termStr.StartsWith("*") || termStr.StartsWith("?")))
 				throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
@@ -797,7 +927,7 @@
 				termStr = termStr.ToLower();
 			}
 			Term t = new Term(field, termStr);
-			return new WildcardQuery(t);
+			return newWildcardQuery(t);
 		}
 		
 		/// <summary> Factory method for generating a query (similar to
@@ -835,7 +965,7 @@
 				termStr = termStr.ToLower();
 			}
 			Term t = new Term(field, termStr);
-			return new PrefixQuery(t);
+			return newPrefixQuery(t);
 		}
 		
 		
@@ -860,14 +990,14 @@
 				termStr = termStr.ToLower();
 			}
 			Term t = new Term(field, termStr);
-			return new FuzzyQuery(t, minSimilarity, fuzzyPrefixLength);
+			return newFuzzyQuery(t, minSimilarity, fuzzyPrefixLength);
 		}
 		
 		/// <summary> Returns a String where the escape char has been
 		/// removed, or kept only once if there was a double escape.
 		/// 
 		/// Supports escaped unicode characters, e. g. translates
-		/// <code>A</code> to <code>A</code>.
+		/// <code>\\u0041</code> to <code>A</code>.
 		/// 
 		/// </summary>
 		private System.String DiscardEscapeChar(System.String input)
@@ -1248,7 +1378,7 @@
                     f = (float) SupportClass.Single.Parse(boost.image);
 					q.SetBoost(f);
 				}
-				catch (System.Exception ignored)
+				catch (System.Exception)
 				{
 				}
 			}
@@ -1265,7 +1395,7 @@
 			bool prefix = false;
 			bool wildcard = false;
 			bool fuzzy = false;
-			bool rangein = false;
+			//bool rangein = false;
 			Query q;
 			switch ((jj_ntk == - 1) ? Jj_ntk() : jj_ntk)
 			{
@@ -1365,7 +1495,7 @@
 						{
                             fms = (float) SupportClass.Single.Parse(fuzzySlop.image.Substring(1));
                         }
-						catch (System.Exception ignored)
+						catch (System.Exception)
 						{
 						}
 						if (fms < 0.0f || fms > 1.0f)
@@ -1571,7 +1701,7 @@
 						{
                             s = (int) SupportClass.Single.Parse(fuzzySlop.image.Substring(1));
 						}
-						catch (System.Exception ignored)
+						catch (System.Exception)
 						{
 						}
 					}
@@ -1591,7 +1721,7 @@
 				{
                     f = (float) SupportClass.Single.Parse(boost.image);
 				}
-				catch (System.Exception ignored)
+				catch (System.Exception)
 				{
 					/* Should this be handled somehow? (defaults to "no boost", if
 					* boost number is invalid)
@@ -1618,7 +1748,7 @@
 			{
 				return !Jj_3_1();
 			}
-			catch (LookaheadSuccess ls)
+			catch (LookaheadSuccess)
 			{
 				return true;
 			}
@@ -1627,6 +1757,15 @@
 				Jj_save(0, xla);
 			}
 		}
+
+        private bool Jj_3R_3()
+        {
+            if (Jj_scan_token(Lucene.Net.QueryParsers.QueryParserConstants.STAR))
+                return true;
+            if (Jj_scan_token(Lucene.Net.QueryParsers.QueryParserConstants.COLON))
+                return true;
+            return false;
+        }
 		
 		private bool Jj_3R_2()
 		{
@@ -1650,31 +1789,30 @@
 			return false;
 		}
 		
-		private bool Jj_3R_3()
-		{
-			if (Jj_scan_token(Lucene.Net.QueryParsers.QueryParserConstants.STAR))
-				return true;
-			if (Jj_scan_token(Lucene.Net.QueryParsers.QueryParserConstants.COLON))
-				return true;
-			return false;
-		}
-		
+        /// <summary>
+        /// Generated token manager
+        /// </summary>
 		public QueryParserTokenManager token_source;
-		public Token token, jj_nt;
+        /// <summary>
+        /// Current token
+        /// </summary>
+        public Token token;
+        /// <summary>
+        /// Next token.
+        /// </summary>
+        public Token jj_nt;
 		private int jj_ntk;
 		private Token jj_scanpos, jj_lastpos;
 		private int jj_la;
-		public bool lookingAhead = false;
-		private bool jj_semLA;
 		private int jj_gen;
 		private int[] jj_la1 = new int[23];
 		private static uint[] jj_la1_0;
 		private static uint[] jj_la1_1;
-		private static void  Jj_la1_0()
+		private static void  Jj_la1_init_0()
 		{
 			jj_la1_0 = new uint[]{0x180, 0x180, 0xe00, 0xe00, 0x1f69f80, 0x48000, 0x10000, 0x1f69000, 0x1348000, 0x80000, 0x80000, 0x10000, 0x18000000, 0x2000000, 0x18000000, 0x10000, 0x80000000, 0x20000000, 0x80000000, 0x10000, 0x80000, 0x10000, 0x1f68000};
 		}
-		private static void  Jj_la1_1()
+		private static void  Jj_la1_init_1()
 		{
 			jj_la1_1 = new uint[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0};
 		}
@@ -1682,6 +1820,10 @@
 		private bool jj_rescan = false;
 		private int jj_gc = 0;
 		
+        /// <summary>
+        /// Constructor with used supplied CharStream.
+        /// </summary>
+        /// <param name="stream"></param>
 		public QueryParser(CharStream stream)
 		{
 			InitBlock();
@@ -1695,6 +1837,10 @@
 				jj_2_rtns[i] = new JJCalls();
 		}
 		
+        /// <summary>
+        /// Reinitialise.
+        /// </summary>
+        /// <param name="stream"></param>
 		public virtual void  ReInit(CharStream stream)
 		{
 			token_source.ReInit(stream);
@@ -1707,6 +1853,10 @@
 				jj_2_rtns[i] = new JJCalls();
 		}
 		
+        /// <summary>
+        /// Constructor with generated TokenManager.
+        /// </summary>
+        /// <param name="tm"></param>
 		public QueryParser(QueryParserTokenManager tm)
 		{
 			InitBlock();
@@ -1720,6 +1870,10 @@
 				jj_2_rtns[i] = new JJCalls();
 		}
 		
+        /// <summary>
+        /// Reinitialise.
+        /// </summary>
+        /// <param name="tm"></param>
 		public virtual void  ReInit(QueryParserTokenManager tm)
 		{
 			token_source = tm;
@@ -1804,6 +1958,10 @@
 			return false;
 		}
 		
+        /// <summary>
+        /// Get the next Token.
+        /// </summary>
+        /// <returns></returns>
 		public Token GetNextToken()
 		{
 			if (token.next != null)
@@ -1815,9 +1973,14 @@
 			return token;
 		}
 		
+        /// <summary>
+        /// Get the specific Token.
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
 		public Token GetToken(int index)
 		{
-			Token t = lookingAhead ? jj_scanpos : token;
+			Token t = token;
 			for (int i = 0; i < index; i++)
 			{
 				if (t.next != null)
@@ -1857,40 +2020,41 @@
 				{
 					jj_expentry[i] = jj_lasttokens[i];
 				}
-				bool exists = false;
-				for (System.Collections.IEnumerator e = jj_expentries.GetEnumerator(); e.MoveNext(); )
+                // {dougsale-2.4.0}
+                // Java handles this control flow differently than C#
+                // Java does not re-execute the initiation step of the for loop, C# does.
+                // So, break out the initiation step and place it before the labeled statement.
+                //jj_entries_loop: for (System.Collections.IEnumerator e = jj_expentries.GetEnumerator(); e.MoveNext(); )
+                System.Collections.IEnumerator e = jj_expentries.GetEnumerator();
+                jj_entries_loop: for (; e.MoveNext(); )
 				{
 					int[] oldentry = (int[]) (e.Current);
 					if (oldentry.Length == jj_expentry.Length)
 					{
-						exists = true;
 						for (int i = 0; i < jj_expentry.Length; i++)
 						{
 							if (oldentry[i] != jj_expentry[i])
 							{
-								exists = false;
-								break;
+                                goto jj_entries_loop;
 							}
 						}
-						if (exists)
-							break;
+                        jj_expentries.Add(jj_expentry);
+						break;
 					}
 				}
-				if (!exists)
-					jj_expentries.Add(jj_expentry);
 				if (pos != 0)
 					jj_lasttokens[(jj_endpos = pos) - 1] = kind;
 			}
 		}
 		
+        /// <summary>
+        /// Generate ParseException.
+        /// </summary>
+        /// <returns></returns>
 		public virtual ParseException GenerateParseException()
 		{
 			jj_expentries.Clear();
-			bool[] la1tokens = new bool[33];
-			for (int i = 0; i < 33; i++)
-			{
-				la1tokens[i] = false;
-			}
+			bool[] la1tokens = new bool[34];
 			if (jj_kind >= 0)
 			{
 				la1tokens[jj_kind] = true;
@@ -1913,7 +2077,7 @@
 					}
 				}
 			}
-			for (int i = 0; i < 33; i++)
+			for (int i = 0; i < 34; i++)
 			{
 				if (la1tokens[i])
 				{
@@ -1933,10 +2097,16 @@
 			return new ParseException(token, exptokseq, Lucene.Net.QueryParsers.QueryParserConstants.tokenImage);
 		}
 		
+        /// <summary>
+        /// Enable tracing.
+        /// </summary>
 		public void  Enable_tracing()
 		{
 		}
 		
+        /// <summary>
+        /// Disable tracing.
+        /// </summary>
 		public void  Disable_tracing()
 		{
 		}
@@ -1946,21 +2116,25 @@
 			jj_rescan = true;
 			for (int i = 0; i < 1; i++)
 			{
-				JJCalls p = jj_2_rtns[i];
-				do 
-				{
-					if (p.gen > jj_gen)
-					{
-						jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
-						switch (i)
-						{
-							
-							case 0:  Jj_3_1(); break;
-							}
-					}
-					p = p.next;
-				}
-				while (p != null);
+                try
+                {
+                    JJCalls p = jj_2_rtns[i];
+                    do
+                    {
+                        if (p.gen > jj_gen)
+                        {
+                            jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+                            switch (i)
+                            {
+
+                                case 0: Jj_3_1(); break;
+                            }
+                        }
+                        p = p.next;
+                    }
+                    while (p != null);
+                }
+                catch (LookaheadSuccess) { }
 			}
 			jj_rescan = false;
 		}
@@ -1986,11 +2160,12 @@
 			internal int arg;
 			internal JJCalls next;
 		}
+
 		static QueryParser()
 		{
 			{
-				Jj_la1_0();
-				Jj_la1_1();
+				Jj_la1_init_0();
+				Jj_la1_init_1();
 			}
 		}
 	}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParserConstants.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserConstants.cs Wed Jul 29 18:04:12 2009
@@ -2,15 +2,18 @@
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
+ * The ASF licenses this file to You under the Apache License,
+Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
- * Unless required by applicable law or agreed to in writing, software
+ * Unless required by applicable law or agreed to in writing,
+software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
@@ -21,45 +24,126 @@
 
 namespace Lucene.Net.QueryParsers
 {
-	
+	/// <summary>
+	/// Token literal values and constants.
+    /// Generated by org.javacc.parser.OtherFilesGen#start()
+	/// </summary>
 	public class QueryParserConstants
 	{
-		public const int EOF = 0;
-		public const int _NUM_CHAR = 1;
-		public const int _ESCAPED_CHAR = 2;
-		public const int _TERM_START_CHAR = 3;
-		public const int _TERM_CHAR = 4;
-		public const int _WHITESPACE = 5;
-		public const int AND = 7;
-		public const int OR = 8;
-		public const int NOT = 9;
-		public const int PLUS = 10;
-		public const int MINUS = 11;
-		public const int LPAREN = 12;
-		public const int RPAREN = 13;
-		public const int COLON = 14;
-		public const int STAR = 15;
-		public const int CARAT = 16;
-		public const int QUOTED = 17;
-		public const int TERM = 18;
-		public const int FUZZY_SLOP = 19;
-		public const int PREFIXTERM = 20;
-		public const int WILDTERM = 21;
-		public const int RANGEIN_START = 22;
-		public const int RANGEEX_START = 23;
-		public const int NUMBER = 24;
-		public const int RANGEIN_TO = 25;
-		public const int RANGEIN_END = 26;
-		public const int RANGEIN_QUOTED = 27;
-		public const int RANGEIN_GOOP = 28;
-		public const int RANGEEX_TO = 29;
-		public const int RANGEEX_END = 30;
-		public const int RANGEEX_QUOTED = 31;
-		public const int RANGEEX_GOOP = 32;
-		public const int Boost = 0;
-		public const int RangeEx = 1;
-		public const int RangeIn = 2;
-		public const int DEFAULT = 3;
-		public static System.String[] tokenImage = new System.String[]{"<EOF>", "<_NUM_CHAR>", "<_ESCAPED_CHAR>", "<_TERM_START_CHAR>", "<_TERM_CHAR>", "<_WHITESPACE>", "<token of kind 6>", "<AND>", "<OR>", "<NOT>", "\"+\"", "\"-\"", "\"(\"", "\")\"", "\":\"", "\"*\"", "\"^\"", "<QUOTED>", "<TERM>", "<FUZZY_SLOP>", "<PREFIXTERM>", "<WILDTERM>", "\"[\"", "\"{\"", "<NUMBER>", "\"TO\"", "\"]\"", "<RANGEIN_QUOTED>", "<RANGEIN_GOOP>", "\"TO\"", "\"}\"", "<RANGEEX_QUOTED>", "<RANGEEX_GOOP>"};
+        /// <summary>End of File.</summary>
+        public const int EOF = 0;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _NUM_CHAR = 1;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _ESCAPED_CHAR = 2;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _TERM_START_CHAR = 3;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _TERM_CHAR = 4;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _WHITESPACE = 5;
+        /// <summary>RegularExpression Id.</summary>
+        public const int _QUOTED_CHAR = 6;
+        /// <summary>RegularExpression Id.</summary>
+        public const int AND = 8;
+        /// <summary>RegularExpression Id.</summary>
+        public const int OR = 9;
+        /// <summary>RegularExpression Id.</summary>
+        public const int NOT = 10;
+        /// <summary>RegularExpression Id.</summary>
+        public const int PLUS = 11;
+        /// <summary>RegularExpression Id.</summary>
+        public const int MINUS = 12;
+        /// <summary>RegularExpression Id.</summary>
+        public const int LPAREN = 13;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RPAREN = 14;
+        /// <summary>RegularExpression Id.</summary>
+        public const int COLON = 15;
+        /// <summary>RegularExpression Id.</summary>
+        public const int STAR = 16;
+        /// <summary>RegularExpression Id.</summary>
+        public const int CARAT = 17;
+        /// <summary>RegularExpression Id.</summary>
+        public const int QUOTED = 18;
+        /// <summary>RegularExpression Id.</summary>
+        public const int TERM = 19;
+        /// <summary>RegularExpression Id.</summary>
+        public const int FUZZY_SLOP = 20;
+        /// <summary>RegularExpression Id.</summary>
+        public const int PREFIXTERM = 21;
+        /// <summary>RegularExpression Id.</summary>
+        public const int WILDTERM = 22;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEIN_START = 23;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEEX_START = 24;
+        /// <summary>RegularExpression Id.</summary>
+        public const int NUMBER = 25;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEIN_TO = 26;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEIN_END = 27;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEIN_QUOTED = 28;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEIN_GOOP = 29;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEEX_TO = 30;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEEX_END = 31;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEEX_QUOTED = 32;
+        /// <summary>RegularExpression Id.</summary>
+        public const int RANGEEX_GOOP = 33;
+
+        /// <summary>Lexical state.</summary>
+        public const int Boost = 0;
+        /// <summary>Lexical state.</summary>
+        public const int RangeEx = 1;
+        /// <summary>Lexical state.</summary>
+        public const int RangeIn = 2;
+        /// <summary>Lexical state.</summary>
+        public const int DEFAULT = 3;
+
+        /// <summary>
+        /// Literal token values.
+        /// </summary>
+		public static string[] tokenImage = new string[] {
+            "<EOF>",
+            "<_NUM_CHAR>",
+            "<_ESCAPED_CHAR>",
+            "<_TERM_START_CHAR>",
+            "<_TERM_CHAR>",
+            "<_WHITESPACE>",
+            "<_QUOTED_CHAR>",
+            "<token of kind 7>",
+            "<AND>",
+            "<OR>",
+            "<NOT>",
+            "\"+\"",
+            "\"-\"",
+            "\"(\"",
+            "\")\"",
+            "\":\"",
+            "\"*\"",
+            "\"^\"",
+            "<QUOTED>",
+            "<TERM>",
+            "<FUZZY_SLOP>",
+            "<PREFIXTERM>",
+            "<WILDTERM>",
+            "\"[\"",
+            "\"{\"",
+            "<NUMBER>",
+            "\"TO\"",
+            "\"]\"",
+            "<RANGEIN_QUOTED>",
+            "<RANGEIN_GOOP>",
+            "\"TO\"",
+            "\"}\"",
+            "<RANGEEX_QUOTED>",
+            "<RANGEEX_GOOP>"
+        };
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs Wed Jul 29 18:04:12 2009
@@ -63,101 +63,66 @@
 			jjmatchedPos = pos;
 			return pos + 1;
 		}
-		private int JjStartNfaWithStates_3(int pos, int kind, int state)
-		{
-			jjmatchedKind = kind;
-			jjmatchedPos = pos;
-			try
-			{
-				curChar = input_stream.ReadChar();
-			}
-			catch (System.IO.IOException)
-			{
-				return pos + 1;
-			}
-			return JjMoveNfa_3(state, pos + 1);
-		}
 		private int JjMoveStringLiteralDfa0_3()
 		{
 			switch (curChar)
 			{
 				
 				case (char) (40): 
-					return JjStopAtPos(0, 12);
+					return JjStopAtPos(0, 13);
 				
 				case (char) (41): 
-					return JjStopAtPos(0, 13);
+					return JjStopAtPos(0, 14);
 				
 				case (char) (42): 
-					return JjStartNfaWithStates_3(0, 15, 36);
+					return JjStartNfaWithStates_3(0, 16, 36);
 				
 				case (char) (43): 
-					return JjStopAtPos(0, 10);
+					return JjStopAtPos(0, 11);
 				
 				case (char) (45): 
-					return JjStopAtPos(0, 11);
+					return JjStopAtPos(0, 12);
 				
 				case (char) (58): 
-					return JjStopAtPos(0, 14);
+					return JjStopAtPos(0, 15);
 				
 				case (char) (91): 
-					return JjStopAtPos(0, 22);
+					return JjStopAtPos(0, 23);
 				
 				case (char) (94): 
-					return JjStopAtPos(0, 16);
+					return JjStopAtPos(0, 17);
 				
 				case (char) (123): 
-					return JjStopAtPos(0, 23);
+					return JjStopAtPos(0, 24);
 				
 				default: 
 					return JjMoveNfa_3(0, 0);
 				
 			}
 		}
-		private void  JjCheckNAdd(int state)
-		{
-			if (jjrounds[state] != jjround)
-			{
-				jjstateSet[jjnewStateCnt++] = state;
-				jjrounds[state] = jjround;
-			}
-		}
-		private void  JjAddStates(int start, int end)
-		{
-			do 
-			{
-				jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-			}
-			while (start++ != end);
-		}
-		private void  JjCheckNAddTwoStates(int state1, int state2)
-		{
-			JjCheckNAdd(state1);
-			JjCheckNAdd(state2);
-		}
-		private void  JjCheckNAddStates(int start, int end)
-		{
-			do 
-			{
-				JjCheckNAdd(jjnextStates[start]);
-			}
-			while (start++ != end);
-		}
-		private void  JjCheckNAddStates(int start)
-		{
-			JjCheckNAdd(jjnextStates[start]);
-			JjCheckNAdd(jjnextStates[start + 1]);
-		}
+        private int JjStartNfaWithStates_3(int pos, int kind, int state)
+        {
+            jjmatchedKind = kind;
+            jjmatchedPos = pos;
+            try
+            {
+                curChar = input_stream.ReadChar();
+            }
+            catch (System.IO.IOException)
+            {
+                return pos + 1;
+            }
+            return JjMoveNfa_3(state, pos + 1);
+        }
 		internal static readonly ulong[] jjbitVec0 = new ulong[]{0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL};
 		internal static readonly ulong[] jjbitVec2 = new ulong[]{0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL};
 		private int JjMoveNfa_3(int startState, int curPos)
 		{
-			int[] nextStates;
 			int startsAt = 0;
 			jjnewStateCnt = 36;
 			int i = 1;
 			jjstateSet[0] = startState;
-			int j, kind = 0x7fffffff;
+			int kind = 0x7fffffff;
 			for (; ; )
 			{
 				if (++jjround == 0x7fffffff)
@@ -176,48 +141,48 @@
 							case 25: 
 								if ((0xfbfffcf8ffffd9ffL & l) == (ulong) 0L)
 									break;
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
 							case 0: 
 								if ((0xfbffd4f8ffffd9ffL & l) != (ulong) 0L)
 								{
-									if (kind > 21)
-										kind = 21;
+									if (kind > 22)
+										kind = 22;
 									JjCheckNAddTwoStates(25, 26);
 								}
 								else if ((0x100002600L & l) != (ulong) 0L)
 								{
-									if (kind > 6)
-										kind = 6;
+									if (kind > 7)
+										kind = 7;
 								}
 								else if (curChar == 34)
 									JjCheckNAddStates(0, 2);
 								else if (curChar == 33)
 								{
-									if (kind > 9)
-										kind = 9;
+									if (kind > 10)
+										kind = 10;
 								}
 								if ((0x7bffd0f8ffffd9ffL & l) != (ulong) 0L)
 								{
-									if (kind > 18)
-										kind = 18;
+									if (kind > 19)
+										kind = 19;
 									JjCheckNAddStates(3, 7);
 								}
 								else if (curChar == 42)
 								{
-									if (kind > 20)
-										kind = 20;
+									if (kind > 21)
+										kind = 21;
 								}
 								if (curChar == 38)
 									jjstateSet[jjnewStateCnt++] = 4;
 								break;
 							
 							case 4: 
-								if (curChar == 38 && kind > 7)
-									kind = 7;
+								if (curChar == 38 && kind > 8)
+									kind = 8;
 								break;
 							
 							case 5: 
@@ -226,12 +191,11 @@
 								break;
 							
 							case 13: 
-								if (curChar == 33 && kind > 9)
-									kind = 9;
+								if (curChar == 33 && kind > 10)
+									kind = 10;
 								break;
 							
 							case 14: 
-							case 16: 
 								if (curChar == 34)
 									JjCheckNAddStates(0, 2);
 								break;
@@ -241,16 +205,20 @@
 									JjCheckNAddStates(0, 2);
 								break;
 							
+                            case 17:
+                                JjCheckNAddStates(0, 2);
+                                break;
+
 							case 18: 
-								if (curChar == 34 && kind > 17)
-									kind = 17;
+								if (curChar == 34 && kind > 18)
+									kind = 18;
 								break;
 							
 							case 20: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-								if (kind > 19)
-									kind = 19;
+								if (kind > 20)
+									kind = 20;
 								JjAddStates(8, 9);
 								break;
 							
@@ -262,49 +230,49 @@
 							case 22: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-								if (kind > 19)
-									kind = 19;
+								if (kind > 20)
+									kind = 20;
 								JjCheckNAdd(22);
 								break;
 							
 							case 23: 
-								if (curChar == 42 && kind > 20)
-									kind = 20;
+								if (curChar == 42 && kind > 21)
+									kind = 21;
 								break;
 							
 							case 24: 
 								if ((0xfbffd4f8ffffd9ffL & l) == (ulong) 0L)
 									break;
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
 							case 27: 
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
 							case 28: 
 								if ((0x7bffd0f8ffffd9ffL & l) == (ulong) 0L)
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddStates(3, 7);
 								break;
 							
 							case 29: 
 								if ((0x7bfff8f8ffffd9ffL & l) == (ulong) 0L)
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddTwoStates(29, 30);
 								break;
 							
 							case 31: 
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddTwoStates(29, 30);
 								break;
 							
@@ -336,8 +304,8 @@
 							case 36: 
 								if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
 								{
-									if (kind > 21)
-										kind = 21;
+									if (kind > 22)
+										kind = 22;
 									JjCheckNAddTwoStates(25, 26);
 								}
 								else if (curChar == 92)
@@ -347,22 +315,22 @@
 							case 0: 
 								if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
 								{
-									if (kind > 18)
-										kind = 18;
+									if (kind > 19)
+										kind = 19;
 									JjCheckNAddStates(3, 7);
 								}
 								else if (curChar == 92)
 									JjCheckNAddStates(13, 15);
 								else if (curChar == 126)
 								{
-									if (kind > 19)
-										kind = 19;
+									if (kind > 20)
+										kind = 20;
 									jjstateSet[jjnewStateCnt++] = 20;
 								}
 								if ((0x97ffffff87ffffffL & l) != (ulong) 0L)
 								{
-									if (kind > 21)
-										kind = 21;
+									if (kind > 22)
+										kind = 22;
 									JjCheckNAddTwoStates(25, 26);
 								}
 								if (curChar == 78)
@@ -376,8 +344,8 @@
 								break;
 							
 							case 1: 
-								if (curChar == 68 && kind > 7)
-									kind = 7;
+								if (curChar == 68 && kind > 8)
+									kind = 8;
 								break;
 							
 							case 2: 
@@ -391,8 +359,8 @@
 								break;
 							
 							case 6: 
-								if (curChar == 82 && kind > 8)
-									kind = 8;
+								if (curChar == 82 && kind > 9)
+									kind = 9;
 								break;
 							
 							case 7: 
@@ -401,8 +369,8 @@
 								break;
 							
 							case 8: 
-								if (curChar == 124 && kind > 8)
-									kind = 8;
+								if (curChar == 124 && kind > 9)
+									kind = 9;
 								break;
 							
 							case 9: 
@@ -411,8 +379,8 @@
 								break;
 							
 							case 10: 
-								if (curChar == 84 && kind > 9)
-									kind = 9;
+								if (curChar == 84 && kind > 10)
+									kind = 10;
 								break;
 							
 							case 11: 
@@ -425,36 +393,41 @@
 									jjstateSet[jjnewStateCnt++] = 11;
 								break;
 							
-							case 15: 
-								JjAddStates(0, 2);
+							case 15:
+                                if ((0xffffffffefffffffL & l) != (ulong)0L)
+								JjCheckNAddStates(0, 2);
 								break;
 							
-							case 17: 
-								if (curChar == 92)
-									jjstateSet[jjnewStateCnt++] = 16;
+                            case 16:
+                                if (curChar == 92)
+                                    jjstateSet[jjnewStateCnt++] = 17;
+                                break;
+
+							case 17:
+                                JjCheckNAddStates(0, 2);
 								break;
 							
 							case 19: 
 								if (curChar != 126)
 									break;
-								if (kind > 19)
-									kind = 19;
+								if (kind > 20)
+									kind = 20;
 								jjstateSet[jjnewStateCnt++] = 20;
 								break;
 							
 							case 24: 
 								if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
 							case 25: 
 								if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
@@ -464,24 +437,24 @@
 								break;
 							
 							case 27: 
-								if (kind > 21)
-									kind = 21;
+								if (kind > 22)
+									kind = 22;
 								JjCheckNAddTwoStates(25, 26);
 								break;
 							
 							case 28: 
 								if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddStates(3, 7);
 								break;
 							
 							case 29: 
 								if ((0x97ffffff87ffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddTwoStates(29, 30);
 								break;
 							
@@ -491,8 +464,8 @@
 								break;
 							
 							case 31: 
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddTwoStates(29, 30);
 								break;
 							
@@ -548,14 +521,14 @@
 							case 0: 
 								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 								{
-									if (kind > 21)
-										kind = 21;
+									if (kind > 22)
+										kind = 22;
 									JjCheckNAddTwoStates(25, 26);
 								}
 								if (JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 								{
-									if (kind > 18)
-										kind = 18;
+									if (kind > 19)
+										kind = 19;
 									JjCheckNAddStates(3, 7);
 								}
 								break;
@@ -576,8 +549,8 @@
 							case 28: 
 								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddStates(3, 7);
 								break;
 							
@@ -585,8 +558,8 @@
 							case 31: 
 								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) 2))
 									break;
-								if (kind > 18)
-									kind = 18;
+								if (kind > 19)
+									kind = 19;
 								JjCheckNAddTwoStates(29, 30);
 								break;
 							
@@ -615,7 +588,7 @@
 				{
 					curChar = input_stream.ReadChar();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
 					return curPos;
 				}
@@ -627,9 +600,9 @@
 			{
 				
 				case 0: 
-					if ((active0 & 0x20000000L) != 0L)
+					if ((active0 & 0x40000000L) != 0L)
 					{
-						jjmatchedKind = 32;
+						jjmatchedKind = 33;
 						return 6;
 					}
 					return - 1;
@@ -643,30 +616,16 @@
 		{
 			return JjMoveNfa_1(JjStopStringLiteralDfa_1(pos, (ulong) active0), pos + 1);
 		}
-		private int JjStartNfaWithStates_1(int pos, int kind, int state)
-		{
-			jjmatchedKind = kind;
-			jjmatchedPos = pos;
-			try
-			{
-				curChar = input_stream.ReadChar();
-			}
-			catch (System.IO.IOException e)
-			{
-				return pos + 1;
-			}
-			return JjMoveNfa_1(state, pos + 1);
-		}
 		private int JjMoveStringLiteralDfa0_1()
 		{
 			switch (curChar)
 			{
 				
 				case (char) (84): 
-					return JjMoveStringLiteralDfa1_1((ulong) 0x20000000L);
+					return JjMoveStringLiteralDfa1_1((ulong) 0x40000000L);
 				
 				case (char) (125): 
-					return JjStopAtPos(0, 30);
+					return JjStopAtPos(0, 31);
 				
 				default: 
 					return JjMoveNfa_1(0, 0);
@@ -679,7 +638,7 @@
 			{
 				curChar = input_stream.ReadChar();
 			}
-			catch (System.IO.IOException e)
+			catch (System.IO.IOException)
 			{
 				JjStopStringLiteralDfa_1(0, (ulong) active0);
 				return 1;
@@ -688,8 +647,8 @@
 			{
 				
 				case (char) (79): 
-					if ((active0 & 0x20000000L) != 0L)
-						return JjStartNfaWithStates_1(1, 29, 6);
+					if ((active0 & 0x40000000L) != 0L)
+						return JjStartNfaWithStates_1(1, 30, 6);
 					break;
 				
 				default: 
@@ -698,14 +657,27 @@
 			}
 			return JjStartNfa_1(0, (ulong) active0);
 		}
-		private int JjMoveNfa_1(int startState, int curPos)
+        private int JjStartNfaWithStates_1(int pos, int kind, int state)
+        {
+            jjmatchedKind = kind;
+            jjmatchedPos = pos;
+            try
+            {
+                curChar = input_stream.ReadChar();
+            }
+            catch (System.IO.IOException)
+            {
+                return pos + 1;
+            }
+            return JjMoveNfa_1(state, pos + 1);
+        }
+        private int JjMoveNfa_1(int startState, int curPos)
 		{
-			int[] nextStates;
 			int startsAt = 0;
 			jjnewStateCnt = 7;
 			int i = 1;
 			jjstateSet[0] = startState;
-			int j, kind = 0x7fffffff;
+			int kind = 0x7fffffff;
 			for (; ; )
 			{
 				if (++jjround == 0x7fffffff)
@@ -723,14 +695,14 @@
 							case 0: 
 								if ((0xfffffffeffffffffL & l) != (ulong) 0L)
 								{
-									if (kind > 32)
-										kind = 32;
+									if (kind > 33)
+										kind = 33;
 									JjCheckNAdd(6);
 								}
 								if ((0x100002600L & l) != (ulong) 0L)
 								{
-									if (kind > 6)
-										kind = 6;
+									if (kind > 7)
+										kind = 7;
 								}
 								else if (curChar == 34)
 									JjCheckNAddTwoStates(2, 4);
@@ -752,15 +724,15 @@
 								break;
 							
 							case 5: 
-								if (curChar == 34 && kind > 31)
-									kind = 31;
+								if (curChar == 34 && kind > 32)
+									kind = 32;
 								break;
 							
 							case 6: 
 								if ((0xfffffffeffffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 32)
-									kind = 32;
+								if (kind > 33)
+									kind = 33;
 								JjCheckNAdd(6);
 								break;
 							
@@ -784,8 +756,8 @@
 							case 6: 
 								if ((0xdfffffffffffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 32)
-									kind = 32;
+								if (kind > 33)
+									kind = 33;
 								JjCheckNAdd(6);
 								break;
 							
@@ -822,8 +794,8 @@
 							case 6: 
 								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
-								if (kind > 32)
-									kind = 32;
+								if (kind > 33)
+									kind = 33;
 								JjCheckNAdd(6);
 								break;
 							
@@ -851,7 +823,7 @@
 				{
 					curChar = input_stream.ReadChar();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
 					return curPos;
 				}
@@ -863,12 +835,11 @@
 		}
 		private int JjMoveNfa_0(int startState, int curPos)
 		{
-			int[] nextStates;
 			int startsAt = 0;
 			jjnewStateCnt = 3;
 			int i = 1;
 			jjstateSet[0] = startState;
-			int j, kind = 0x7fffffff;
+			int kind = 0x7fffffff;
 			for (; ; )
 			{
 				if (++jjround == 0x7fffffff)
@@ -886,8 +857,8 @@
 							case 0: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-								if (kind > 24)
-									kind = 24;
+								if (kind > 25)
+									kind = 25;
 								JjAddStates(19, 20);
 								break;
 							
@@ -899,8 +870,8 @@
 							case 2: 
 								if ((0x3ff000000000000L & l) == (ulong) 0L)
 									break;
-								if (kind > 24)
-									kind = 24;
+								if (kind > 25)
+									kind = 25;
 								JjCheckNAdd(2);
 								break;
 							
@@ -959,7 +930,7 @@
 				{
 					curChar = input_stream.ReadChar();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
 					return curPos;
 				}
@@ -971,9 +942,9 @@
 			{
 				
 				case 0: 
-					if ((active0 & 0x2000000L) != (ulong) 0L)
+					if ((active0 & 0x4000000L) != (ulong) 0L)
 					{
-						jjmatchedKind = 28;
+						jjmatchedKind = 29;
 						return 6;
 					}
 					return - 1;
@@ -987,30 +958,16 @@
 		{
 			return JjMoveNfa_2(JjStopStringLiteralDfa_2(pos, (ulong) active0), pos + 1);
 		}
-		private int JjStartNfaWithStates_2(int pos, int kind, int state)
-		{
-			jjmatchedKind = kind;
-			jjmatchedPos = pos;
-			try
-			{
-				curChar = input_stream.ReadChar();
-			}
-			catch (System.IO.IOException e)
-			{
-				return pos + 1;
-			}
-			return JjMoveNfa_2(state, pos + 1);
-		}
 		private int JjMoveStringLiteralDfa0_2()
 		{
 			switch (curChar)
 			{
 				
 				case (char) (84): 
-					return JjMoveStringLiteralDfa1_2((ulong) 0x2000000L);
+					return JjMoveStringLiteralDfa1_2((ulong) 0x4000000L);
 				
 				case (char) (93): 
-					return JjStopAtPos(0, 26);
+					return JjStopAtPos(0, 27);
 				
 				default: 
 					return JjMoveNfa_2(0, 0);
@@ -1023,7 +980,7 @@
 			{
 				curChar = input_stream.ReadChar();
 			}
-			catch (System.IO.IOException e)
+			catch (System.IO.IOException)
 			{
 				JjStopStringLiteralDfa_2(0, (ulong) active0);
 				return 1;
@@ -1032,8 +989,8 @@
 			{
 				
 				case (char) (79): 
-					if ((active0 & 0x2000000L) != (ulong) 0L)
-						return JjStartNfaWithStates_2(1, 25, 6);
+					if ((active0 & 0x4000000L) != (ulong) 0L)
+						return JjStartNfaWithStates_2(1, 26, 6);
 					break;
 				
 				default: 
@@ -1042,14 +999,27 @@
 			}
 			return JjStartNfa_2(0, (ulong) active0);
 		}
-		private int JjMoveNfa_2(int startState, int curPos)
+        private int JjStartNfaWithStates_2(int pos, int kind, int state)
+        {
+            jjmatchedKind = kind;
+            jjmatchedPos = pos;
+            try
+            {
+                curChar = input_stream.ReadChar();
+            }
+            catch (System.IO.IOException)
+            {
+                return pos + 1;
+            }
+            return JjMoveNfa_2(state, pos + 1);
+        }
+        private int JjMoveNfa_2(int startState, int curPos)
 		{
-			int[] nextStates;
 			int startsAt = 0;
 			jjnewStateCnt = 7;
 			int i = 1;
 			jjstateSet[0] = startState;
-			int j, kind = 0x7fffffff;
+			int kind = 0x7fffffff;
 			for (; ; )
 			{
 				if (++jjround == 0x7fffffff)
@@ -1067,14 +1037,14 @@
 							case 0: 
 								if ((0xfffffffeffffffffL & l) != (ulong) 0L)
 								{
-									if (kind > 28)
-										kind = 28;
+									if (kind > 29)
+										kind = 29;
 									JjCheckNAdd(6);
 								}
 								if ((0x100002600L & l) != (ulong) 0L)
 								{
-									if (kind > 6)
-										kind = 6;
+									if (kind > 7)
+										kind = 7;
 								}
 								else if (curChar == 34)
 									JjCheckNAddTwoStates(2, 4);
@@ -1096,15 +1066,15 @@
 								break;
 							
 							case 5: 
-								if (curChar == 34 && kind > 27)
-									kind = 27;
+								if (curChar == 34 && kind > 28)
+									kind = 28;
 								break;
 							
 							case 6: 
 								if ((0xfffffffeffffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 28)
-									kind = 28;
+								if (kind > 29)
+									kind = 29;
 								JjCheckNAdd(6);
 								break;
 							
@@ -1128,8 +1098,8 @@
 							case 6: 
 								if ((0xffffffffdfffffffL & l) == (ulong) 0L)
 									break;
-								if (kind > 28)
-									kind = 28;
+								if (kind > 29)
+									kind = 29;
 								JjCheckNAdd(6);
 								break;
 							
@@ -1166,8 +1136,8 @@
 							case 6: 
 								if (!JjCanMove_0(hiByte, i1, i2, (ulong) l1, (ulong) l2))
 									break;
-								if (kind > 28)
-									kind = 28;
+								if (kind > 29)
+									kind = 29;
 								JjCheckNAdd(6);
 								break;
 							
@@ -1195,13 +1165,13 @@
 				{
 					curChar = input_stream.ReadChar();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
 					return curPos;
 				}
 			}
 		}
-		internal static readonly int[] jjnextStates = new int[]{15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 2, 4, 5, 0, 1};
+		internal static readonly int[] jjnextStates = new int[]{15, 16, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 2, 4, 5, 0, 1};
 		private static bool JjCanMove_0(int hiByte, int i1, int i2, ulong l1, ulong l2)
 		{
 			switch (hiByte)
@@ -1217,24 +1187,64 @@
 				
 			}
 		}
-		public static readonly System.String[] jjstrLiteralImages = new System.String[]{"", null, null, null, null, null, null, null, null, null, "\x002B", "\x002D", "\x0028", "\x0029", "\x003A", "\x002A", "\x005E", null, null, null, null, null, "\x005B", "\x007B", null, "\x0054\x004F", "\x005D", null, null, "\x0054\x004F", "\x007D", null, null};
-		public static readonly System.String[] lexStateNames = new System.String[]{"Boost", "RangeEx", "RangeIn", "DEFAULT"};
-		public static readonly int[] jjnewLexState = new int[]{- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 0, - 1, - 1, - 1, - 1, - 1, 2, 1, 3, - 1, 3, - 1, - 1, - 1, 3, - 1, - 1};
-		internal static readonly ulong[] jjtoToken = new ulong[]{0x1ffffff81L};
-		internal static readonly long[] jjtoSkip = new long[]{0x40L};
+
+        /// <summary>
+        /// Token literal values.
+        /// </summary>
+		public static readonly System.String[] jjstrLiteralImages = new System.String[] {
+            "", null, null, null, null, null, null, null, null, null, null, "\x002B", "\x002D",
+            "\x0028", "\x0029", "\x003A", "\x002A", "\x005E", null, null, null, null, null, "\x005B", "\x007B",
+            null, "\x0054\x004F", "\x005D", null, null, "\x0054\x004F", "\x007D", null, null
+        };
+
+        /// <summary>
+        /// Lexer state names.
+        /// </summary>
+		public static readonly System.String[] lexStateNames = new System.String[] {
+            "Boost",
+            "RangeEx",
+            "RangeIn",
+            "DEFAULT"
+        };
+
+        /// <summary>
+        /// Lex state array.
+        /// </summary>
+		public static readonly int[] jjnewLexState = new int[] {
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 2, 1,
+            3, -1, 3, -1, -1, -1, 3, -1, -1
+        };
+
+		internal static readonly ulong[] jjtoToken = new ulong[]{0x3ffffff01L};
+		internal static readonly long[] jjtoSkip = new long[]{0x80L};
 		protected internal CharStream input_stream;
 		private uint[] jjrounds = new uint[36];
 		private int[] jjstateSet = new int[72];
 		protected internal char curChar;
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="stream"></param>
 		public QueryParserTokenManager(CharStream stream)
 		{
 			InitBlock();
 			input_stream = stream;
 		}
-		public QueryParserTokenManager(CharStream stream, int lexState) : this(stream)
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="stream"></param>
+        public QueryParserTokenManager(CharStream stream, int lexState)
+            : this(stream)
 		{
 			SwitchTo(lexState);
 		}
+
+        /// <summary>
+        /// Reinitialise parser.
+        /// </summary>
+        /// <param name="stream"></param>
 		public virtual void  ReInit(CharStream stream)
 		{
 			jjmatchedPos = jjnewStateCnt = 0;
@@ -1249,11 +1259,22 @@
 			for (i = 36; i-- > 0; )
 				jjrounds[i] = 0x80000000;
 		}
+
+        /// <summary>
+        /// Reinitialise parser.
+        /// </summary>
+        /// <param name="stream"></param>
+        /// <param name="lexState"></param>
 		public virtual void  ReInit(CharStream stream, int lexState)
 		{
 			ReInit(stream);
 			SwitchTo(lexState);
 		}
+
+        /// <summary>
+        /// Switch to specified lex state.
+        /// </summary>
+        /// <param name="lexState"></param>
 		public virtual void  SwitchTo(int lexState)
 		{
 			if (lexState >= 4 || lexState < 0)
@@ -1264,14 +1285,18 @@
 		
 		protected internal virtual Token JjFillToken()
 		{
-			Token t = Token.NewToken(jjmatchedKind);
-			t.kind = jjmatchedKind;
-			System.String im = jjstrLiteralImages[jjmatchedKind];
-			t.image = (im == null) ? input_stream.GetImage() : im;
-			t.beginLine = input_stream.GetBeginLine();
-			t.beginColumn = input_stream.GetBeginColumn();
-			t.endLine = input_stream.GetEndLine();
-			t.endColumn = input_stream.GetEndColumn();
+            string im = jjstrLiteralImages[jjmatchedKind];
+            string curTokenImage = (im == null) ? input_stream.GetImage() : im;
+            int beginLine = input_stream.GetBeginLine();
+            int beginColumn = input_stream.GetBeginColumn();
+            int endLine = input_stream.GetEndLine();
+            int endColumn = input_stream.GetEndColumn();
+            Token t = Token.NewToken(jjmatchedKind, curTokenImage);
+
+			t.beginLine = beginLine;
+			t.beginColumn = beginColumn;
+			t.endLine = endLine;
+			t.endColumn = endColumn;
 			return t;
 		}
 		
@@ -1282,10 +1307,12 @@
 		internal int jjmatchedPos;
 		internal int jjmatchedKind;
 		
+        /// <summary>
+        /// Get the next Token.
+        /// </summary>
+        /// <returns></returns>
 		public virtual Token GetNextToken()
 		{
-			int kind;
-			Token specialToken = null;
 			Token matchedToken;
 			int curPos = 0;
 			
@@ -1295,7 +1322,7 @@
 				{
 					curChar = input_stream.BeginToken();
 				}
-				catch (System.IO.IOException e)
+				catch (System.IO.IOException)
 				{
 					jjmatchedKind = 0;
 					matchedToken = JjFillToken();
@@ -1355,7 +1382,7 @@
 				{
 					input_stream.ReadChar(); input_stream.Backup(1);
 				}
-				catch (System.IO.IOException e1)
+				catch (System.IO.IOException)
 				{
 					EOFSeen = true;
 					error_after = curPos <= 1 ? "" : input_stream.GetImage();
@@ -1377,5 +1404,35 @@
 EOFLoop: ;
 			}
 		}
-	}
+
+        private void JjCheckNAdd(int state)
+        {
+            if (jjrounds[state] != jjround)
+            {
+                jjstateSet[jjnewStateCnt++] = state;
+                jjrounds[state] = jjround;
+            }
+        }
+        private void JjAddStates(int start, int end)
+        {
+            do
+            {
+                jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+            }
+            while (start++ != end);
+        }
+        private void JjCheckNAddTwoStates(int state1, int state2)
+        {
+            JjCheckNAdd(state1);
+            JjCheckNAdd(state2);
+        }
+        private void JjCheckNAddStates(int start, int end)
+        {
+            do
+            {
+                JjCheckNAdd(jjnextStates[start]);
+            }
+            while (start++ != end);
+        }
+    }
 }
\ No newline at end of file

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/Token.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/Token.cs Wed Jul 29 18:04:12 2009
@@ -16,6 +16,7 @@
  */
 
 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
 
 using System;
 
@@ -32,12 +33,15 @@
 		/// stored in the file ...Constants.java.
 		/// </summary>
 		public int kind;
-		
-		/// <summary> beginLine and beginColumn describe the position of the first character
-		/// of this token; endLine and endColumn describe the position of the
-		/// last character of this token.
-		/// </summary>
-		public int beginLine, beginColumn, endLine, endColumn;
+
+        /// <summary>The line number of the first character of this Token.</summary>
+        public int beginLine;
+        /// <summary>The column number of the first character of this Token.</summary>
+        public int beginColumn;
+        /// <summary>The line number of the last character of this Token.</summary>
+        public int endLine;
+        /// <summary>The column number of the last character of this Token.</summary>
+        public int endColumn;
 		
 		/// <summary> The string image of the token.</summary>
 		public System.String image;
@@ -63,7 +67,44 @@
 		/// is no such token, this field is null.
 		/// </summary>
 		public Token specialToken;
-		
+
+        /// <summary>
+        /// An optional attribute value of the Token.
+        /// Tokens which are not used as syntactic sugar will often contain
+        /// meaningful values that will be used later on by the compiler or
+        /// interpreter. This attribute value is often different from the image.
+        /// Any subclass of Token that actually wants to return a non-null value can
+        /// override this method as appropriate.
+        /// </summary>
+        public object GetValue()
+        {
+            return null;
+        }
+
+        /// <summary>
+        /// No-argument constructor
+        /// </summary>
+        public Token() { }
+
+        /// <summary>
+        /// Constructs a new token for the specified Image.
+        /// </summary>
+        public Token(int kind)
+            : this(kind, null)
+        {
+        }
+
+        /// <summary>
+        /// Constructs a new token for the specified Image and Kind.
+        /// </summary>
+        /// <param name="kind"></param>
+        /// <param name="image"></param>
+        public Token(int kind, String image)
+        {
+            this.kind = kind;
+            this.image = image;
+        }
+
 		/// <summary> Returns the image.</summary>
 		public override System.String ToString()
 		{
@@ -74,21 +115,26 @@
 		/// can create and return subclass objects based on the value of ofKind.
 		/// Simply add the cases to the switch for all those special cases.
 		/// For example, if you have a subclass of Token called IDToken that
-		/// you want to create if ofKind is ID, simlpy add something like :
+		/// you want to create if ofKind is ID, simply add something like :
 		/// 
-		/// case MyParserConstants.ID : return new IDToken();
+		/// case MyParserConstants.ID : return new IDToken(ofKind, image);
 		/// 
 		/// to the following switch statement. Then you can cast matchedToken
 		/// variable to the appropriate type and use it in your lexical actions.
 		/// </summary>
-		public static Token NewToken(int ofKind)
+		public static Token NewToken(int ofKind, String image)
 		{
 			switch (ofKind)
 			{
 				
-				default:  return new Token();
-				
+				default:  return new Token(ofKind, image);
 			}
 		}
+
+        public static Token NewToken(int ofKind)
+        {
+            return NewToken(ofKind, null);
+        }
 	}
-}
\ No newline at end of file
+}
+/* JavaCC - OriginalChecksum=c147cc166a7cf8812c7c39bc8c5eb868 (do not edit this line) */

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/TokenMgrError.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/TokenMgrError.cs Wed Jul 29 18:04:12 2009
@@ -16,12 +16,15 @@
  */
 
 /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+/* JavaCCOptions: */
 
 using System;
 
 namespace Lucene.Net.QueryParsers
 {
-	
+    /// <summary>
+    /// Token Manager Error.
+    /// </summary>	
 	[Serializable]
 	public class TokenMgrError : System.ApplicationException
 	{
@@ -113,7 +116,7 @@
 						if ((ch = str[i]) < 0x20 || ch > 0x7e)
 						{
 							System.String s = "0000" + System.Convert.ToString(ch, 16);
-							retval.Append("\\u").Append(s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
+							retval.Append("\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
 						}
 						else
 						{
@@ -146,17 +149,36 @@
 		* Constructors of various flavors follow.
 		*/
 		
+        /// <summary>
+        /// No-arg constructor.
+        /// </summary>
 		public TokenMgrError()
 		{
 		}
 		
+        /// <summary>
+        /// Constructor with message and reason.
+        /// </summary>
+        /// <param name="message"></param>
+        /// <param name="reason"></param>
 		public TokenMgrError(System.String message, int reason):base(message)
 		{
 			errorCode = reason;
 		}
 		
+        /// <summary>
+        /// Full constructor.
+        /// </summary>
+        /// <param name="EOFSeen"></param>
+        /// <param name="lexState"></param>
+        /// <param name="errorLine"></param>
+        /// <param name="errorColumn"></param>
+        /// <param name="errorAfter"></param>
+        /// <param name="curChar"></param>
+        /// <param name="reason"></param>
 		public TokenMgrError(bool EOFSeen, int lexState, int errorLine, int errorColumn, System.String errorAfter, char curChar, int reason):this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason)
 		{
 		}
 	}
-}
\ No newline at end of file
+}
+/* JavaCC - OriginalChecksum=186d5bcc64733844c7daab5ad5a6e349 (do not edit this line) */

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/BooleanClause.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs Wed Jul 29 18:04:12 2009
@@ -108,7 +108,7 @@
 		
 		
 		/// <summary>Returns true iff <code>o</code> is equal to this. </summary>
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (!(o is BooleanClause))
 				return false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/BooleanQuery.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs Wed Jul 29 18:04:12 2009
@@ -57,7 +57,6 @@
 			}
 		}
 		
-		
 		private static int maxClauseCount = 1024;
 		
 		/// <summary>Thrown when an attempt is made to add more than {@link
@@ -456,7 +455,7 @@
 		
 		public override Query Rewrite(IndexReader reader)
 		{
-			if (clauses.Count == 1)
+			if (minNrShouldMatch == 0 && clauses.Count == 1)
 			{
 				// optimize 1-clause queries
 				BooleanClause c = (BooleanClause) clauses[0];
@@ -510,7 +509,7 @@
 			}
 		}
 		
-		public override System.Object Clone()
+		public override object Clone()
 		{
 			BooleanQuery clone = (BooleanQuery) base.Clone();
 			clone.clauses = (System.Collections.ArrayList) this.clauses.Clone();
@@ -570,7 +569,7 @@
 		}
 		
 		/// <summary>Returns true iff <code>o</code> is equal to this. </summary>
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (!(o is BooleanQuery))
 				return false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingSpanFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/CachingSpanFilter.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingSpanFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingSpanFilter.cs Wed Jul 29 18:04:12 2009
@@ -44,18 +44,25 @@
 			this.filter = filter;
 		}
 		
+        [System.Obsolete("Use GetDocIdSet(IndexReader) instead")]
 		public override System.Collections.BitArray Bits(IndexReader reader)
 		{
 			SpanFilterResult result = GetCachedResult(reader);
 			return result != null ? result.GetBits() : null;
 		}
+
+        public override DocIdSet GetDocIdSet(IndexReader reader)
+        {
+            SpanFilterResult result = GetCachedResult(reader);
+            return result != null ? result.GetDocIdSet() : null;
+        }
 		
 		private SpanFilterResult GetCachedResult(IndexReader reader)
 		{
 			SpanFilterResult result = null;
 			if (cache == null)
 			{
-				cache = new SupportClass.WeakHashTable();
+				cache = new System.Collections.Hashtable();
 			}
 			
 			lock (cache.SyncRoot)
@@ -82,7 +89,7 @@
 			return "CachingSpanFilter(" + filter + ")";
 		}
 		
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (!(o is CachingSpanFilter))
 				return false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingWrapperFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/CachingWrapperFilter.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingWrapperFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/CachingWrapperFilter.cs Wed Jul 29 18:04:12 2009
@@ -44,11 +44,12 @@
 			this.filter = filter;
 		}
 		
+        [System.Obsolete("Use GetDocIdSet(IndexReader) instead.")]
 		public override System.Collections.BitArray Bits(IndexReader reader)
 		{
 			if (cache == null)
 			{
-				cache = new SupportClass.WeakHashTable();
+				cache = new System.Collections.Hashtable();
 			}
 			
 			lock (cache.SyncRoot)
@@ -72,12 +73,40 @@
 			return bits;
 		}
 		
+		public override DocIdSet GetDocIdSet(IndexReader reader)
+		{
+			if (cache == null)
+			{
+				cache = new System.Collections.Hashtable();
+			}
+			
+			lock (cache.SyncRoot)
+			{
+				// check cache
+				DocIdSet cached = (DocIdSet) cache[reader];
+				if (cached != null)
+				{
+					return cached;
+				}
+			}
+			
+			DocIdSet docIdSet = filter.GetDocIdSet(reader);
+			
+			lock (cache.SyncRoot)
+			{
+				// update cache
+				cache[reader] = docIdSet;
+			}
+			
+			return docIdSet;
+		}
+
 		public override System.String ToString()
 		{
 			return "CachingWrapperFilter(" + filter + ")";
 		}
 		
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (!(o is CachingWrapperFilter))
 				return false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ComplexExplanation.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ComplexExplanation.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ComplexExplanation.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ComplexExplanation.cs Wed Jul 29 18:04:12 2009
@@ -20,7 +20,10 @@
 namespace Lucene.Net.Search
 {
 	
-	/// <summary>Expert: Describes the score computation for document and query, andcan distinguish a match independent of a positive value. </summary>
+	/// <summary>
+    /// Expert: Describes the score computation for document and query, and
+    /// can distinguish a match independent of a positive value.
+    /// </summary>
 	[Serializable]
 	public class ComplexExplanation : Explanation
 	{
@@ -52,7 +55,7 @@
 			this.match = match;
             this.isMatchSet = true;
 		}
-		/// <summary> Indicates wether or not this Explanation models a good match.
+		/// <summary> Indicates whether or not this Explanation models a good match.
 		/// 
 		/// <p>
 		/// If the match statis is explicitly set (ie: not null) this method

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConjunctionScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ConjunctionScorer.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConjunctionScorer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConjunctionScorer.cs Wed Jul 29 18:04:12 2009
@@ -43,7 +43,7 @@
 				
 			}
 			// sort the array
-			public virtual int Compare(System.Object o1, System.Object o2)
+			public virtual int Compare(object o1, object o2)
 			{
 				return ((Scorer) o1).Doc() - ((Scorer) o2).Doc();
 			}
@@ -130,12 +130,12 @@
 			// Keep last scorer in it's last place (it will be the first
 			// to be skipped on), but reverse all of the others so that
 			// they will be skipped on in order of original high skip.
-			int end = (scorers.Length - 1) - 1;
+			int end = (scorers.Length - 1);
 			for (int i = 0; i < (end >> 1); i++)
 			{
 				Scorer tmp = scorers[i];
-				scorers[i] = scorers[end - i];
-				scorers[end - i] = tmp;
+				scorers[i] = scorers[end - i - 1];
+                scorers[end - i - 1] = tmp;
 			}
 			
 			return more;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ConstantScoreQuery.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreQuery.cs Wed Jul 29 18:04:12 2009
@@ -22,13 +22,11 @@
 namespace Lucene.Net.Search
 {
 	
-	/// <summary> A query that wraps a filter and simply returns a constant score equal to the
+	/// <summary>
+    /// A query that wraps a filter and simply returns a constant score equal to the
 	/// query boost for every document in the filter.
-	/// 
-	/// 
 	/// </summary>
-	/// <version>  $Id: ConstantScoreQuery.java 564236 2007-08-09 15:21:19Z gsingers $
-	/// </version>
+	/// <version>$Id:$</version>
 	[Serializable]
 	public class ConstantScoreQuery : Query
 	{
@@ -113,7 +111,7 @@
 			{
 				
 				ConstantScorer cs = (ConstantScorer) Scorer(reader);
-				bool exists = cs.bits.Get(doc);
+                bool exists = cs.docIdSetIterator.SkipTo(doc) && cs.docIdSetIterator.Doc() == doc;
 				
 				ComplexExplanation result = new ComplexExplanation();
 				
@@ -152,7 +150,7 @@
 				}
 				
 			}
-			internal System.Collections.BitArray bits;
+            internal DocIdSetIterator docIdSetIterator;
 			internal float theScore;
 			internal int doc = - 1;
 			
@@ -160,18 +158,17 @@
 			{
 				InitBlock(enclosingInstance);
 				theScore = w.GetValue();
-				bits = Enclosing_Instance.filter.Bits(reader);
+                docIdSetIterator = Enclosing_Instance.filter.GetDocIdSet(reader).Iterator();
 			}
 			
 			public override bool Next()
 			{
-				doc = SupportClass.Number.NextSetBit(bits, doc + 1);
-				return doc >= 0;
+				return docIdSetIterator.Next();
 			}
 			
 			public override int Doc()
 			{
-				return doc;
+                return docIdSetIterator.Doc(); ;
 			}
 			
 			public override float Score()
@@ -181,8 +178,7 @@
 			
 			public override bool SkipTo(int target)
 			{
-				doc = SupportClass.Number.NextSetBit(bits, target); // requires JDK 1.4
-				return doc >= 0;
+				return docIdSetIterator.SkipTo(target);
 			}
 			
 			public override Explanation Explain(int doc)
@@ -205,7 +201,7 @@
 		}
 		
 		/// <summary>Returns true if <code>o</code> is equal to this. </summary>
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (this == o)
 				return true;
@@ -222,7 +218,7 @@
 			return filter.GetHashCode() + BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0);
 		}
 
-		override public System.Object Clone()
+		override public object Clone()
 		{
             // {{Aroush-1.9}} is this all that we need to clone?!
             ConstantScoreQuery clone = (ConstantScoreQuery) base.Clone();

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs Wed Jul 29 18:04:12 2009
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using CompareInfo = System.Globalization.CompareInfo;
 using IndexReader = Lucene.Net.Index.IndexReader;
 
 namespace Lucene.Net.Search
@@ -30,13 +30,8 @@
 	/// If an endpoint is null, it is said to be "open".
 	/// Either or both endpoints may be open.  Open endpoints may not be exclusive
 	/// (you can't select all but the first or last term without explicitly specifying the term to exclude.)
-	/// 
-	/// 
 	/// </summary>
-	/// <version>  $Id: ConstantScoreRangeQuery.java 564236 2007-08-09 15:21:19Z gsingers $
-	/// </version>
-	
-	[Serializable]
+    [Serializable]
 	public class ConstantScoreRangeQuery : Query
 	{
 		private System.String fieldName;
@@ -44,7 +39,7 @@
 		private System.String upperVal;
 		private bool includeLower;
 		private bool includeUpper;
-		
+		private CompareInfo collator;
 		
 		public ConstantScoreRangeQuery(System.String fieldName, System.String lowerVal, System.String upperVal, bool includeLower, bool includeUpper)
 		{
@@ -70,7 +65,13 @@
 			this.includeLower = includeLower;
 			this.includeUpper = includeUpper;
 		}
-		
+
+        public ConstantScoreRangeQuery(string fieldName, string lowerVal, string upperVal, bool includeLower, bool includeUpper, CompareInfo collator)
+            : this(fieldName, lowerVal, upperVal, includeLower, includeUpper)
+        {
+            this.collator = collator;
+        }
+
 		/// <summary>Returns the field name for this query </summary>
 		public virtual System.String GetField()
 		{
@@ -100,7 +101,9 @@
 		public override Query Rewrite(IndexReader reader)
 		{
 			// Map to RangeFilter semantics which are slightly different...
-			RangeFilter rangeFilt = new RangeFilter(fieldName, lowerVal != null ? lowerVal : "", upperVal, (System.Object) lowerVal == (System.Object) "" ? false : includeLower, upperVal == null ? false : includeUpper);
+			RangeFilter rangeFilt = new RangeFilter(fieldName, lowerVal != null ? lowerVal : "", upperVal,
+                (object) lowerVal == (object) "" ? false : includeLower,
+                upperVal == null ? false : includeUpper, collator);
 			Query q = new ConstantScoreQuery(rangeFilt);
 			q.SetBoost(GetBoost());
 			return q;
@@ -125,7 +128,7 @@
 		}
 		
 		/// <summary>Returns true if <code>o</code> is equal to this. </summary>
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (this == o)
 				return true;
@@ -133,7 +136,10 @@
 				return false;
 			ConstantScoreRangeQuery other = (ConstantScoreRangeQuery) o;
 			
-			if ((System.Object) this.fieldName != (System.Object) other.fieldName || this.includeLower != other.includeLower || this.includeUpper != other.includeUpper)
+			if ((object) this.fieldName != (object) other.fieldName ||
+                this.includeLower != other.includeLower ||
+                this.includeUpper != other.includeUpper ||
+                (this.collator != null && !this.collator.Equals(other.collator)))
 			{
 				return false;
 			}
@@ -155,10 +161,11 @@
 			h ^= ((h << 17) | (SupportClass.Number.URShift(h, 16))); // a reversible (one to one) 32 bit mapping mix
 			h ^= (upperVal != null ? (upperVal.GetHashCode()) : 0x5a695a69);
 			h ^= (includeLower ? 0x665599aa : 0) ^ (includeUpper ? unchecked((int) 0x99aa5566) : 0);    // {{Aroush-1.9}} Is this OK?!
+            h ^= collator != null ? collator.GetHashCode() : 0;
 			return h;
 		}
 		
-		override public System.Object Clone()
+		override public object Clone()
 		{
             // {{Aroush-1.9}} is this all that we need to clone?!
             ConstantScoreRangeQuery clone = (ConstantScoreRangeQuery) base.Clone();
@@ -167,6 +174,8 @@
             clone.upperVal = (System.String) this.upperVal.Clone();
             clone.includeLower = this.includeLower;
             clone.includeUpper = this.includeUpper;
+            if (this.collator != null)
+                clone.collator = this.collator; // {{DSale-2.4}} need to clone collator?
             return clone;
         }
 	}

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/DisjunctionMaxQuery.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxQuery.cs Wed Jul 29 18:04:12 2009
@@ -35,8 +35,6 @@
 	/// include this term in only the best of those multiple fields, without confusing this with the better case of two different terms
 	/// in the multiple fields.
 	/// </summary>
-	/// <author>  Chuck Williams
-	/// </author>
 	[Serializable]
 	public class DisjunctionMaxQuery : Query, System.ICloneable
 	{
@@ -48,7 +46,7 @@
 		private float tieBreakerMultiplier = 0.0f;
 		
 		/// <summary>Creates a new empty DisjunctionMaxQuery.  Use add() to add the subqueries.</summary>
-		/// <param name="tieBreakerMultiplier">this score of each non-maximum disjunct for a document is multiplied by this weight
+		/// <param name="tieBreakerMultiplier">the score of each non-maximum disjunct for a document is multiplied by this weight
 		/// and added into the final score.  If non-zero, the value should be small, on the order of 0.1, which says that
 		/// 10 occurrences of word in a lower-scored field that is also in a higher scored field is just as good as a unique
 		/// word in the lower scored field (i.e., one that is not in any higher scored field.
@@ -240,7 +238,7 @@
 		/// <summary>Create a shallow copy of us -- used in rewriting if necessary</summary>
 		/// <returns> a copy of us (but reuse, don't copy, our subqueries) 
 		/// </returns>
-		public override System.Object Clone()
+		public override object Clone()
 		{
 			DisjunctionMaxQuery clone = (DisjunctionMaxQuery) base.Clone();
 			return clone;
@@ -300,7 +298,7 @@
 		/// </param>
 		/// <returns> true iff o is a DisjunctionMaxQuery with the same boost and the same subqueries, in the same order, as us
 		/// </returns>
-		public  override bool Equals(System.Object o)
+		public  override bool Equals(object o)
 		{
 			if (!(o is DisjunctionMaxQuery))
 				return false;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/DisjunctionMaxScorer.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxScorer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxScorer.cs Wed Jul 29 18:04:12 2009
@@ -25,8 +25,6 @@
 	/// by the subquery scorers that generate that document, plus tieBreakerMultiplier times the sum of the scores
 	/// for the other subqueries that generate the document.
 	/// </summary>
-	/// <author>  Chuck Williams
-	/// </author>
 	class DisjunctionMaxScorer : Scorer
 	{
 		

Added: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DocIdSet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/DocIdSet.cs?rev=798995&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DocIdSet.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DocIdSet.cs Wed Jul 29 18:04:12 2009
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Search
+{
+    /// <summary>
+    /// A DocIdSet contains a set of doc ids.  Implementing classes
+    /// must provide a DocIdSetIterator to access the set.
+    /// </summary>
+    public abstract class DocIdSet
+    {
+        public abstract DocIdSetIterator Iterator();
+    }
+}



Mime
View raw message