Return-Path: X-Original-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Delivered-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E46EF9F3E for ; Sun, 19 Feb 2012 23:36:14 +0000 (UTC) Received: (qmail 92630 invoked by uid 500); 19 Feb 2012 23:36:14 -0000 Delivered-To: apmail-lucene-lucene-net-commits-archive@lucene.apache.org Received: (qmail 92606 invoked by uid 500); 19 Feb 2012 23:36:14 -0000 Mailing-List: contact lucene-net-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucene.apache.org Delivered-To: mailing list lucene-net-commits@lucene.apache.org Received: (qmail 92599 invoked by uid 99); 19 Feb 2012 23:36:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Feb 2012 23:36:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FRT_STOCK2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Feb 2012 23:36:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E0A1B2388C42; Sun, 19 Feb 2012 23:35:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Sun, 19 Feb 2012 23:35:50 -0000 To: lucene-net-commits@lucene.apache.org From: ccurrens@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120219233552.E0A1B2388C42@eris.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/ 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 { - - /// This exception is thrown when there is an attempt to - /// access something that has already been closed. - /// - [Serializable] - public class AlreadyClosedException:System.SystemException - { - public AlreadyClosedException(System.String message):base(message) - { - } + /// This exception is thrown when there is an attempt to + /// access something that has already been closed. + /// + [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 /// Default buffer size 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; } /// Change the buffer size used by this IndexInput 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; } - - /// - /// - public virtual int GetBufferSize() - { - return bufferSize; - } - - private void CheckBufferSize(int bufferSize) + + /// + /// + public virtual int BufferSize + { + get { return _bufferSize; } + } + + /// + /// + [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 /// 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 /// See 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); } /// Get the LockFactory that this Directory instance is @@ -158,20 +158,33 @@ namespace Lucene.Net.Store { return this.lockFactory; } - - /// 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. - /// - public virtual System.String GetLockID() - { - return this.ToString(); - } - public override string ToString() + /// 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. + /// + public virtual string LockId + { + get { return ToString(); } + } + + /// 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. + /// + [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 /// So we can do some byte-to-hexchar conversion below 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 : IDictionary + public sealed class WeakDictionary : IDictionary { private HashMap, 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; } - + + /// returns the used AttributeFactory. + public virtual AttributeFactory Factory + { + get { return this.factory; } + } + /// returns the used AttributeFactory. + [Obsolete("Use Factory property instead")] public virtual AttributeFactory GetAttributeFactory() { - return this.factory; + return Factory; } /// 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 /// + [Obsolete("Use AttributeClasses property instead")] public virtual IEnumerable GetAttributeClassesIterator() { - foreach (AttributeImplItem item in this.attributes) - { - yield return item.Key; - } + return AttributeClasses; } + + /// Returns a new iterator that iterates the attribute classes + /// in the same order they were added in. + /// Signature for Java 1.5: public Iterator<Class<? extends Attribute>> getAttributeClassesIterator() + /// + /// Note that this return value is different from Java in that it enumerates over the values + /// and not the keys + /// + public virtual IEnumerable AttributeClasses + { + get + { + return this.attributes.Select(item => item.Key); + } + } /// Returns a new iterator that iterates all unique Attribute implementations. /// This iterator may contain less entries that , /// if one instance implements more than one Attribute interface. /// Signature for Java 1.5: public Iterator<AttributeImpl> getAttributeImplsIterator() /// + [Obsolete("Use AttributeImpls property instead")] public virtual IEnumerable GetAttributeImplsIterator() { - var initState = GetCurrentState(); - if (initState != null) - { - return new AnonymousEnumerable(initState); - } - - return new List(); - } - - class AnonymousEnumerable : IEnumerable - { - State state; - public AnonymousEnumerable(State state) - { - this.state = state; - } - public IEnumerator GetEnumerator() - { - return new AnonymousEnumerator(state); - } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new AnonymousEnumerator(state); - } - } - - class AnonymousEnumerator : IEnumerator - { - State state; - public AnonymousEnumerator(State state) - { - this.state = state; - } + return AttributeImpls; + } - AttributeImpl InternalCurrent - { - get + /// Returns a new iterator that iterates all unique Attribute implementations. + /// This iterator may contain less entries that , + /// if one instance implements more than one Attribute interface. + /// Signature for Java 1.5: public Iterator<AttributeImpl> getAttributeImplsIterator() + /// + public virtual IEnumerable 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() - { - - } - } + } + } /// a cache that stores all interfaces for known implementation classes for performance (slow reflection) private static readonly WeakDictionary> 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.

///

- sealed public class UnicodeUtil + public static class UnicodeUtil { public const int UNI_SUR_HIGH_START = 0xD800;