lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r833546 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Analysis/ Test/Analysis/
Date Fri, 06 Nov 2009 20:19:39 GMT
Author: aroush
Date: Fri Nov  6 20:19:39 2009
New Revision: 833546

URL: http://svn.apache.org/viewvc?rev=833546&view=rev
Log:
Fixed JUnit test-cases for: TestAnalyzers.cs

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharReader.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharStream.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharTokenizer.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/KeywordTokenizer.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/MappingCharFilter.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopAnalyzer.cs
    incubator/lucene.net/trunk/C#/src/Test/Analysis/BaseTokenStreamTestCase.cs
    incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/Analyzer.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs Fri Nov  6 20:19:39
2009
@@ -114,7 +114,7 @@
 			
 			try
 			{
-				System.Reflection.MethodInfo m = this.GetType().GetMethod("tokenStream", (params_Renamed
== null)?new System.Type[0]:(System.Type[]) params_Renamed);
+				System.Reflection.MethodInfo m = this.GetType().GetMethod("TokenStream", (params_Renamed
== null)?new System.Type[0]:(System.Type[]) params_Renamed);
 				if (m != null)
 				{
 					overridesTokenStreamMethod = m.DeclaringType != baseClass;

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/CharReader.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharReader.cs Fri Nov  6 20:19:39
2009
@@ -33,13 +33,20 @@
 		
 		public static CharStream Get(System.IO.TextReader input)
 		{
-			return input is CharStream?(CharStream) input:new CharReader(input);
+            if (input is CharStream)
+                return (CharStream) input;
+            else
+            {
+                // {{Aroush-2.9}} isn't there a better (faster) way to do this?
+                System.IO.MemoryStream theString = new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(input.ReadToEnd()));
+                return new CharReader(new System.IO.StreamReader(theString));
+            }
+			//return input is CharStream?(CharStream) input:new CharReader(input);
 		}
 		
-		private CharReader(System.IO.TextReader in_Renamed) : base(null)    // {{Aroush-2.9}} the
base is 'null'
+		private CharReader(System.IO.StreamReader in_Renamed) : base(in_Renamed)
 		{
-			// input = in_Renamed;  // {{Aroush-2.9}}
-            System.Diagnostics.Debug.Fail("Port issue:", "Still needs work"); // {{Aroush-2.9}}
+			input = in_Renamed;
 		}
 		
 		public override int CorrectOffset(int currentOff)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/CharStream.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharStream.cs Fri Nov  6 20:19:39
2009
@@ -30,7 +30,7 @@
 	/// original Reader.
 	public abstract class CharStream:System.IO.StreamReader
 	{
-        public CharStream(CharStream reader) : base(reader.BaseStream)
+        public CharStream(System.IO.StreamReader reader) : base(reader.BaseStream)
         {
         }
 		

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/CharTokenizer.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharTokenizer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/CharTokenizer.cs Fri Nov  6 20:19:39
2009
@@ -82,7 +82,7 @@
 				{
 					offset += dataLen;
 					dataLen = input.Read((System.Char[]) ioBuffer, 0, ioBuffer.Length);
-					if (dataLen == - 1)
+					if (dataLen == 0)
 					{
 						dataLen = 0; // so next offset += dataLen won't decrement offset
 						if (length > 0)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/KeywordTokenizer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/KeywordTokenizer.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/KeywordTokenizer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/KeywordTokenizer.cs Fri Nov  6 20:19:39
2009
@@ -73,7 +73,7 @@
 				while (true)
 				{
 					int length = input.Read(buffer, upto, buffer.Length - upto);
-					if (length == - 1)
+					if (length == 0)
 						break;
 					upto += length;
 					if (upto == buffer.Length)

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/MappingCharFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/MappingCharFilter.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/MappingCharFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/MappingCharFilter.cs Fri Nov  6
20:19:39 2009
@@ -145,7 +145,7 @@
 		{
 			char[] tmp = new char[len];
 			int l = input.Read(tmp, 0, len);
-			if (l != - 1)
+			if (l != 0)
 			{
 				for (int i = 0; i < l; i++)
 					PushLastChar(tmp[i]);

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/StopAnalyzer.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopAnalyzer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopAnalyzer.cs Fri Nov  6 20:19:39
2009
@@ -1,3 +1,4 @@
+
 /* 
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -231,7 +232,11 @@
 			{
 				System.String[] stopWords = new System.String[]{"a", "an", "and", "are", "as", "at",
"be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"};
 				CharArraySet stopSet = new CharArraySet(stopWords.Length, false);
-				stopSet.Add(new System.Collections.ArrayList(stopWords));
+				//stopSet.AddAll(new System.Collections.ArrayList(stopWords));
+                for (int i = 0; i < stopWords.Length; i++)
+                {
+                    stopSet.Add(stopWords[i]);
+                }
 				ENGLISH_STOP_WORDS_SET = CharArraySet.UnmodifiableSet(stopSet);
 			}
 		}

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/BaseTokenStreamTestCase.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/BaseTokenStreamTestCase.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/BaseTokenStreamTestCase.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/BaseTokenStreamTestCase.cs Fri Nov  6
20:19:39 2009
@@ -30,7 +30,6 @@
 	/// This class runs all tests twice, one time with {@link TokenStream#setOnlyUseNewAPI}
<code>false</code>
 	/// and after that one time with <code>true</code>.
 	/// </summary>
-    [TestFixture]
 	public abstract class BaseTokenStreamTestCase:LuceneTestCase
 	{
 		

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/TestAnalyzers.cs?rev=833546&r1=833545&r2=833546&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs Fri Nov  6 20:19:39 2009
@@ -28,15 +28,15 @@
 namespace Lucene.Net.Analysis
 {
 	
-    [TestFixture]
+	[TestFixture]
 	public class TestAnalyzers:BaseTokenStreamTestCase
 	{
 		
-		public TestAnalyzers(System.String name):base(name)
+		/*public TestAnalyzers(System.String name):base(name)
 		{
-		}
+		}*/
 		
-        [Test]
+		[Test]
 		public virtual void  TestSimple()
 		{
 			Analyzer a = new SimpleAnalyzer();
@@ -50,7 +50,7 @@
 			AssertAnalyzesTo(a, "\"QUOTED\" word", new System.String[]{"quoted", "word"});
 		}
 		
-        [Test]
+		[Test]
 		public virtual void  TestNull()
 		{
 			Analyzer a = new WhitespaceAnalyzer();
@@ -64,7 +64,7 @@
 			AssertAnalyzesTo(a, "\"QUOTED\" word", new System.String[]{"\"QUOTED\"", "word"});
 		}
 		
-        [Test]
+		[Test]
 		public virtual void  TestStop()
 		{
 			Analyzer a = new StopAnalyzer();
@@ -87,7 +87,7 @@
 		}
 		
 		// Make sure old style next() calls result in a new copy of payloads
-        [Test]
+		[Test]
 		public virtual void  TestPayloadCopy()
 		{
 			System.String s = "how now brown cow";
@@ -124,7 +124,7 @@
 			}
 		}
 		
-        [Test]
+		[Test]
 		public virtual void  TestSubclassOverridingOnlyTokenStream()
 		{
 			Analyzer a = new MyStandardAnalyzer();



Mime
View raw message