lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1291092 [2/2] - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core: ./ Analysis/ Analysis/Standard/ Document/ Index/ QueryParser/ Search/ Search/Function/ Search/Payloads/ Search/Spans/ Store/ Support/ Util/
Date Sun, 19 Feb 2012 23:35:50 GMT
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermQuery.cs Sun
Feb 19 23:35:48 2012
@@ -106,13 +106,13 @@ namespace Lucene.Net.Search
 			{
 				
 				ComplexExplanation result = new ComplexExplanation();
-				result.SetDescription("weight(" + GetQuery() + " in " + doc + "), product of:");
+				result.Description = "weight(" + GetQuery() + " in " + doc + "), product of:";
 				
 				Explanation expl = new Explanation(idf, idfExp.Explain());
 				
 				// explain query weight
 				Explanation queryExpl = new Explanation();
-				queryExpl.SetDescription("queryWeight(" + GetQuery() + "), product of:");
+				queryExpl.Description = "queryWeight(" + GetQuery() + "), product of:";
 				
 				Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
 				if (Enclosing_Instance.GetBoost() != 1.0f)
@@ -122,14 +122,14 @@ namespace Lucene.Net.Search
 				Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
 				queryExpl.AddDetail(queryNormExpl);
 				
-				queryExpl.SetValue(boostExpl.GetValue() * expl.GetValue() * queryNormExpl.GetValue());
+				queryExpl.Value = boostExpl.Value * expl.Value * queryNormExpl.Value;
 				
 				result.AddDetail(queryExpl);
 				
 				// explain field weight
 				System.String field = Enclosing_Instance.term.Field();
 				ComplexExplanation fieldExpl = new ComplexExplanation();
-				fieldExpl.SetDescription("fieldWeight(" + Enclosing_Instance.term + " in " + doc + "),
product of:");
+				fieldExpl.Description = "fieldWeight(" + Enclosing_Instance.term + " in " + doc + "),
product of:";
 
                 Explanation tfExplanation = new Explanation();
                 int tf = 0;
@@ -147,13 +147,13 @@ namespace Lucene.Net.Search
                     {
                         termDocs.Close();
                     }
-                    tfExplanation.SetValue(similarity.Tf(tf));
-                    tfExplanation.SetDescription("tf(termFreq(" + enclosingInstance.term
+ ")=" + tf + ")");
+                    tfExplanation.Value = similarity.Tf(tf);
+                    tfExplanation.Description = "tf(termFreq(" + enclosingInstance.term +
")=" + tf + ")";
                 }
                 else
                 {
-                    tfExplanation.SetValue(0.0f);
-                    tfExplanation.SetDescription("no matching term");
+                    tfExplanation.Value = 0.0f;
+                    tfExplanation.Description = "no matching term";
                 }
                 fieldExpl.AddDetail(tfExplanation);
 				fieldExpl.AddDetail(expl);
@@ -161,21 +161,21 @@ namespace Lucene.Net.Search
 				Explanation fieldNormExpl = new Explanation();
 				byte[] fieldNorms = reader.Norms(field);
 				float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
-				fieldNormExpl.SetValue(fieldNorm);
-				fieldNormExpl.SetDescription("fieldNorm(field=" + field + ", doc=" + doc + ")");
+				fieldNormExpl.Value = fieldNorm;
+				fieldNormExpl.Description = "fieldNorm(field=" + field + ", doc=" + doc + ")";
 				fieldExpl.AddDetail(fieldNormExpl);
 
-                fieldExpl.SetMatch(tfExplanation.IsMatch());
-                fieldExpl.SetValue(tfExplanation.GetValue() * expl.GetValue() * fieldNormExpl.GetValue());
+                fieldExpl.Match = tfExplanation.IsMatch();
+                fieldExpl.Value = tfExplanation.Value * expl.Value * fieldNormExpl.Value;
 				
 				result.AddDetail(fieldExpl);
-				System.Boolean? tempAux = fieldExpl.GetMatch();
-				result.SetMatch(tempAux);
+				System.Boolean? tempAux = fieldExpl.Match;
+				result.Match = tempAux;
 				
 				// combine them
-				result.SetValue(queryExpl.GetValue() * fieldExpl.GetValue());
+				result.Value = queryExpl.Value * fieldExpl.Value;
 				
-				if (queryExpl.GetValue() == 1.0f)
+				if (queryExpl.Value == 1.0f)
 					return fieldExpl;
 				
 				return result;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/AlreadyClosedException.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/AlreadyClosedException.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/AlreadyClosedException.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/AlreadyClosedException.cs
Sun Feb 19 23:35:48 2012
@@ -20,19 +20,28 @@ using System.Runtime.Serialization;
 
 namespace Lucene.Net.Store
 {
-	
-	/// <summary> This exception is thrown when there is an attempt to
-	/// access something that has already been closed.
-	/// </summary>
-	[Serializable]
-	public class AlreadyClosedException:System.SystemException
-	{
-		public AlreadyClosedException(System.String message):base(message)
-		{
-		}
+    /// <summary> This exception is thrown when there is an attempt to
+    /// access something that has already been closed.
+    /// </summary>
+    [Serializable]
+    public class AlreadyClosedException : SystemException
+    {
+        public AlreadyClosedException()
+        {
+        }
+
+        public AlreadyClosedException(string message) : base(message)
+        {
+        }
+
+        public AlreadyClosedException(string message, Exception inner) : base(message, inner)
+        {
+        }
 
-        protected AlreadyClosedException(SerializationInfo info, StreamingContext context)
: base(info, context)
+        protected AlreadyClosedException(
+            SerializationInfo info,
+            StreamingContext context) : base(info, context)
         {
         }
-	}
+    }
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/BufferedIndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/BufferedIndexInput.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/BufferedIndexInput.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/BufferedIndexInput.cs
Sun Feb 19 23:35:48 2012
@@ -27,7 +27,7 @@ namespace Lucene.Net.Store
 		/// <summary>Default buffer size </summary>
 		public const int BUFFER_SIZE = 1024;
 		
-		private int bufferSize = BUFFER_SIZE;
+		private int _bufferSize = BUFFER_SIZE;
 		
 		protected internal byte[] buffer;
 		
@@ -50,17 +50,17 @@ namespace Lucene.Net.Store
 		protected BufferedIndexInput(int bufferSize)
 		{
 			CheckBufferSize(bufferSize);
-			this.bufferSize = bufferSize;
+			this._bufferSize = bufferSize;
 		}
 		
 		/// <summary>Change the buffer size used by this IndexInput </summary>
 		public virtual void  SetBufferSize(int newSize)
 		{
-			System.Diagnostics.Debug.Assert(buffer == null || bufferSize == buffer.Length, "buffer="
+ buffer + " bufferSize=" + bufferSize + " buffer.length=" +(buffer != null ? buffer.Length:
0));
-			if (newSize != bufferSize)
+			System.Diagnostics.Debug.Assert(buffer == null || _bufferSize == buffer.Length, "buffer="
+ buffer + " bufferSize=" + _bufferSize + " buffer.length=" +(buffer != null ? buffer.Length:
0));
+			if (newSize != _bufferSize)
 			{
 				CheckBufferSize(newSize);
-				bufferSize = newSize;
+				_bufferSize = newSize;
 				if (buffer != null)
 				{
 					// Resize the existing buffer and carefully save as
@@ -87,15 +87,23 @@ namespace Lucene.Net.Store
 			// Subclasses can do something here
 			buffer = newBuffer;
 		}
-		
-		/// <seealso cref="SetBufferSize">
-		/// </seealso>
-		public virtual int GetBufferSize()
-		{
-			return bufferSize;
-		}
-		
-		private void  CheckBufferSize(int bufferSize)
+
+	    /// <seealso cref="SetBufferSize">
+	    /// </seealso>
+	    public virtual int BufferSize
+	    {
+	        get { return _bufferSize; }
+	    }
+        
+        /// <seealso cref="SetBufferSize">
+        /// </seealso>
+        [Obsolete("Use BufferSize property instead.")]
+        public virtual int GetBufferSize()
+        {
+            return BufferSize;
+        }
+
+	    private void  CheckBufferSize(int bufferSize)
 		{
 			if (bufferSize <= 0)
 				throw new System.ArgumentException("bufferSize must be greater than 0 (got " + bufferSize
+ ")");
@@ -129,7 +137,7 @@ namespace Lucene.Net.Store
 					bufferPosition += available;
 				}
 				// and now, read the remaining 'len' bytes:
-				if (useBuffer && len < bufferSize)
+				if (useBuffer && len < _bufferSize)
 				{
 					// If the amount left to read is small enough, and
 					// we are allowed to use our buffer, do it in the usual
@@ -170,7 +178,7 @@ namespace Lucene.Net.Store
 		private void  Refill()
 		{
 			long start = bufferStart + bufferPosition;
-			long end = start + bufferSize;
+			long end = start + _bufferSize;
 			if (end > Length())
 			// don't read past EOF
 				end = Length();
@@ -180,7 +188,7 @@ namespace Lucene.Net.Store
 			
 			if (buffer == null)
 			{
-				NewBuffer(new byte[bufferSize]); // allocate buffer lazily
+				NewBuffer(new byte[_bufferSize]); // allocate buffer lazily
 				SeekInternal(bufferStart);
 			}
 			ReadInternal(buffer, 0, newLength);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexInput.cs
Sun Feb 19 23:35:48 2012
@@ -49,14 +49,19 @@ namespace Lucene.Net.Store
 			main.ReadBytes(b, offset, len);
 			digest.Update(b, offset, len);
 		}
-		
-		
-		public virtual long GetChecksum()
-		{
-			return digest.GetValue();
-		}
 
-        protected override void Dispose(bool disposing)
+	    public virtual long Checksum
+	    {
+	        get { return digest.Value; }
+	    }
+
+        [Obsolete("Use Checksum property instead")]
+        public virtual long GetChecksum()
+        {
+            return Checksum;
+        }
+
+	    protected override void Dispose(bool disposing)
         {
             if (isDisposed) return;
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexOutput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexOutput.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexOutput.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/CheckSumIndexOutput.cs
Sun Feb 19 23:35:48 2012
@@ -49,13 +49,19 @@ namespace Lucene.Net.Store
 			digest.Update(b, offset, length);
 			main.WriteBytes(b, offset, length);
 		}
-		
-		public virtual long GetChecksum()
-		{
-			return digest.GetValue();
-		}
-		
-		public override void  Flush()
+
+	    public virtual long Checksum
+	    {
+	        get { return digest.GetValue(); }
+	    }
+
+        [Obsolete("Use Checksum property instead")]
+        public virtual long GetChecksum()
+        {
+            return Checksum;
+        }
+
+	    public override void  Flush()
 		{
 			main.Flush();
 		}
@@ -89,7 +95,7 @@ namespace Lucene.Net.Store
 		/// </summary>
 		public virtual void  PrepareCommit()
 		{
-			long checksum = GetChecksum();
+			long checksum = Checksum;
 			// Intentionally write a mismatched checksum.  This is
 			// because we want to 1) test, as best we can, that we
 			// are able to write a long to the file, but 2) not
@@ -104,7 +110,7 @@ namespace Lucene.Net.Store
 		/// <summary>See <see cref="PrepareCommit" /> </summary>
 		public virtual void  FinishCommit()
 		{
-			main.WriteLong(GetChecksum());
+			main.WriteLong(Checksum);
 		}
 		
 		public override long Length()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/Directory.cs Sun Feb
19 23:35:48 2012
@@ -146,7 +146,7 @@ namespace Lucene.Net.Store
 		{
 		    System.Diagnostics.Debug.Assert(lockFactory != null);
 			this.lockFactory = lockFactory;
-			lockFactory.SetLockPrefix(this.GetLockID());
+			lockFactory.SetLockPrefix(this.LockId);
 		}
 		
 		/// <summary> Get the LockFactory that this Directory instance is
@@ -158,20 +158,33 @@ namespace Lucene.Net.Store
 		{
 			return this.lockFactory;
 		}
-		
-		/// <summary> Return a string identifier that uniquely differentiates
-		/// this Directory instance from other Directory instances.
-		/// This ID should be the same if two Directory instances
-		/// (even in different JVMs and/or on different machines)
-		/// are considered "the same index".  This is how locking
-		/// "scopes" to the right index.
-		/// </summary>
-		public virtual System.String GetLockID()
-		{
-			return this.ToString();
-		}
 
-        public override string ToString()
+	    /// <summary> Return a string identifier that uniquely differentiates
+	    /// this Directory instance from other Directory instances.
+	    /// This ID should be the same if two Directory instances
+	    /// (even in different JVMs and/or on different machines)
+	    /// are considered "the same index".  This is how locking
+	    /// "scopes" to the right index.
+	    /// </summary>
+	    public virtual string LockId
+	    {
+	        get { return ToString(); }
+	    }
+
+        /// <summary> Return a string identifier that uniquely differentiates
+        /// this Directory instance from other Directory instances.
+        /// This ID should be the same if two Directory instances
+        /// (even in different JVMs and/or on different machines)
+        /// are considered "the same index".  This is how locking
+        /// "scopes" to the right index.
+        /// </summary>
+        [Obsolete("Use LockId property instead.")]
+        public virtual System.String GetLockID()
+        {
+            return ToString();
+        }
+
+	    public override string ToString()
         {
             return base.ToString() + " lockFactory=" + GetLockFactory();
         }

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/FSDirectory.cs Sun
Feb 19 23:35:48 2012
@@ -418,37 +418,40 @@ namespace Lucene.Net.Store
 		
 		/// <summary> So we can do some byte-to-hexchar conversion below</summary>
 		private static readonly char[] HEX_DIGITS = new char[]{'0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-		
-		
-		public override System.String GetLockID()
-		{
-			EnsureOpen();
-			System.String dirName; // name to be hashed
-			try
-			{
-				dirName = directory.FullName;
-			}
-			catch (System.IO.IOException e)
-			{
-				throw new System.SystemException(e.ToString(), e);
-			}
-			
-			byte[] digest;
-			lock (DIGESTER)
-			{
-				digest = DIGESTER.ComputeHash(System.Text.Encoding.UTF8.GetBytes(dirName));
-			}
-			System.Text.StringBuilder buf = new System.Text.StringBuilder();
-			buf.Append("lucene-");
-			for (int i = 0; i < digest.Length; i++)
-			{
-				int b = digest[i];
-				buf.Append(HEX_DIGITS[(b >> 4) & 0xf]);
-				buf.Append(HEX_DIGITS[b & 0xf]);
-			}
-			
-			return buf.ToString();
-		}
+
+
+	    public override string LockId
+	    {
+	        get
+	        {
+	            EnsureOpen();
+	            System.String dirName; // name to be hashed
+	            try
+	            {
+	                dirName = directory.FullName;
+	            }
+	            catch (System.IO.IOException e)
+	            {
+	                throw new System.SystemException(e.ToString(), e);
+	            }
+
+	            byte[] digest;
+	            lock (DIGESTER)
+	            {
+	                digest = DIGESTER.ComputeHash(System.Text.Encoding.UTF8.GetBytes(dirName));
+	            }
+	            System.Text.StringBuilder buf = new System.Text.StringBuilder();
+	            buf.Append("lucene-");
+	            for (int i = 0; i < digest.Length; i++)
+	            {
+	                int b = digest[i];
+	                buf.Append(HEX_DIGITS[(b >> 4) & 0xf]);
+	                buf.Append(HEX_DIGITS[b & 0xf]);
+	            }
+
+	            return buf.ToString();
+	        }
+	    }
 
 	    protected override void Dispose(bool disposing)
         {

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/CRC32.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/CRC32.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/CRC32.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/CRC32.cs Sun Feb
19 23:35:48 2012
@@ -26,9 +26,17 @@ namespace Lucene.Net.Support
 
         private UInt32 crc = 0;
 
+        public long Value
+        {
+            get
+            {
+                return crc & 0xffffffffL;
+            }
+        }
+
         public Int64 GetValue()
         {
-            return (Int64)crc & 0xffffffffL;
+            return Value;
         }
 
         public void Reset()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/IChecksum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/IChecksum.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/IChecksum.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/IChecksum.cs Sun
Feb 19 23:35:48 2012
@@ -27,6 +27,8 @@ namespace Lucene.Net.Support
         void Update(int b);
         void Update(byte[] b);
         void Update(byte[] b, int offset, int length);
+        [Obsolete("Use Value property instead")]
         Int64 GetValue();
+        long Value { get; }
     }
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/Single.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/Single.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/Single.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/Single.cs Sun Feb
19 23:35:48 2012
@@ -26,7 +26,7 @@ namespace Lucene.Net.Support
             }
             catch (System.FormatException fex)
             {
-                throw fex;
+                throw;
             }
         }
 
@@ -47,7 +47,7 @@ namespace Lucene.Net.Support
             }
             catch (System.FormatException fex)
             {
-                throw fex;
+                throw;
             }
         }
 
@@ -68,7 +68,7 @@ namespace Lucene.Net.Support
             }
             catch (System.FormatException fex)
             {
-                throw fex;
+                throw;
             }
         }
 
@@ -88,7 +88,7 @@ namespace Lucene.Net.Support
             }
             catch (System.FormatException fex)
             {
-                throw fex;
+                throw;
             }
         }
 

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/WeakDictionary.cs
Sun Feb 19 23:35:48 2012
@@ -5,7 +5,7 @@ using System.Linq;
 
 namespace Lucene.Net.Support
 {
-    public class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue>
+    public sealed class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue>
     {
         private HashMap<WeakKey<TKey>, TValue> _hm;
         private int _gcCollections = 0;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/AttributeSource.cs
Sun Feb 19 23:35:48 2012
@@ -17,6 +17,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using Lucene.Net.Support;
 using TokenStream = Lucene.Net.Analysis.TokenStream;
 
@@ -129,11 +130,18 @@ namespace Lucene.Net.Util
             this.currentState = new State[1];
             this.factory = factory;
 		}
-		
+
+        /// <summary> returns the used AttributeFactory.</summary>
+        public virtual AttributeFactory Factory
+	    {
+            get { return this.factory; }
+	    }
+
 		/// <summary> returns the used AttributeFactory.</summary>
+		[Obsolete("Use Factory property instead")]
 		public virtual AttributeFactory GetAttributeFactory()
 		{
-			return this.factory;
+		    return Factory;
 		}
 		
 		/// <summary>Returns a new iterator that iterates the attribute classes
@@ -143,91 +151,56 @@ namespace Lucene.Net.Util
 		/// Note that this return value is different from Java in that it enumerates over the values
 		/// and not the keys
 		/// </summary>
+		[Obsolete("Use AttributeClasses property instead")]
 		public virtual IEnumerable<Type> GetAttributeClassesIterator()
 		{
-            foreach (AttributeImplItem item in this.attributes)
-            {
-                yield return item.Key;
-            }
+		    return AttributeClasses;
 		}
+
+        /// <summary>Returns a new iterator that iterates the attribute classes
+        /// in the same order they were added in.
+        /// Signature for Java 1.5: <c>public Iterator&lt;Class&lt;? extends
Attribute&gt;&gt; getAttributeClassesIterator()</c>
+        ///
+        /// Note that this return value is different from Java in that it enumerates over
the values
+        /// and not the keys
+        /// </summary>
+	    public virtual IEnumerable<Type> AttributeClasses
+	    {
+	        get 
+            {
+	            return this.attributes.Select(item => item.Key);
+	        }
+	    }
 		
 		/// <summary>Returns a new iterator that iterates all unique Attribute implementations.
 		/// This iterator may contain less entries that <see cref="GetAttributeClassesIterator"
/>,
 		/// if one instance implements more than one Attribute interface.
 		/// Signature for Java 1.5: <c>public Iterator&lt;AttributeImpl&gt; getAttributeImplsIterator()</c>
 		/// </summary>
+		[Obsolete("Use AttributeImpls property instead")]
 		public virtual IEnumerable<AttributeImpl> GetAttributeImplsIterator()
 		{
-		    var initState = GetCurrentState();
-            if (initState != null)
-            {
-                return new AnonymousEnumerable(initState);
-            }
-            
-            return new List<AttributeImpl>();
-        }
-
-        class AnonymousEnumerable : IEnumerable<AttributeImpl>
-        {
-            State state;
-            public AnonymousEnumerable(State state)
-            {
-                this.state = state;
-            }
-            public IEnumerator<AttributeImpl> GetEnumerator()
-            {
-                return new AnonymousEnumerator(state);
-            }
-            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
-            {
-                return new AnonymousEnumerator(state);
-            }
-        }
-		
-        class AnonymousEnumerator : IEnumerator<AttributeImpl>
-        {
-            State state;
-            public AnonymousEnumerator(State state)
-            {
-                this.state = state;
-            }
+		    return AttributeImpls;
+		}
 
-            AttributeImpl InternalCurrent
-            {
-                get
+        /// <summary>Returns a new iterator that iterates all unique Attribute implementations.
+        /// This iterator may contain less entries that <see cref="GetAttributeClassesIterator"
/>,
+        /// if one instance implements more than one Attribute interface.
+        /// Signature for Java 1.5: <c>public Iterator&lt;AttributeImpl&gt;
getAttributeImplsIterator()</c>
+        /// </summary>
+	    public virtual IEnumerable<AttributeImpl> AttributeImpls
+	    {
+	        get
+	        {
+                var initState = GetCurrentState();
+                while (initState != null)
                 {
-                    if (state == null)
-                        throw new KeyNotFoundException();
-
-                    AttributeImpl att = state.attribute;
-                    state = state.next;
-                    return att;
+                    var att = initState.attribute;
+                    initState = initState.next;
+                    yield return att;
                 }
-            }
- 
-            public AttributeImpl Current
-            {
-                get { return InternalCurrent; }
-            }
-
-            public void Dispose()
-            {}
-
-            object System.Collections.IEnumerator.Current
-            {
-                get { return InternalCurrent; }
-            }
-
-            public bool MoveNext()
-            {
-                return state != null;
-            }
-
-            public void Reset()
-            {
-                
-            }
-        }
+	        }
+	    }
 
 	    /// <summary>a cache that stores all interfaces for known implementation classes
for performance (slow reflection) </summary>
 	    private static readonly WeakDictionary<Type, System.Collections.Generic.LinkedList<WeakReference>>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/UnicodeUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/UnicodeUtil.cs?rev=1291092&r1=1291091&r2=1291092&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/UnicodeUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/UnicodeUtil.cs Sun
Feb 19 23:35:48 2012
@@ -59,7 +59,7 @@ namespace Lucene.Net.Util
 	/// may suddenly change. <p/>
 	/// </summary>
 	
-	sealed public class UnicodeUtil
+	public static class UnicodeUtil
 	{
 		
 		public const int UNI_SUR_HIGH_START = 0xD800;



Mime
View raw message