lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/2] lucenenet git commit: More porting work
Date Sun, 25 Jan 2015 13:46:35 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 1b806ebf5 -> 56bfeaab2


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TeeSinkTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TeeSinkTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TeeSinkTokenFilter.cs
index f6857d9..3aedabe 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TeeSinkTokenFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TeeSinkTokenFilter.cs
@@ -1,300 +1,277 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.analysis.sinks
+namespace Lucene.Net.Analysis.Sinks
 {
 
-	/*
-	 * 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.
-	 */
+    /*
+     * 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.
+     */
+    /// <summary>
+    /// This TokenFilter provides the ability to set aside attribute states
+    /// that have already been analyzed.  This is useful in situations where multiple fields share
+    /// many common analysis steps and then go their separate ways.
+    /// <p/>
+    /// It is also useful for doing things like entity extraction or proper noun analysis as
+    /// part of the analysis workflow and saving off those tokens for use in another field.
+    /// 
+    /// <pre class="prettyprint">
+    /// TeeSinkTokenFilter source1 = new TeeSinkTokenFilter(new WhitespaceTokenizer(version, reader1));
+    /// TeeSinkTokenFilter.SinkTokenStream sink1 = source1.newSinkTokenStream();
+    /// TeeSinkTokenFilter.SinkTokenStream sink2 = source1.newSinkTokenStream();
+    /// 
+    /// TeeSinkTokenFilter source2 = new TeeSinkTokenFilter(new WhitespaceTokenizer(version, reader2));
+    /// source2.addSinkTokenStream(sink1);
+    /// source2.addSinkTokenStream(sink2);
+    /// 
+    /// TokenStream final1 = new LowerCaseFilter(version, source1);
+    /// TokenStream final2 = source2;
+    /// TokenStream final3 = new EntityDetect(sink1);
+    /// TokenStream final4 = new URLDetect(sink2);
+    /// 
+    /// d.add(new TextField("f1", final1, Field.Store.NO));
+    /// d.add(new TextField("f2", final2, Field.Store.NO));
+    /// d.add(new TextField("f3", final3, Field.Store.NO));
+    /// d.add(new TextField("f4", final4, Field.Store.NO));
+    /// </pre>
+    /// In this example, <code>sink1</code> and <code>sink2</code> will both get tokens from both
+    /// <code>reader1</code> and <code>reader2</code> after whitespace tokenizer
+    /// and now we can further wrap any of these in extra analysis, and more "sources" can be inserted if desired.
+    /// It is important, that tees are consumed before sinks (in the above example, the field names must be
+    /// less the sink's field names). If you are not sure, which stream is consumed first, you can simply
+    /// add another sink and then pass all tokens to the sinks at once using <seealso cref="#consumeAllTokens"/>.
+    /// This TokenFilter is exhausted after this. In the above example, change
+    /// the example above to:
+    /// <pre class="prettyprint">
+    /// ...
+    /// TokenStream final1 = new LowerCaseFilter(version, source1.newSinkTokenStream());
+    /// TokenStream final2 = source2.newSinkTokenStream();
+    /// sink1.consumeAllTokens();
+    /// sink2.consumeAllTokens();
+    /// ...
+    /// </pre>
+    /// In this case, the fields can be added in any order, because the sources are not used anymore and all sinks are ready.
+    /// <para>Note, the EntityDetect and URLDetect TokenStreams are for the example and do not currently exist in Lucene.
+    /// </para>
+    /// </summary>
+    public sealed class TeeSinkTokenFilter : TokenFilter
+    {
+        private readonly ICollection<WeakReference<SinkTokenStream>> sinks = new LinkedList<WeakReference<SinkTokenStream>>();
 
+        /// <summary>
+        /// Instantiates a new TeeSinkTokenFilter.
+        /// </summary>
+        public TeeSinkTokenFilter(TokenStream input)
+            : base(input)
+        {
+        }
 
-	using AttributeImpl = org.apache.lucene.util.AttributeImpl;
-	using AttributeSource = org.apache.lucene.util.AttributeSource;
+        /// <summary>
+        /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream.
+        /// </summary>
+        public SinkTokenStream NewSinkTokenStream()
+        {
+            return NewSinkTokenStream(ACCEPT_ALL_FILTER);
+        }
 
-	/// <summary>
-	/// This TokenFilter provides the ability to set aside attribute states
-	/// that have already been analyzed.  This is useful in situations where multiple fields share
-	/// many common analysis steps and then go their separate ways.
-	/// <p/>
-	/// It is also useful for doing things like entity extraction or proper noun analysis as
-	/// part of the analysis workflow and saving off those tokens for use in another field.
-	/// 
-	/// <pre class="prettyprint">
-	/// TeeSinkTokenFilter source1 = new TeeSinkTokenFilter(new WhitespaceTokenizer(version, reader1));
-	/// TeeSinkTokenFilter.SinkTokenStream sink1 = source1.newSinkTokenStream();
-	/// TeeSinkTokenFilter.SinkTokenStream sink2 = source1.newSinkTokenStream();
-	/// 
-	/// TeeSinkTokenFilter source2 = new TeeSinkTokenFilter(new WhitespaceTokenizer(version, reader2));
-	/// source2.addSinkTokenStream(sink1);
-	/// source2.addSinkTokenStream(sink2);
-	/// 
-	/// TokenStream final1 = new LowerCaseFilter(version, source1);
-	/// TokenStream final2 = source2;
-	/// TokenStream final3 = new EntityDetect(sink1);
-	/// TokenStream final4 = new URLDetect(sink2);
-	/// 
-	/// d.add(new TextField("f1", final1, Field.Store.NO));
-	/// d.add(new TextField("f2", final2, Field.Store.NO));
-	/// d.add(new TextField("f3", final3, Field.Store.NO));
-	/// d.add(new TextField("f4", final4, Field.Store.NO));
-	/// </pre>
-	/// In this example, <code>sink1</code> and <code>sink2</code> will both get tokens from both
-	/// <code>reader1</code> and <code>reader2</code> after whitespace tokenizer
-	/// and now we can further wrap any of these in extra analysis, and more "sources" can be inserted if desired.
-	/// It is important, that tees are consumed before sinks (in the above example, the field names must be
-	/// less the sink's field names). If you are not sure, which stream is consumed first, you can simply
-	/// add another sink and then pass all tokens to the sinks at once using <seealso cref="#consumeAllTokens"/>.
-	/// This TokenFilter is exhausted after this. In the above example, change
-	/// the example above to:
-	/// <pre class="prettyprint">
-	/// ...
-	/// TokenStream final1 = new LowerCaseFilter(version, source1.newSinkTokenStream());
-	/// TokenStream final2 = source2.newSinkTokenStream();
-	/// sink1.consumeAllTokens();
-	/// sink2.consumeAllTokens();
-	/// ...
-	/// </pre>
-	/// In this case, the fields can be added in any order, because the sources are not used anymore and all sinks are ready.
-	/// <para>Note, the EntityDetect and URLDetect TokenStreams are for the example and do not currently exist in Lucene.
-	/// </para>
-	/// </summary>
-	public sealed class TeeSinkTokenFilter : TokenFilter
-	{
-	  private readonly IList<WeakReference<SinkTokenStream>> sinks = new LinkedList<WeakReference<SinkTokenStream>>();
+        /// <summary>
+        /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream
+        /// that pass the supplied filter. </summary>
+        /// <seealso cref= SinkFilter></seealso>
+        public SinkTokenStream NewSinkTokenStream(SinkFilter filter)
+        {
+            var sink = new SinkTokenStream(CloneAttributes(), filter);
+            this.sinks.Add(new WeakReference<SinkTokenStream>(sink));
+            return sink;
+        }
 
-	  /// <summary>
-	  /// Instantiates a new TeeSinkTokenFilter.
-	  /// </summary>
-	  public TeeSinkTokenFilter(TokenStream input) : base(input)
-	  {
-	  }
+        /// <summary>
+        /// Adds a <seealso cref="SinkTokenStream"/> created by another <code>TeeSinkTokenFilter</code>
+        /// to this one. The supplied stream will also receive all consumed tokens.
+        /// This method can be used to pass tokens from two different tees to one sink.
+        /// </summary>
+        public void AddSinkTokenStream(SinkTokenStream sink)
+        {
+            // check that sink has correct factory
+            if (!attributeFactory.Equals(sink.attributeFactory))
+            {
+                throw new System.ArgumentException("The supplied sink is not compatible to this tee");
+            }
+            // add eventually missing attribute impls to the existing sink
+            for (var it = CloneAttributes().AttributeImplsIterator; it.MoveNext(); )
+            {
+                sink.AddAttributeImpl(it.Current);
+            }
+            this.sinks.Add(new WeakReference<SinkTokenStream>(sink));
+        }
 
-	  /// <summary>
-	  /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream.
-	  /// </summary>
-	  public SinkTokenStream newSinkTokenStream()
-	  {
-		return newSinkTokenStream(ACCEPT_ALL_FILTER);
-	  }
+        /// <summary>
+        /// <code>TeeSinkTokenFilter</code> passes all tokens to the added sinks
+        /// when itself is consumed. To be sure, that all tokens from the input
+        /// stream are passed to the sinks, you can call this methods.
+        /// This instance is exhausted after this, but all sinks are instant available.
+        /// </summary>
+        public void ConsumeAllTokens()
+        {
+            while (IncrementToken())
+            {
+            }
+        }
 
-	  /// <summary>
-	  /// Returns a new <seealso cref="SinkTokenStream"/> that receives all tokens consumed by this stream
-	  /// that pass the supplied filter. </summary>
-	  /// <seealso cref= SinkFilter </seealso>
-	  public SinkTokenStream newSinkTokenStream(SinkFilter filter)
-	  {
-		SinkTokenStream sink = new SinkTokenStream(this.cloneAttributes(), filter);
-		this.sinks.Add(new WeakReference<>(sink));
-		return sink;
-	  }
+        public override bool IncrementToken()
+        {
+            if (input.IncrementToken())
+            {
+                // capture state lazily - maybe no SinkFilter accepts this state
+                AttributeSource.State state = null;
+                foreach (WeakReference<SinkTokenStream> @ref in sinks)
+                {
+                    SinkTokenStream sink;
+                    if (@ref.TryGetTarget(out sink))
+                    {
+                        if (sink.Accept(this))
+                        {
+                            if (state == null)
+                            {
+                                state = CaptureState();
+                            }
+                            sink.AddState(state);
+                        }
+                    }
+                }
+                return true;
+            }
 
-	  /// <summary>
-	  /// Adds a <seealso cref="SinkTokenStream"/> created by another <code>TeeSinkTokenFilter</code>
-	  /// to this one. The supplied stream will also receive all consumed tokens.
-	  /// This method can be used to pass tokens from two different tees to one sink.
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: public void addSinkTokenStream(final SinkTokenStream sink)
-	  public void addSinkTokenStream(SinkTokenStream sink)
-	  {
-		// check that sink has correct factory
-		if (!this.AttributeFactory.Equals(sink.AttributeFactory))
-		{
-		  throw new System.ArgumentException("The supplied sink is not compatible to this tee");
-		}
-		// add eventually missing attribute impls to the existing sink
-		for (IEnumerator<AttributeImpl> it = this.cloneAttributes().AttributeImplsIterator; it.MoveNext();)
-		{
-		  sink.addAttributeImpl(it.Current);
-		}
-		this.sinks.Add(new WeakReference<>(sink));
-	  }
+            return false;
+        }
 
-	  /// <summary>
-	  /// <code>TeeSinkTokenFilter</code> passes all tokens to the added sinks
-	  /// when itself is consumed. To be sure, that all tokens from the input
-	  /// stream are passed to the sinks, you can call this methods.
-	  /// This instance is exhausted after this, but all sinks are instant available.
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void consumeAllTokens() throws java.io.IOException
-	  public void consumeAllTokens()
-	  {
-		while (incrementToken())
-		{
-		}
-	  }
+        public override void End()
+        {
+            base.End();
+            AttributeSource.State finalState = CaptureState();
+            foreach (WeakReference<SinkTokenStream> @ref in sinks)
+            {
+                SinkTokenStream sink; ;
+                if (@ref.TryGetTarget(out sink))
+                {
+                    sink.FinalState = finalState;
+                }
+            }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
-	  public override bool incrementToken()
-	  {
-		if (input.incrementToken())
-		{
-		  // capture state lazily - maybe no SinkFilter accepts this state
-		  AttributeSource.State state = null;
-		  foreach (WeakReference<SinkTokenStream> @ref in sinks)
-		  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final SinkTokenStream sink = ref.get();
-			SinkTokenStream sink = @ref.get();
-			if (sink != null)
-			{
-			  if (sink.accept(this))
-			  {
-				if (state == null)
-				{
-				  state = this.captureState();
-				}
-				sink.addState(state);
-			  }
-			}
-		  }
-		  return true;
-		}
+        /// <summary>
+        /// A filter that decides which <seealso cref="AttributeSource"/> states to store in the sink.
+        /// </summary>
+        public abstract class SinkFilter
+        {
+            /// <summary>
+            /// Returns true, iff the current state of the passed-in <seealso cref="AttributeSource"/> shall be stored
+            /// in the sink. 
+            /// </summary>
+            public abstract bool Accept(AttributeSource source);
 
-		return false;
-	  }
+            /// <summary>
+            /// Called by <seealso cref="SinkTokenStream#reset()"/>. This method does nothing by default
+            /// and can optionally be overridden.
+            /// </summary>
+            public virtual void Reset()
+            {
+                // nothing to do; can be overridden
+            }
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public final void end() throws java.io.IOException
-	  public override void end()
-	  {
-		base.end();
-		AttributeSource.State finalState = captureState();
-		foreach (WeakReference<SinkTokenStream> @ref in sinks)
-		{
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final SinkTokenStream sink = ref.get();
-		  SinkTokenStream sink = @ref.get();
-		  if (sink != null)
-		  {
-			sink.FinalState = finalState;
-		  }
-		}
-	  }
+        /// <summary>
+        /// TokenStream output from a tee with optional filtering.
+        /// </summary>
+        public sealed class SinkTokenStream : TokenStream
+        {
+            internal readonly ICollection<AttributeSource.State> cachedStates = new LinkedList<AttributeSource.State>();
+            internal AttributeSource.State finalState;
+            internal IEnumerator<AttributeSource.State> it = null;
+            internal SinkFilter filter;
 
-	  /// <summary>
-	  /// A filter that decides which <seealso cref="AttributeSource"/> states to store in the sink.
-	  /// </summary>
-	  public abstract class SinkFilter
-	  {
-		/// <summary>
-		/// Returns true, iff the current state of the passed-in <seealso cref="AttributeSource"/> shall be stored
-		/// in the sink. 
-		/// </summary>
-		public abstract bool accept(AttributeSource source);
+            internal SinkTokenStream(AttributeSource source, SinkFilter filter)
+                : base(source)
+            {
+                this.filter = filter;
+            }
 
-		/// <summary>
-		/// Called by <seealso cref="SinkTokenStream#reset()"/>. This method does nothing by default
-		/// and can optionally be overridden.
-		/// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public void reset() throws java.io.IOException
-		public virtual void reset()
-		{
-		  // nothing to do; can be overridden
-		}
-	  }
+            internal bool Accept(AttributeSource source)
+            {
+                return filter.Accept(source);
+            }
 
-	  /// <summary>
-	  /// TokenStream output from a tee with optional filtering.
-	  /// </summary>
-	  public sealed class SinkTokenStream : TokenStream
-	  {
-		internal readonly IList<AttributeSource.State> cachedStates = new LinkedList<AttributeSource.State>();
-		internal AttributeSource.State finalState;
-		internal IEnumerator<AttributeSource.State> it = null;
-		internal SinkFilter filter;
+            internal void AddState(AttributeSource.State state)
+            {
+                if (it != null)
+                {
+                    throw new System.InvalidOperationException("The tee must be consumed before sinks are consumed.");
+                }
+                cachedStates.Add(state);
+            }
 
-		internal SinkTokenStream(AttributeSource source, SinkFilter filter) : base(source)
-		{
-		  this.filter = filter;
-		}
+            internal AttributeSource.State FinalState
+            {
+                set
+                {
+                    this.finalState = value;
+                }
+            }
 
-		internal bool accept(AttributeSource source)
-		{
-		  return filter.accept(source);
-		}
+            public override bool IncrementToken()
+            {
+                // lazy init the iterator
+                if (it == null)
+                {
+                    it = cachedStates.GetEnumerator();
+                }
 
-		internal void addState(AttributeSource.State state)
-		{
-		  if (it != null)
-		  {
-			throw new System.InvalidOperationException("The tee must be consumed before sinks are consumed.");
-		  }
-		  cachedStates.Add(state);
-		}
+                if (!it.MoveNext())
+                    return false;
 
-		internal AttributeSource.State FinalState
-		{
-			set
-			{
-			  this.finalState = value;
-			}
-		}
+                var state = it.Current;
+                RestoreState(state);
+                return true;
+            }
 
-		public override bool incrementToken()
-		{
-		  // lazy init the iterator
-		  if (it == null)
-		  {
-			it = cachedStates.GetEnumerator();
-		  }
+            public override void End()
+            {
+                if (finalState != null)
+                {
+                    RestoreState(finalState);
+                }
+            }
 
-//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
-		  if (!it.hasNext())
-		  {
-			return false;
-		  }
+            public override void Reset()
+            {
+                it = cachedStates.GetEnumerator();
+            }
+        }
 
-//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
-		  AttributeSource.State state = it.next();
-		  restoreState(state);
-		  return true;
-		}
+        private static readonly SinkFilter ACCEPT_ALL_FILTER = new SinkFilterAnonymousInnerClassHelper();
 
-		public override void end()
-		{
-		  if (finalState != null)
-		  {
-			restoreState(finalState);
-		  }
-		}
+        private class SinkFilterAnonymousInnerClassHelper : SinkFilter
+        {
+            public override bool Accept(AttributeSource source)
+            {
+                return true;
+            }
+        }
 
-		public override void reset()
-		{
-		  it = cachedStates.GetEnumerator();
-		}
-	  }
-
-	  private static readonly SinkFilter ACCEPT_ALL_FILTER = new SinkFilterAnonymousInnerClassHelper();
-
-	  private class SinkFilterAnonymousInnerClassHelper : SinkFilter
-	  {
-		  public SinkFilterAnonymousInnerClassHelper()
-		  {
-		  }
-
-		  public override bool accept(AttributeSource source)
-		  {
-			return true;
-		  }
-	  }
-
-	}
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenRangeSinkFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenRangeSinkFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenRangeSinkFilter.cs
index 568fea6..a5404c5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenRangeSinkFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenRangeSinkFilter.cs
@@ -1,73 +1,70 @@
-namespace org.apache.lucene.analysis.sinks
-{
-
-	/// <summary>
-	/// 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.
-	/// </summary>
+/**
+* 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.
+*/
 
-	using AttributeSource = org.apache.lucene.util.AttributeSource;
+using Lucene.Net.Util;
 
-	/// <summary>
-	/// Counts the tokens as they go by and saves to the internal list those between the range of lower and upper, exclusive of upper
-	/// 
-	/// 
-	/// </summary>
-	public class TokenRangeSinkFilter : TeeSinkTokenFilter.SinkFilter
-	{
-	  private int lower;
-	  private int upper;
-	  private int count;
+namespace Lucene.Net.Analysis.Sinks
+{
 
-	  public TokenRangeSinkFilter(int lower, int upper)
-	  {
-		if (lower < 1)
-		{
-		  throw new System.ArgumentException("lower must be greater than zero");
-		}
-		if (lower > upper)
-		{
-		  throw new System.ArgumentException("lower must not be greater than upper");
-		}
-		this.lower = lower;
-		this.upper = upper;
-	  }
+    /// <summary>
+    /// Counts the tokens as they go by and saves to the internal list those between the range of lower and upper, exclusive of upper
+    /// 
+    /// 
+    /// </summary>
+    public class TokenRangeSinkFilter : TeeSinkTokenFilter.SinkFilter
+    {
+        private readonly int lower;
+        private readonly int upper;
+        private int count;
 
+        public TokenRangeSinkFilter(int lower, int upper)
+        {
+            if (lower < 1)
+            {
+                throw new System.ArgumentException("lower must be greater than zero");
+            }
+            if (lower > upper)
+            {
+                throw new System.ArgumentException("lower must not be greater than upper");
+            }
+            this.lower = lower;
+            this.upper = upper;
+        }
 
-	  public override bool accept(AttributeSource source)
-	  {
-		try
-		{
-		  if (count >= lower && count < upper)
-		  {
-			return true;
-		  }
-		  return false;
-		}
-		finally
-		{
-		  count++;
-		}
-	  }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void reset() throws java.io.IOException
-	  public override void reset()
-	  {
-		count = 0;
-	  }
-	}
+        public override bool Accept(AttributeSource source)
+        {
+            try
+            {
+                if (count >= lower && count < upper)
+                {
+                    return true;
+                }
+                return false;
+            }
+            finally
+            {
+                count++;
+            }
+        }
 
+        public override void Reset()
+        {
+            count = 0;
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
index f844a1c..d46493b 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/TokenTypeSinkFilter.cs
@@ -1,50 +1,47 @@
-namespace org.apache.lucene.analysis.sinks
-{
-
-	/*
-	 * 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.
-	 */
-
-	using TypeAttribute = org.apache.lucene.analysis.tokenattributes.TypeAttribute;
-	using AttributeSource = org.apache.lucene.util.AttributeSource;
-
-	/// <summary>
-	/// Adds a token to the sink if it has a specific type.
-	/// </summary>
-	public class TokenTypeSinkFilter : TeeSinkTokenFilter.SinkFilter
-	{
-	  private string typeToMatch;
-	  private TypeAttribute typeAtt;
+using Lucene.Net.Analysis.Tokenattributes;
+using Lucene.Net.Util;
 
-	  public TokenTypeSinkFilter(string typeToMatch)
-	  {
-		this.typeToMatch = typeToMatch;
-	  }
-
-	  public override bool accept(AttributeSource source)
-	  {
-		if (typeAtt == null)
-		{
-		  typeAtt = source.addAttribute(typeof(TypeAttribute));
-		}
-
-		//check to see if this is a Category
-		return (typeToMatch.Equals(typeAtt.type()));
-	  }
-
-	}
+namespace Lucene.Net.Analysis.Sinks
+{
 
+    /*
+     * 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.
+     */
+    /// <summary>
+    /// Adds a token to the sink if it has a specific type.
+    /// </summary>
+    public class TokenTypeSinkFilter : TeeSinkTokenFilter.SinkFilter
+    {
+        private readonly string typeToMatch;
+        private ITypeAttribute typeAtt;
+
+        public TokenTypeSinkFilter(string typeToMatch)
+        {
+            this.typeToMatch = typeToMatch;
+        }
+
+        public override bool Accept(AttributeSource source)
+        {
+            if (typeAtt == null)
+            {
+                typeAtt = source.AddAttribute<ITypeAttribute>();
+            }
+
+            //check to see if this is a Category
+            return (typeToMatch.Equals(typeAtt.Type));
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizerImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizerImpl.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizerImpl.cs
index 5db482e..4d30289 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizerImpl.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/ClassicTokenizerImpl.cs
@@ -1,8 +1,9 @@
-using System;
-/* The following code was generated by JFlex 1.5.1 */
-using Lucene.Net.Analysis.Standard;
+/* The following code was generated by JFlex 1.5.1 */
+using System;
+using System.IO;
+using org.apache.lucene.analysis.standard;
 
-namespace org.apache.lucene.analysis.standard
+namespace Lucene.Net.Analysis.Standard
 {
 
 	/*
@@ -28,10 +29,7 @@ namespace org.apache.lucene.analysis.standard
 	      the tokenizer, only use the trunk version of JFlex 1.5 at the moment!
 	
 	*/
-
-	using CharTermAttribute = org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-
-	/// <summary>
+    /// <summary>
 	/// This class implements the classic lucene StandardTokenizer up until 3.0 
 	/// </summary>
 
@@ -205,7 +203,7 @@ namespace org.apache.lucene.analysis.standard
 
 	  /// <summary>
 	  /// the input device </summary>
-	  private Reader zzReader;
+	  private TextReader zzReader;
 
 	  /// <summary>
 	  /// the current state of the DFA </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardAnalyzer.cs
index 80ea22b..5458b33 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardAnalyzer.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Analysis.Core;
+using System.IO;
+using Lucene.Net.Analysis.Core;
 using Lucene.Net.Analysis.Util;
 using Lucene.Net.Util;
 using org.apache.lucene.analysis.standard;
@@ -84,7 +85,7 @@ namespace Lucene.Net.Analysis.Standard
 	  /// <param name="matchVersion"> Lucene version to match See {@link
 	  /// <a href="#version">above</a>} </param>
 	  /// <param name="stopwords"> Reader to read stop words from  </param>
-	  public StandardAnalyzer(Version matchVersion, Reader stopwords) : this(matchVersion, loadStopwordSet(stopwords, matchVersion))
+	  public StandardAnalyzer(Version matchVersion, TextReader stopwords) : this(matchVersion, loadStopwordSet(stopwords, matchVersion))
 	  {
 	  }
 
@@ -109,7 +110,7 @@ namespace Lucene.Net.Analysis.Standard
 
 	  protected internal override TokenStreamComponents createComponents(string fieldName, Reader reader)
 	  {
-		StandardTokenizer src = new StandardTokenizer(matchVersion, reader);
+		var src = new StandardTokenizer(matchVersion, reader);
 		src.MaxTokenLength = maxTokenLength;
 		TokenStream tok = new StandardFilter(matchVersion, src);
 		tok = new LowerCaseFilter(matchVersion, tok);
@@ -121,8 +122,8 @@ namespace Lucene.Net.Analysis.Standard
 	  {
 		  private readonly StandardAnalyzer outerInstance;
 
-		  private Reader reader;
-		  private StandardTokenizer src;
+		  private TextReader reader;
+		  private readonly StandardTokenizer src;
 
 		  public TokenStreamComponentsAnonymousInnerClassHelper(StandardAnalyzer outerInstance, StandardTokenizer src, TokenStream tok, Reader reader) : base(src, tok)
 		  {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
index 2be937c..f28fd11 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/FSTSynonymFilterFactory.cs
@@ -1,182 +1,177 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
 using Lucene.Net.Analysis.Core;
 using Lucene.Net.Analysis.Util;
-using org.apache.lucene.analysis.core;
+using Lucene.Net.Util;
 using org.apache.lucene.analysis.synonym;
-using org.apache.lucene.analysis.util;
+using Version = Lucene.Net.Util.Version;
 
 namespace Lucene.Net.Analysis.Synonym
 {
 
-	/*
-	 * 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.
-	 */
-    /// @deprecated (3.4) use <seealso cref="SynonymFilterFactory"/> instead. this is only a backwards compatibility
-	///                   mechanism that will be removed in Lucene 5.0 
-	// NOTE: rename this to "SynonymFilterFactory" and nuke that delegator in Lucene 5.0!
-	[Obsolete("(3.4) use <seealso cref="SynonymFilterFactory"/> instead. this is only a backwards compatibility")]
-	internal sealed class FSTSynonymFilterFactory : TokenFilterFactory, ResourceLoaderAware
-	{
-	  private readonly bool ignoreCase;
-	  private readonly string tokenizerFactory;
-	  private readonly string synonyms;
-	  private readonly string format;
-	  private readonly bool expand;
-	  private readonly IDictionary<string, string> tokArgs = new Dictionary<string, string>();
-
-	  private SynonymMap map;
-
-	  public FSTSynonymFilterFactory(IDictionary<string, string> args) : base(args)
-	  {
-		ignoreCase = getBoolean(args, "ignoreCase", false);
-		synonyms = require(args, "synonyms");
-		format = get(args, "format");
-		expand = getBoolean(args, "expand", true);
-
-		tokenizerFactory = get(args, "tokenizerFactory");
-		if (tokenizerFactory != null)
-		{
-		  assureMatchVersion();
-		  tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();
-		  for (IEnumerator<string> itr = args.Keys.GetEnumerator(); itr.MoveNext();)
-		  {
-			string key = itr.Current;
-			tokArgs[key.ReplaceAll("^tokenizerFactory\\.","")] = args[key];
-			itr.Remove();
-		  }
-		}
-		if (args.Count > 0)
-		{
-		  throw new System.ArgumentException("Unknown parameters: " + args);
-		}
-	  }
-
-	  public override TokenStream Create(TokenStream input)
-	  {
-		// if the fst is null, it means there's actually no synonyms... just return the original stream
-		// as there is nothing to do here.
-		return map.fst == null ? input : new SynonymFilter(input, map, ignoreCase);
-	  }
-
-	  public void inform(ResourceLoader loader)
-	  {
-		TokenizerFactory factory = tokenizerFactory == null ? null : loadTokenizerFactory(loader, tokenizerFactory);
-
-		Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, factory);
-
-		try
-		{
-		  string formatClass = format;
-		  if (format == null || format.Equals("solr"))
-		  {
-			formatClass = typeof(SolrSynonymParser).Name;
-		  }
-		  else if (format.Equals("wordnet"))
-		  {
-			formatClass = typeof(WordnetSynonymParser).Name;
-		  }
-		  // TODO: expose dedup as a parameter?
-		  map = loadSynonyms(loader, formatClass, true, analyzer);
-		}
-		catch (ParseException e)
-		{
-		  throw new IOException("Error parsing synonyms file:", e);
-		}
-	  }
-
-	  private class AnalyzerAnonymousInnerClassHelper : Analyzer
-	  {
-		  private readonly FSTSynonymFilterFactory outerInstance;
-
-		  private TokenizerFactory factory;
-
-		  public AnalyzerAnonymousInnerClassHelper(FSTSynonymFilterFactory outerInstance, TokenizerFactory factory)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.factory = factory;
-		  }
-
-		  protected internal override Analyzer.TokenStreamComponents CreateComponents(string fieldName, Reader reader)
-		  {
-			Tokenizer tokenizer = factory == null ? new WhitespaceTokenizer(Version.LUCENE_CURRENT, reader) : factory.create(reader);
-			TokenStream stream = outerInstance.ignoreCase ? new LowerCaseFilter(Version.LUCENE_CURRENT, tokenizer) : tokenizer;
-			return new Analyzer.TokenStreamComponents(tokenizer, stream);
-		  }
-	  }
-
-	  /// <summary>
-	  /// Load synonyms with the given <seealso cref="SynonymMap.Parser"/> class.
-	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.analysis.synonym.SynonymMap loadSynonyms(ResourceLoader loader, String cname, boolean dedup, org.apache.lucene.analysis.Analyzer analyzer) throws java.io.IOException, java.text.ParseException
-	  private SynonymMap loadSynonyms(ResourceLoader loader, string cname, bool dedup, Analyzer analyzer)
-	  {
-		CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT);
-
-		SynonymMap.Parser parser;
-		Type clazz = loader.findClass(cname, typeof(SynonymMap.Parser));
-		try
-		{
-		  parser = clazz.getConstructor(typeof(bool), typeof(bool), typeof(Analyzer)).newInstance(dedup, expand, analyzer);
-		}
-		catch (Exception e)
-		{
-		  throw new Exception(e);
-		}
-
-		File synonymFile = new File(synonyms);
-		if (synonymFile.exists())
-		{
-		  decoder.reset();
-		  parser.parse(new InputStreamReader(loader.openResource(synonyms), decoder));
-		}
-		else
-		{
-		  IList<string> files = splitFileNames(synonyms);
-		  foreach (string file in files)
-		  {
-			decoder.reset();
-			parser.parse(new InputStreamReader(loader.openResource(file), decoder));
-		  }
-		}
-		return parser.build();
-	  }
-
-	  // (there are no tests for this functionality)
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private TokenizerFactory loadTokenizerFactory(ResourceLoader loader, String cname) throws java.io.IOException
-	  private TokenizerFactory loadTokenizerFactory(ResourceLoader loader, string cname)
-	  {
-		Type clazz = loader.findClass(cname, typeof(TokenizerFactory));
-		try
-		{
-		  TokenizerFactory tokFactory = clazz.getConstructor(typeof(IDictionary)).newInstance(tokArgs);
-		  if (tokFactory is ResourceLoaderAware)
-		  {
-			((ResourceLoaderAware) tokFactory).inform(loader);
-		  }
-		  return tokFactory;
-		}
-		catch (Exception e)
-		{
-		  throw new Exception(e);
-		}
-	  }
-	}
+    /*
+     * 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.
+     */
+    internal sealed class FSTSynonymFilterFactory : TokenFilterFactory, ResourceLoaderAware
+    {
+        private readonly bool ignoreCase;
+        private readonly string tokenizerFactory;
+        private readonly string synonyms;
+        private readonly string format;
+        private readonly bool expand;
+        private readonly IDictionary<string, string> tokArgs = new Dictionary<string, string>();
+
+        private SynonymMap map;
+
+        [Obsolete(@"(3.4) use <seealso cref=""SynonymFilterFactory"" instead. this is only a backwards compatibility")]
+        public FSTSynonymFilterFactory(IDictionary<string, string> args)
+            : base(args)
+        {
+            ignoreCase = getBoolean(args, "ignoreCase", false);
+            synonyms = require(args, "synonyms");
+            format = get(args, "format");
+            expand = getBoolean(args, "expand", true);
+
+            tokenizerFactory = get(args, "tokenizerFactory");
+            if (tokenizerFactory != null)
+            {
+                assureMatchVersion();
+                tokArgs["luceneMatchVersion"] = LuceneMatchVersion.ToString();
+                for (var itr = args.Keys.GetEnumerator(); itr.MoveNext(); )
+                {
+                    var key = itr.Current;
+                    tokArgs[Regex.Replace(itr.Current, "^tokenizerFactory\\.", string.Empty)] = args[key];
+                    itr.Remove();
+                }
+            }
+            if (args.Count > 0)
+            {
+                throw new System.ArgumentException("Unknown parameters: " + args);
+            }
+        }
+
+        public override TokenStream Create(TokenStream input)
+        {
+            // if the fst is null, it means there's actually no synonyms... just return the original stream
+            // as there is nothing to do here.
+            return map.fst == null ? input : new SynonymFilter(input, map, ignoreCase);
+        }
+
+        public void Inform(ResourceLoader loader)
+        {
+            TokenizerFactory factory = tokenizerFactory == null ? null : LoadTokenizerFactory(loader, tokenizerFactory);
+
+            Analyzer analyzer = new AnalyzerAnonymousInnerClassHelper(this, factory);
+
+            try
+            {
+                string formatClass = format;
+                if (format == null || format.Equals("solr"))
+                {
+                    formatClass = typeof(SolrSynonymParser).Name;
+                }
+                else if (format.Equals("wordnet"))
+                {
+                    formatClass = typeof(WordnetSynonymParser).Name;
+                }
+                // TODO: expose dedup as a parameter?
+                map = LoadSynonyms(loader, formatClass, true, analyzer);
+            }
+            catch (ParseException e)
+            {
+                throw new IOException("Error parsing synonyms file:", e);
+            }
+        }
+
+        private class AnalyzerAnonymousInnerClassHelper : Analyzer
+        {
+            private readonly FSTSynonymFilterFactory outerInstance;
+
+            private readonly TokenizerFactory factory;
+
+            public AnalyzerAnonymousInnerClassHelper(FSTSynonymFilterFactory outerInstance, TokenizerFactory factory)
+            {
+                this.outerInstance = outerInstance;
+                this.factory = factory;
+            }
+
+            public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
+            {
+                Tokenizer tokenizer = factory == null ? new WhitespaceTokenizer(Version.LUCENE_CURRENT, reader) : factory.Create(reader);
+                TokenStream stream = outerInstance.ignoreCase ? new LowerCaseFilter(Version.LUCENE_CURRENT, tokenizer) : tokenizer;
+                return new Analyzer.TokenStreamComponents(tokenizer, stream);
+            }
+        }
+
+        /// <summary>
+        /// Load synonyms with the given <seealso cref="SynonymMap.Parser"/> class.
+        /// </summary>
+        private SynonymMap LoadSynonyms(ResourceLoader loader, string cname, bool dedup, Analyzer analyzer)
+        {
+            CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT);
+
+            SynonymMap.Parser parser;
+            Type clazz = loader.findClass(cname, typeof(SynonymMap.Parser));
+            try
+            {
+                parser = clazz.getConstructor(typeof(bool), typeof(bool), typeof(Analyzer)).newInstance(dedup, expand, analyzer);
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e);
+            }
+
+            if (File.Exists(synonyms))
+            {
+                decoder.Reset();
+                parser.parse(new InputStreamReader(loader.openResource(synonyms), decoder));
+            }
+            else
+            {
+                IList<string> files = splitFileNames(synonyms);
+                foreach (string file in files)
+                {
+                    decoder.reset();
+                    parser.parse(new InputStreamReader(loader.openResource(file), decoder));
+                }
+            }
+            return parser.build();
+        }
+
+        // (there are no tests for this functionality)
+        private TokenizerFactory LoadTokenizerFactory(ResourceLoader loader, string cname)
+        {
+            Type clazz = loader.findClass(cname, typeof(TokenizerFactory));
+            try
+            {
+                TokenizerFactory tokFactory = clazz.getConstructor(typeof(IDictionary)).newInstance(tokArgs);
+                if (tokFactory is ResourceLoaderAware)
+                {
+                    ((ResourceLoaderAware)tokFactory).inform(loader);
+                }
+                return tokFactory;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e);
+            }
+        }
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
index 8cf5e28..af4c555 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
@@ -44,19 +44,17 @@ namespace Lucene.Net.Analysis.Util
 
 	  /// <summary>
 	  /// the luceneVersion arg </summary>
-	  protected internal readonly Lucene.Net.Util.Version luceneMatchVersion;
-	  /// <summary>
-	  /// whether the luceneMatchVersion arg is explicitly specified in the serialized schema </summary>
-	  private bool isExplicitLuceneMatchVersion = false;
+	  protected internal readonly Lucene.Net.Util.Version? luceneMatchVersion;
 
-	  /// <summary>
+        /// <summary>
 	  /// Initialize this factory via a set of key-value pairs.
 	  /// </summary>
 	  protected internal AbstractAnalysisFactory(IDictionary<string, string> args)
 	  {
-		originalArgs = Collections.UnmodifiableMap(new Dictionary<>(args));
+	      ExplicitLuceneMatchVersion = false;
+	      originalArgs = Collections.UnmodifiableMap(args);
 		string version = get(args, LUCENE_MATCH_VERSION_PARAM);
-		luceneMatchVersion = version == null ? null : Version.ParseLeniently(version);
+		luceneMatchVersion = version == null ? null : Lucene.Net.Util.Version.ParseLeniently(version);
 		args.Remove(CLASS_NAME); // consume the class arg
 	  }
 
@@ -304,8 +302,6 @@ namespace Lucene.Net.Analysis.Util
 	  /// <summary>
 	  /// Returns the resource's lines (with content treated as UTF-8)
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: protected final java.util.List<String> getLines(ResourceLoader loader, String resource) throws java.io.IOException
 	  protected internal IList<string> getLines(ResourceLoader loader, string resource)
 	  {
 		return WordlistLoader.getLines(loader.openResource(resource), StandardCharsets.UTF_8);
@@ -315,8 +311,6 @@ namespace Lucene.Net.Analysis.Util
 	  /// same as <seealso cref="#getWordSet(ResourceLoader, String, boolean)"/>,
 	  /// except the input is in snowball format. 
 	  /// </summary>
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: protected final CharArraySet getSnowballWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase) throws java.io.IOException
 	  protected internal CharArraySet getSnowballWordSet(ResourceLoader loader, string wordFiles, bool ignoreCase)
 	  {
 		assureMatchVersion();
@@ -389,18 +383,6 @@ namespace Lucene.Net.Analysis.Util
 		  }
 	  }
 
-	  public virtual bool ExplicitLuceneMatchVersion
-	  {
-		  get
-		  {
-			return isExplicitLuceneMatchVersion;
-		  }
-		  set
-		  {
-			this.isExplicitLuceneMatchVersion = value;
-		  }
-	  }
-
+        public virtual bool ExplicitLuceneMatchVersion { get; set; }
 	}
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
index fba8b3a..4e76504 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
@@ -433,16 +433,19 @@ namespace org.apache.lucene.analysis.util
 		throw new System.NotSupportedException();
 	  }
 
-	  public override int size()
-	  {
-		return count;
-	  }
-
-	  public override string ToString()
-	  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final StringBuilder sb = new StringBuilder("{");
-		StringBuilder sb = new StringBuilder("{");
+	    public override int Size
+	    {
+	        get
+	        {
+	            {
+	                return count;
+	            }
+	        }
+	    }
+
+	    public override string ToString()
+	  {
+		var sb = new StringBuilder("{");
 		foreach (KeyValuePair<object, V> entry in entrySet())
 		{
 		  if (sb.Length > 1)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
index 6b8a9db..e6d7cac 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
@@ -148,12 +148,17 @@ namespace Lucene.Net.Analysis.Util
 		return map.put(text, PLACEHOLDER) == null;
 	  }
 
-	  public override int Size()
-	  {
-		return map.size();
-	  }
-
-	  /// <summary>
+        public override int Size
+        {
+            get
+            {
+                {
+                    return map.size();
+                }
+            }
+        }
+
+        /// <summary>
 	  /// Returns an unmodifiable <seealso cref="CharArraySet"/>. This allows to provide
 	  /// unmodifiable views of internal sets for "read-only" use.
 	  /// </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Compatibility/Collections.cs b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
index 9f29bbe..279c20c 100644
--- a/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
+++ b/src/Lucene.Net.Core/Support/Compatibility/Collections.cs
@@ -30,5 +30,12 @@ namespace Lucene.Net
         {
             return ImmutableHashSet.Create<T>(items.ToArray());
         }
+
+        public static IDictionary<T, TS> UnmodifiableMap<T, TS>(IDictionary<T, TS> d)
+        {
+            var builder = ImmutableDictionary.CreateBuilder<T, TS>();
+            builder.AddRange(d);
+            return builder.ToImmutable();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/56bfeaab/src/Lucene.Net.Core/Util/Version.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Version.cs b/src/Lucene.Net.Core/Util/Version.cs
index fd15caa..59abd4f 100644
--- a/src/Lucene.Net.Core/Util/Version.cs
+++ b/src/Lucene.Net.Core/Util/Version.cs
@@ -26,7 +26,7 @@ namespace Lucene.Net.Util
     /// <p><b>WARNING</b>: When changing the version parameter
     /// that you supply to components in Lucene, do not simply
     /// change the version at search-time, but instead also adjust
-    /// your indexing code to match, and re-index.
+    /// your indexing code to match, and re-index.</p>
     /// </summary>
     public enum Version
     {


Mime
View raw message