You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/04/04 17:19:54 UTC
[48/62] [abbrv] [partial] lucenenet git commit: Renamed
Lucene.Net.Core folder Lucene.Net because the dotnet.exe pack command doesn't
allow creating a NuGet package with a different name than its folder. Working
around it with the script was much more co
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenAttributes/PayloadAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenAttributes/PayloadAttribute.cs b/src/Lucene.Net.Core/Analysis/TokenAttributes/PayloadAttribute.cs
deleted file mode 100644
index ccf0f4b..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenAttributes/PayloadAttribute.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-using System;
-
-namespace Lucene.Net.Analysis.TokenAttributes
-{
- /*
- * 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 Attribute = Lucene.Net.Util.Attribute;
- using IAttribute = Lucene.Net.Util.IAttribute;
- using BytesRef = Lucene.Net.Util.BytesRef;
-
- /// <summary>
- /// Default implementation of <see cref="IPayloadAttribute"/>. </summary>
-#if FEATURE_SERIALIZABLE
- [Serializable]
-#endif
- public class PayloadAttribute : Attribute, IPayloadAttribute
- {
- private BytesRef payload;
-
- /// <summary>
- /// Initialize this attribute with no payload.
- /// </summary>
- public PayloadAttribute()
- {
- }
-
- /// <summary>
- /// Initialize this attribute with the given payload.
- /// </summary>
- public PayloadAttribute(BytesRef payload)
- {
- this.payload = payload;
- }
-
- public virtual BytesRef Payload
- {
- get
- {
- return this.payload;
- }
- set
- {
- this.payload = value;
- }
- }
-
- public override void Clear()
- {
- payload = null;
- }
-
- public override object Clone()
- {
- PayloadAttribute clone = (PayloadAttribute)base.Clone();
- if (payload != null)
- {
- clone.payload = (BytesRef)payload.Clone();
- }
- return clone;
- }
-
- public override bool Equals(object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other is PayloadAttribute)
- {
- PayloadAttribute o = (PayloadAttribute)other;
- if (o.payload == null || payload == null)
- {
- return o.payload == null && payload == null;
- }
-
- return o.payload.Equals(payload);
- }
-
- return false;
- }
-
- public override int GetHashCode()
- {
- return (payload == null) ? 0 : payload.GetHashCode();
- }
-
- public override void CopyTo(IAttribute target)
- {
- PayloadAttribute t = (PayloadAttribute)target;
- t.Payload = (payload == null) ? null : (BytesRef)payload.Clone();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionIncrementAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionIncrementAttribute.cs b/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionIncrementAttribute.cs
deleted file mode 100644
index fca2805..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionIncrementAttribute.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-
-namespace Lucene.Net.Analysis.TokenAttributes
-{
- /*
- * 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 Attribute = Lucene.Net.Util.Attribute;
- using IAttribute = Lucene.Net.Util.IAttribute;
-
- /// <summary>
- /// Default implementation of <see cref="IPositionIncrementAttribute"/>. </summary>
-#if FEATURE_SERIALIZABLE
- [Serializable]
-#endif
- public class PositionIncrementAttribute : Attribute, IPositionIncrementAttribute
- {
- private int positionIncrement = 1;
-
- /// <summary>
- /// Initialize this attribute with position increment of 1 </summary>
- public PositionIncrementAttribute()
- {
- }
-
- public virtual int PositionIncrement
- {
- set
- {
- if (value < 0)
- {
- throw new ArgumentException("Increment must be zero or greater: got " + value);
- }
- this.positionIncrement = value;
- }
- get
- {
- return positionIncrement;
- }
- }
-
- public override void Clear()
- {
- this.positionIncrement = 1;
- }
-
- public override bool Equals(object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other is PositionIncrementAttribute)
- {
- PositionIncrementAttribute _other = (PositionIncrementAttribute)other;
- return positionIncrement == _other.positionIncrement;
- }
-
- return false;
- }
-
- public override int GetHashCode()
- {
- return positionIncrement;
- }
-
- public override void CopyTo(IAttribute target)
- {
- PositionIncrementAttribute t = (PositionIncrementAttribute)target;
- t.PositionIncrement = positionIncrement;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionLengthAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionLengthAttribute.cs b/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionLengthAttribute.cs
deleted file mode 100644
index 5f880a9..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenAttributes/PositionLengthAttribute.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-
-namespace Lucene.Net.Analysis.TokenAttributes
-{
- /*
- * 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 Attribute = Lucene.Net.Util.Attribute;
- using IAttribute = Lucene.Net.Util.IAttribute;
-
- /// <summary>
- /// Default implementation of <see cref="IPositionLengthAttribute"/>. </summary>
-#if FEATURE_SERIALIZABLE
- [Serializable]
-#endif
- public class PositionLengthAttribute : Attribute, IPositionLengthAttribute
- {
- private int positionLength = 1;
-
- /// <summary>
- /// Initializes this attribute with position length of 1. </summary>
- public PositionLengthAttribute()
- {
- }
-
- public virtual int PositionLength
- {
- set
- {
- if (value < 1)
- {
- throw new ArgumentException("Position length must be 1 or greater: got " + value);
- }
- this.positionLength = value;
- }
- get
- {
- return positionLength;
- }
- }
-
- public override void Clear()
- {
- this.positionLength = 1;
- }
-
- public override bool Equals(object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other is PositionLengthAttribute)
- {
- PositionLengthAttribute _other = (PositionLengthAttribute)other;
- return positionLength == _other.positionLength;
- }
-
- return false;
- }
-
- public override int GetHashCode()
- {
- return positionLength;
- }
-
- public override void CopyTo(IAttribute target)
- {
- PositionLengthAttribute t = (PositionLengthAttribute)target;
- t.PositionLength = positionLength;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenAttributes/TypeAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenAttributes/TypeAttribute.cs b/src/Lucene.Net.Core/Analysis/TokenAttributes/TypeAttribute.cs
deleted file mode 100644
index 37e5ddb..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenAttributes/TypeAttribute.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using System;
-
-namespace Lucene.Net.Analysis.TokenAttributes
-{
- /*
- * 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 Attribute = Lucene.Net.Util.Attribute;
- using IAttribute = Lucene.Net.Util.IAttribute;
-
- /// <summary>
- /// Default implementation of <see cref="ITypeAttribute"/>. </summary>
-#if FEATURE_SERIALIZABLE
- [Serializable]
-#endif
- public partial class TypeAttribute : Attribute, ITypeAttribute
-#if FEATURE_CLONEABLE
- , ICloneable
-#endif
- {
- private string type;
-
- /// <summary>
- /// Initialize this attribute with <see cref="TypeAttribute.DEFAULT_TYPE"/> </summary>
- public TypeAttribute()
- : this(TypeAttribute.DEFAULT_TYPE)
- {
- }
-
- /// <summary>
- /// Initialize this attribute with <paramref name="type"/> </summary>
- public TypeAttribute(string type)
- {
- this.type = type;
- }
-
- public virtual string Type
- {
- get { return type; }
- set { type = value; }
- }
-
- public override void Clear()
- {
- type = TypeAttribute.DEFAULT_TYPE;
- }
-
- public override bool Equals(object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other is TypeAttribute)
- {
- TypeAttribute o = (TypeAttribute)other;
- return (this.type == null ? o.type == null : this.type.Equals(o.type, StringComparison.Ordinal));
- }
-
- return false;
- }
-
- public override int GetHashCode()
- {
- return (type == null) ? 0 : type.GetHashCode();
- }
-
- public override void CopyTo(IAttribute target)
- {
- TypeAttribute t = (TypeAttribute)target;
- t.type = type;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenFilter.cs b/src/Lucene.Net.Core/Analysis/TokenFilter.cs
deleted file mode 100644
index bd7e0b2..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenFilter.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-namespace Lucene.Net.Analysis
-{
- /*
- * 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>
- /// A <see cref="TokenFilter"/> is a <see cref="TokenStream"/> whose input is another <see cref="TokenStream"/>.
- /// <para/>
- /// This is an abstract class; subclasses must override <see cref="TokenStream.IncrementToken()"/>.
- /// </summary>
- /// <seealso cref="TokenStream"/>
- public abstract class TokenFilter : TokenStream
- {
- /// <summary>
- /// The source of tokens for this filter. </summary>
- protected readonly TokenStream m_input;
-
- /// <summary>
- /// Construct a token stream filtering the given input. </summary>
- protected internal TokenFilter(TokenStream input)
- : base(input)
- {
- this.m_input = input;
- }
-
- /// <summary>
- /// This method is called by the consumer after the last token has been
- /// consumed, after <see cref="IncrementToken()"/> returned <c>false</c>
- /// (using the new <see cref="TokenStream"/> API). Streams implementing the old API
- /// should upgrade to use this feature.
- /// <para/>
- /// This method can be used to perform any end-of-stream operations, such as
- /// setting the final offset of a stream. The final offset of a stream might
- /// differ from the offset of the last token eg in case one or more whitespaces
- /// followed after the last token, but a WhitespaceTokenizer was used.
- /// <para/>
- /// Additionally any skipped positions (such as those removed by a stopfilter)
- /// can be applied to the position increment, or any adjustment of other
- /// attributes where the end-of-stream value may be important.
- /// <para/>
- /// <b>NOTE:</b>
- /// The default implementation chains the call to the input TokenStream, so
- /// be sure to call <c>base.End()</c> first when overriding this method.
- /// </summary>
- /// <exception cref="System.IO.IOException"> If an I/O error occurs </exception>
- public override void End()
- {
- m_input.End();
- }
-
- /// <summary>
- /// Releases resources associated with this stream.
- /// <para/>
- /// If you override this method, always call <c>base.Dispose(disposing)</c>, otherwise
- /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/> will
- /// throw <see cref="System.InvalidOperationException"/> on reuse).
- /// <para/>
- /// <b>NOTE:</b>
- /// The default implementation chains the call to the input TokenStream, so
- /// be sure to call <c>base.Dispose(disposing)</c> when overriding this method.
- /// </summary>
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- m_input.Dispose();
- }
- }
-
- /// <summary>
- /// This method is called by a consumer before it begins consumption using
- /// <see cref="TokenStream.IncrementToken()"/>.
- /// <para/>
- /// Resets this stream to a clean state. Stateful implementations must implement
- /// this method so that they can be reused, just as if they had been created fresh.
- /// <para/>
- /// If you override this method, always call <c>base.Reset()</c>, otherwise
- /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/> will
- /// throw <see cref="System.InvalidOperationException"/> on further usage).
- /// </summary>
- /// <remarks>
- /// <b>NOTE:</b>
- /// The default implementation chains the call to the input <see cref="TokenStream"/>, so
- /// be sure to call <c>base.Reset()</c> when overriding this method.
- /// </remarks>
- public override void Reset()
- {
- m_input.Reset();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenStream.cs b/src/Lucene.Net.Core/Analysis/TokenStream.cs
deleted file mode 100644
index 7cec955..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenStream.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-using Lucene.Net.Analysis.TokenAttributes;
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-namespace Lucene.Net.Analysis
-{
- /*
- * 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 = Lucene.Net.Util.AttributeSource;
-
- /// <summary>
- /// A <see cref="TokenStream"/> enumerates the sequence of tokens, either from
- /// <see cref="Documents.Field"/>s of a <see cref="Documents.Document"/> or from query text.
- /// <para/>
- /// this is an abstract class; concrete subclasses are:
- /// <list type="bullet">
- /// <item><see cref="Tokenizer"/>, a <see cref="TokenStream"/> whose input is a <see cref="System.IO.TextReader"/>; and</item>
- /// <item><see cref="TokenFilter"/>, a <see cref="TokenStream"/> whose input is another
- /// <see cref="TokenStream"/>.</item>
- /// </list>
- /// A new <see cref="TokenStream"/> API has been introduced with Lucene 2.9. this API
- /// has moved from being <see cref="Token"/>-based to <see cref="Util.IAttribute"/>-based. While
- /// <see cref="Token"/> still exists in 2.9 as a convenience class, the preferred way
- /// to store the information of a <see cref="Token"/> is to use <see cref="Attribute"/>s.
- /// <para/>
- /// <see cref="TokenStream"/> now extends <see cref="AttributeSource"/>, which provides
- /// access to all of the token <see cref="Util.IAttribute"/>s for the <see cref="TokenStream"/>.
- /// Note that only one instance per <see cref="Attribute"/> is created and reused
- /// for every token. This approach reduces object creation and allows local
- /// caching of references to the <see cref="Attribute"/>s. See
- /// <see cref="IncrementToken()"/> for further details.
- /// <para/>
- /// <b>The workflow of the new <see cref="TokenStream"/> API is as follows:</b>
- /// <list type="number">
- /// <item>Instantiation of <see cref="TokenStream"/>/<see cref="TokenFilter"/>s which add/get
- /// attributes to/from the <see cref="AttributeSource"/>.</item>
- /// <item>The consumer calls <see cref="TokenStream.Reset()"/>.</item>
- /// <item>The consumer retrieves attributes from the stream and stores local
- /// references to all attributes it wants to access.</item>
- /// <item>The consumer calls <see cref="IncrementToken()"/> until it returns false
- /// consuming the attributes after each call.</item>
- /// <item>The consumer calls <see cref="End()"/> so that any end-of-stream operations
- /// can be performed.</item>
- /// <item>The consumer calls <see cref="Dispose()"/> to release any resource when finished
- /// using the <see cref="TokenStream"/>.</item>
- /// </list>
- /// To make sure that filters and consumers know which attributes are available,
- /// the attributes must be added during instantiation. Filters and consumers are
- /// not required to check for availability of attributes in
- /// <see cref="IncrementToken()"/>.
- /// <para/>
- /// You can find some example code for the new API in the analysis
- /// documentation.
- /// <para/>
- /// Sometimes it is desirable to capture a current state of a <see cref="TokenStream"/>,
- /// e.g., for buffering purposes (see <see cref="CachingTokenFilter"/>,
- /// TeeSinkTokenFilter). For this usecase
- /// <see cref="AttributeSource.CaptureState"/> and <see cref="AttributeSource.RestoreState"/>
- /// can be used.
- /// <para/>The <see cref="TokenStream"/>-API in Lucene is based on the decorator pattern.
- /// Therefore all non-abstract subclasses must be sealed or have at least a sealed
- /// implementation of <see cref="IncrementToken()"/>! This is checked when assertions are enabled.
- /// </summary>
- public abstract class TokenStream : AttributeSource, IDisposable
- {
- /// <summary>
- /// A <see cref="TokenStream"/> using the default attribute factory.
- /// </summary>
- protected TokenStream()
- {
- AssertFinal();
- }
-
- /// <summary>
- /// A <see cref="TokenStream"/> that uses the same attributes as the supplied one.
- /// </summary>
- protected TokenStream(AttributeSource input)
- : base(input)
- {
- AssertFinal();
- }
-
- /// <summary>
- /// A <see cref="TokenStream"/> using the supplied <see cref="AttributeSource.AttributeFactory"/>
- /// for creating new <see cref="Util.IAttribute"/> instances.
- /// </summary>
- protected TokenStream(AttributeFactory factory)
- : base(factory)
- {
- AssertFinal();
- }
-
- private bool AssertFinal()
- {
- var type = this.GetType();
-
- //if (!type.desiredAssertionStatus()) return true; // not supported in .NET
-
- var hasCompilerGeneratedAttribute =
- type.GetTypeInfo().GetCustomAttributes(typeof (CompilerGeneratedAttribute), false).Any();
- var isAnonymousType = hasCompilerGeneratedAttribute && type.FullName.Contains("AnonymousType");
-
- var method = type.GetMethod("IncrementToken", BindingFlags.Public | BindingFlags.Instance);
-
- if (!(isAnonymousType || type.GetTypeInfo().IsSealed || (method != null && method.IsFinal)))
- {
- // Original Java code throws an AssertException via Java's assert, we can't do this here
- throw new InvalidOperationException("TokenStream implementation classes or at least their IncrementToken() implementation must be marked sealed");
- }
-
- // type.GetMethod returns null if the method doesn't exist.
- // To emulate Lucene (which catches a NoSuchMethodException),
- // we need to return false in that case.
- return method != null;
- }
-
- /// <summary>
- /// Consumers (i.e., <see cref="Index.IndexWriter"/>) use this method to advance the stream to
- /// the next token. Implementing classes must implement this method and update
- /// the appropriate <see cref="Lucene.Net.Util.IAttribute"/>s with the attributes of the next
- /// token.
- /// <para/>
- /// The producer must make no assumptions about the attributes after the method
- /// has been returned: the caller may arbitrarily change it. If the producer
- /// needs to preserve the state for subsequent calls, it can use
- /// <see cref="AttributeSource.CaptureState"/> to create a copy of the current attribute state.
- /// <para/>
- /// this method is called for every token of a document, so an efficient
- /// implementation is crucial for good performance. To avoid calls to
- /// <see cref="AttributeSource.AddAttribute{T}"/> and <see cref="AttributeSource.GetAttribute{T}"/>,
- /// references to all <see cref="Lucene.Net.Util.IAttribute"/>s that this stream uses should be
- /// retrieved during instantiation.
- /// <para/>
- /// To ensure that filters and consumers know which attributes are available,
- /// the attributes must be added during instantiation. Filters and consumers
- /// are not required to check for availability of attributes in
- /// <see cref="IncrementToken()"/>.
- /// </summary>
- /// <returns> false for end of stream; true otherwise </returns>
- public abstract bool IncrementToken();
-
- /// <summary>
- /// This method is called by the consumer after the last token has been
- /// consumed, after <see cref="IncrementToken()"/> returned <c>false</c>
- /// (using the new <see cref="TokenStream"/> API). Streams implementing the old API
- /// should upgrade to use this feature.
- /// <para/>
- /// This method can be used to perform any end-of-stream operations, such as
- /// setting the final offset of a stream. The final offset of a stream might
- /// differ from the offset of the last token eg in case one or more whitespaces
- /// followed after the last token, but a WhitespaceTokenizer was used.
- /// <para/>
- /// Additionally any skipped positions (such as those removed by a stopfilter)
- /// can be applied to the position increment, or any adjustment of other
- /// attributes where the end-of-stream value may be important.
- /// <para/>
- /// If you override this method, always call <c>base.End();</c>.
- /// </summary>
- /// <exception cref="System.IO.IOException"> If an I/O error occurs </exception>
- public virtual void End()
- {
- ClearAttributes(); // LUCENE-3849: don't consume dirty atts
-
- if (HasAttribute<IPositionIncrementAttribute>())
- {
- var attr = GetAttribute<IPositionIncrementAttribute>();
- attr.PositionIncrement = 0;
- }
- }
-
- /// <summary>
- /// This method is called by a consumer before it begins consumption using
- /// <see cref="IncrementToken()"/>.
- /// <para/>
- /// Resets this stream to a clean state. Stateful implementations must implement
- /// this method so that they can be reused, just as if they had been created fresh.
- /// <para/>
- /// If you override this method, always call <c>base.Reset()</c>, otherwise
- /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/> will
- /// throw <see cref="InvalidOperationException"/> on further usage).
- /// </summary>
- public virtual void Reset()
- {
- }
-
- // LUCENENET specific - implementing proper dispose pattern
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// Releases resources associated with this stream.
- /// <para/>
- /// If you override this method, always call <c>base.Dispose(disposing)</c>, otherwise
- /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/> will
- /// throw <see cref="InvalidOperationException"/> on reuse).
- /// </summary>
- protected virtual void Dispose(bool disposing)
- {
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/TokenStreamToAutomaton.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/TokenStreamToAutomaton.cs b/src/Lucene.Net.Core/Analysis/TokenStreamToAutomaton.cs
deleted file mode 100644
index f2fb739..0000000
--- a/src/Lucene.Net.Core/Analysis/TokenStreamToAutomaton.cs
+++ /dev/null
@@ -1,343 +0,0 @@
-using Lucene.Net.Analysis.TokenAttributes;
-using Lucene.Net.Support;
-using Lucene.Net.Util;
-using System;
-using System.Diagnostics;
-
-namespace Lucene.Net.Analysis
-{
- /*
- * 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 Automaton = Lucene.Net.Util.Automaton.Automaton;
- using State = Lucene.Net.Util.Automaton.State;
- using Transition = Lucene.Net.Util.Automaton.Transition;
-
- // TODO: maybe also toFST? then we can translate atts into FST outputs/weights
-
- /// <summary>
- /// Consumes a <see cref="TokenStream"/> and creates an <see cref="Automaton"/>
- /// where the transition labels are UTF8 bytes (or Unicode
- /// code points if unicodeArcs is true) from the <see cref="ITermToBytesRefAttribute"/>.
- /// Between tokens we insert
- /// <see cref="POS_SEP"/> and for holes we insert <see cref="HOLE"/>.
- ///
- /// @lucene.experimental
- /// </summary>
- public class TokenStreamToAutomaton
- {
- //backing variables
- private bool preservePositionIncrements;
-
- private bool unicodeArcs;
-
- /// <summary>
- /// Sole constructor. </summary>
- public TokenStreamToAutomaton()
- {
- this.preservePositionIncrements = true;
- }
-
- /// <summary>
- /// Whether to generate holes in the automaton for missing positions, <c>true</c> by default. </summary>
- public virtual bool PreservePositionIncrements
- {
- get
- {
- return this.preservePositionIncrements; // LUCENENET specific - properties should always have a getter
- }
- set
- {
- this.preservePositionIncrements = value;
- }
- }
-
- /// <summary>
- /// Whether to make transition labels Unicode code points instead of UTF8 bytes,
- /// <c>false</c> by default
- /// </summary>
- public virtual bool UnicodeArcs
- {
- get
- {
- return this.unicodeArcs; // LUCENENET specific - properties should always have a getter
- }
- set
- {
- this.unicodeArcs = value;
- }
- }
-
- private class Position : RollingBuffer.IResettable
- {
- // Any tokens that ended at our position arrive to this state:
- internal State arriving;
-
- // Any tokens that start at our position leave from this state:
- internal State leaving;
-
- public void Reset()
- {
- arriving = null;
- leaving = null;
- }
- }
-
- private class Positions : RollingBuffer<Position>
- {
- public Positions()
- : base(NewPosition) { }
-
- protected override Position NewInstance()
- {
- return NewPosition();
- }
-
- private static Position NewPosition()
- {
- return new Position();
- }
- }
-
- /// <summary>
- /// Subclass & implement this if you need to change the
- /// token (such as escaping certain bytes) before it's
- /// turned into a graph.
- /// </summary>
- protected internal virtual BytesRef ChangeToken(BytesRef @in)
- {
- return @in;
- }
-
- /// <summary>
- /// We create transition between two adjacent tokens. </summary>
- public const int POS_SEP = 0x001f;
-
- /// <summary>
- /// We add this arc to represent a hole. </summary>
- public const int HOLE = 0x001e;
-
- /// <summary>
- /// Pulls the graph (including <see cref="IPositionLengthAttribute"/>
- /// from the provided <see cref="TokenStream"/>, and creates the corresponding
- /// automaton where arcs are bytes (or Unicode code points
- /// if unicodeArcs = true) from each term.
- /// </summary>
- public virtual Automaton ToAutomaton(TokenStream @in)
- {
- var a = new Automaton();
- bool deterministic = true;
-
- var posIncAtt = @in.AddAttribute<IPositionIncrementAttribute>();
- var posLengthAtt = @in.AddAttribute<IPositionLengthAttribute>();
- var offsetAtt = @in.AddAttribute<IOffsetAttribute>();
- var termBytesAtt = @in.AddAttribute<ITermToBytesRefAttribute>();
-
- BytesRef term = termBytesAtt.BytesRef;
-
- @in.Reset();
-
- // Only temporarily holds states ahead of our current
- // position:
-
- RollingBuffer<Position> positions = new Positions();
-
- int pos = -1;
- Position posData = null;
- int maxOffset = 0;
- while (@in.IncrementToken())
- {
- int posInc = posIncAtt.PositionIncrement;
- if (!preservePositionIncrements && posInc > 1)
- {
- posInc = 1;
- }
- Debug.Assert(pos > -1 || posInc > 0);
-
- if (posInc > 0)
- {
- // New node:
- pos += posInc;
-
- posData = positions.Get(pos);
- Debug.Assert(posData.leaving == null);
-
- if (posData.arriving == null)
- {
- // No token ever arrived to this position
- if (pos == 0)
- {
- // OK: this is the first token
- posData.leaving = a.GetInitialState();
- }
- else
- {
- // this means there's a hole (eg, StopFilter
- // does this):
- posData.leaving = new State();
- AddHoles(a.GetInitialState(), positions, pos);
- }
- }
- else
- {
- posData.leaving = new State();
- posData.arriving.AddTransition(new Transition(POS_SEP, posData.leaving));
- if (posInc > 1)
- {
- // A token spanned over a hole; add holes
- // "under" it:
- AddHoles(a.GetInitialState(), positions, pos);
- }
- }
- positions.FreeBefore(pos);
- }
- else
- {
- // note: this isn't necessarily true. its just that we aren't surely det.
- // we could optimize this further (e.g. buffer and sort synonyms at a position)
- // but thats probably overkill. this is cheap and dirty
- deterministic = false;
- }
-
- int endPos = pos + posLengthAtt.PositionLength;
-
- termBytesAtt.FillBytesRef();
- BytesRef termUTF8 = ChangeToken(term);
- int[] termUnicode = null;
- Position endPosData = positions.Get(endPos);
- if (endPosData.arriving == null)
- {
- endPosData.arriving = new State();
- }
-
- State state = posData.leaving;
- int termLen = termUTF8.Length;
- if (unicodeArcs)
- {
- string utf16 = termUTF8.Utf8ToString();
- termUnicode = new int[utf16.CodePointCount(0, utf16.Length)];
- termLen = termUnicode.Length;
- for (int cp, i = 0, j = 0; i < utf16.Length; i += Character.CharCount(cp))
- {
- termUnicode[j++] = cp = Character.CodePointAt(utf16, i);
- }
- }
- else
- {
- termLen = termUTF8.Length;
- }
-
- for (int byteIDX = 0; byteIDX < termLen; byteIDX++)
- {
- State nextState = byteIDX == termLen - 1 ? endPosData.arriving : new State();
- int c;
- if (unicodeArcs)
- {
- c = termUnicode[byteIDX];
- }
- else
- {
- c = termUTF8.Bytes[termUTF8.Offset + byteIDX] & 0xff;
- }
- state.AddTransition(new Transition(c, nextState));
- state = nextState;
- }
-
- maxOffset = Math.Max(maxOffset, offsetAtt.EndOffset);
- }
-
- @in.End();
- State endState = null;
- if (offsetAtt.EndOffset > maxOffset)
- {
- endState = new State();
- endState.Accept = true;
- }
-
- pos++;
- while (pos <= positions.MaxPos)
- {
- posData = positions.Get(pos);
- if (posData.arriving != null)
- {
- if (endState != null)
- {
- posData.arriving.AddTransition(new Transition(POS_SEP, endState));
- }
- else
- {
- posData.arriving.Accept = true;
- }
- }
- pos++;
- }
-
- //toDot(a);
- a.IsDeterministic = deterministic;
- return a;
- }
-
- // for debugging!
- /*
- private static void toDot(Automaton a) throws IOException {
- final String s = a.toDot();
- Writer w = new OutputStreamWriter(new FileOutputStream("/tmp/out.dot"));
- w.write(s);
- w.Dispose();
- System.out.println("TEST: saved to /tmp/out.dot");
- }
- */
-
- private static void AddHoles(State startState, RollingBuffer<Position> positions, int pos)
- {
- Position posData = positions.Get(pos);
- Position prevPosData = positions.Get(pos - 1);
-
- while (posData.arriving == null || prevPosData.leaving == null)
- {
- if (posData.arriving == null)
- {
- posData.arriving = new State();
- posData.arriving.AddTransition(new Transition(POS_SEP, posData.leaving));
- }
- if (prevPosData.leaving == null)
- {
- if (pos == 1)
- {
- prevPosData.leaving = startState;
- }
- else
- {
- prevPosData.leaving = new State();
- }
- if (prevPosData.arriving != null)
- {
- prevPosData.arriving.AddTransition(new Transition(POS_SEP, prevPosData.leaving));
- }
- }
- prevPosData.leaving.AddTransition(new Transition(HOLE, posData.arriving));
- pos--;
- if (pos <= 0)
- {
- break;
- }
- posData = prevPosData;
- prevPosData = positions.Get(pos - 1);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Analysis/Tokenizer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Analysis/Tokenizer.cs b/src/Lucene.Net.Core/Analysis/Tokenizer.cs
deleted file mode 100644
index 0d2bd8c..0000000
--- a/src/Lucene.Net.Core/Analysis/Tokenizer.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-
-namespace Lucene.Net.Analysis
-{
- /*
- * 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>
- /// A <see cref="Tokenizer"/> is a <see cref="TokenStream"/> whose input is a <see cref="TextReader"/>.
- /// <para/>
- /// This is an abstract class; subclasses must override <seealso cref="#IncrementToken()"/>
- /// <para/>
- /// NOTE: Subclasses overriding <see cref="TokenStream.IncrementToken()"/> must
- /// call <see cref="Util.AttributeSource.ClearAttributes()"/> before
- /// setting attributes.
- /// </summary>
- public abstract class Tokenizer : TokenStream
- {
- /// <summary>
- /// The text source for this <see cref="Tokenizer"/>. </summary>
- protected TextReader m_input = ILLEGAL_STATE_READER;
-
- /// <summary>
- /// Pending reader: not actually assigned to input until <see cref="Reset()"/> </summary>
- private TextReader inputPending = ILLEGAL_STATE_READER;
-
- /// <summary>
- /// Construct a token stream processing the given input. </summary>
- protected internal Tokenizer(TextReader input)
- {
- if (input == null)
- {
- throw new System.ArgumentNullException("input", "input must not be null");
- }
- this.inputPending = input;
- }
-
- /// <summary>
- /// Construct a token stream processing the given input using the given <see cref="Util.AttributeSource.AttributeFactory"/>.
- /// </summary>
- protected internal Tokenizer(AttributeFactory factory, TextReader input)
- : base(factory)
- {
- if (input == null)
- {
- throw new System.ArgumentNullException("input", "input must not be null");
- }
- this.inputPending = input;
- }
-
- /// <summary>
- /// Releases resources associated with this stream.
- /// <para/>
- /// If you override this method, always call <c>base.Dispose(disposing)</c>, otherwise
- /// some internal state will not be correctly reset (e.g., <see cref="Tokenizer"/> will
- /// throw <see cref="InvalidOperationException"/> on reuse).
- /// </summary>
- /// <remarks>
- /// <b>NOTE:</b>
- /// The default implementation closes the input <see cref="TextReader"/>, so
- /// be sure to call <c>base.Dispose(disposing)</c> when overriding this method.
- /// </remarks>
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- m_input.Dispose();
- // LUCENE-2387: don't hold onto TextReader after close, so
- // GC can reclaim
- inputPending = ILLEGAL_STATE_READER;
- m_input = ILLEGAL_STATE_READER;
- }
- }
-
- /// <summary>
- /// Return the corrected offset. If <see cref="m_input"/> is a <see cref="CharFilter"/> subclass
- /// this method calls <see cref="CharFilter.CorrectOffset"/>, else returns <paramref name="currentOff"/>. </summary>
- /// <param name="currentOff"> offset as seen in the output </param>
- /// <returns> corrected offset based on the input </returns>
- /// <seealso cref="CharFilter.CorrectOffset(int)"/>
- protected internal int CorrectOffset(int currentOff)
- {
- return (m_input is CharFilter) ? ((CharFilter)m_input).CorrectOffset(currentOff) : currentOff;
- }
-
- /// <summary>
- /// Expert: Set a new reader on the <see cref="Tokenizer"/>. Typically, an
- /// analyzer (in its tokenStream method) will use
- /// this to re-use a previously created tokenizer.
- /// </summary>
- public void SetReader(TextReader input)
- {
- if (input == null)
- {
- throw new System.ArgumentNullException("value", "input must not be null");
- }
- else if (this.m_input != ILLEGAL_STATE_READER)
- {
- throw new InvalidOperationException("TokenStream contract violation: Close() call missing");
- }
- this.inputPending = input;
- Debug.Assert(SetReaderTestPoint());
- }
-
- public override void Reset()
- {
- base.Reset();
- m_input = inputPending;
- inputPending = ILLEGAL_STATE_READER;
- }
-
- // only used by assert, for testing
- internal virtual bool SetReaderTestPoint()
- {
- return true;
- }
-
- private static readonly TextReader ILLEGAL_STATE_READER = new ReaderAnonymousInnerClassHelper();
-
- private class ReaderAnonymousInnerClassHelper : TextReader
- {
- public override int Read(char[] cbuf, int off, int len)
- {
- throw new InvalidOperationException("TokenStream contract violation: Reset()/Dispose() call missing, "
- + "Reset() called multiple times, or subclass does not call base.Reset(). "
- + "Please see Javadocs of TokenStream class for more information about the correct consuming workflow.");
- }
-
- protected override void Dispose(bool disposing)
- {
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/ChangeNotes.txt
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/ChangeNotes.txt b/src/Lucene.Net.Core/ChangeNotes.txt
deleted file mode 100644
index c61ef98..0000000
--- a/src/Lucene.Net.Core/ChangeNotes.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-\ufeffSome fairly large changes happened between Lucene 2.x and 3.x, particularly the addition of Generics and Enum types to Java.
-Due to some of the major differences between C#'s generics and Java's generics, there are some areas of lucene that differ
-greatly in design.
-
-The AttributeFactory in AttributeSource is a good example of this. Java has the Class<E> type, which would
-be .NET's Type<T>, if it existed. Since .NET doesn't have a generic type, the compile time checking Java has for attributes
-(being constrained to typeof(Attribute)) had to be done in a different way. The factory methods for AddAttribute and GetAttribute
-now take no parameters, and instead use generic type arguments (AddAttribute<TypeAttribute>(); instead of
-AddAttribute(typeof(TypeAttribute));) this change should be documented.
-
-Another example is in Enum types. Lucene has converted its Enum types from Util.Parameter classes into proper Enums. this
-is good improvement, since they are more lightweight and performant than a class. However, Java's enums are closer to classes than
-in .NET. The enumerations in Field (ie, Field.Index) have methods that help to determine the properties of that field.
-Right now, they are put in a static class as extension methods. That allows us to use methods like IsStored(), WithOffsets(),
-WithPositions(), etc on the actual enum type without having to use a static class, but since the extension methods can only be used
-on instances of the type, the functions that create the enums, ie ToIndex(), ToTermVector(), are static methods on a static
-class.
-
-Also, more unit tests fail intermittantly in Release mode. We notice this mostly with TestIndexWriter.TestExceptionsDuringCommit, but
-now we're seeing it on a others as well (I think one in Store and others). It has to do with the file system, we'll get
-AccessViolationExceptions, and seem to be caused by the pure speed that we're trying to access the file. I think we're trying to
-access the file after it's been written, but before the kernel has finished writing to the file, since its buffered like that.
-It passes if you run in release with the debugger attached. I can also get them to pass if I run them in release where they would
-normally fail, but with Process Monitor on in the background, monitoring the file requests. - cc
-
-TODO: Confirm HashMap emulates java properly
-TODO: Tests need to be written for WeakDictionary
-TODO: Comments need to be written for WeakDictionary
-TODO: Tests need to be written for IdentityDictionary -> Verify behavior
-
-
-PriorityQueue in InsertWithOverflow, java returns null, I set it to return default(T). I don't think it's an issue. We should, at least, document
- that is may have unexpected results if used with a non-nullable type.
-
-BooleanClause.java - Can't override ToString on Enum or replace with Extension Method. Leave type-safe, override with extension method, or create static class?
-
-ParallelReader - extra data types, using SortedDictionary in place of TreeMap. Confirm compatibility. Looks okay, .NET uses a r/b tree just like Java, and it
- seems to perform/behave just about the same.
-
-FieldValueHitQueue.Entry had to be made public for accessibility.
-
-FieldCacheRangeFilter & (NumericRangeFilter/Query) - Expects nullable primitives for the anonymous range filters<T> -> replaced with Nullable<T>
- -> Could FieldCacheRangeFilter and NumericRangeFilter/Query be converted to use normal primitives, and define no lower/upper bounds as being
- Type.MaxValue instead of null?
-
-FuzzyQuery - uses java.util.PriorityQueue<T>, which .net does not have. Using SortedList<TKey, TVal> in it's place, which works, but a) isn't a perfect replacement
- (a SortedList<TKey, TVal> doesn't allow duplicate keys, which is what is sorted, where a PriorityQueue does) and b) it's likely slower than a PriorityQueue<T>
- I can't tell if the PriorityQueue that is defined in Lucene.Net.Util would work in its place.
-
-Java LinkedList behavior compared to C#. Used extensively in Attributes, filters and the like
-
-SegmentInfos inherits from java.util.Vector which is threadsafe. Closest equiv is SynchronizedCollection<T>, which is in System.ServiceModel.dll
- so, we'd have a dependency on that DLL for the one collection, which I'm not sure is worth it. We could probably synchronize it a different way.
-
-ThreadInterruptedException.java was not ported, because it only exists in the java because the built-in one is a checked exception
- -> Anywhere in .NET code that catches a ThreadInterruptedException and re-throws it, should just be removed, as it's redundant.
- -> Example places include (FSDirectory, ConcurrentMergeScheduler,
-
-Dispose needs to be implemented properly around the entire library. IMO, that means that Close should be Obsoleted and the code in Close() moved to Dispose().
-
-Constants.cs - LUCENE_MAIN_VERSION, and static constructor differs quite a bit from Java. It may be that way by design, I'm guessing differences in how
- java packages work versus .NET. Either way, the tests for versioning passes, so it's probably not an issue?
-
-ParallelMultiSearcher -> Successfully ported, but in Java the threads are named, in .NET, I ported it without named threads
- (also without NamedThreadFactory from java's util)
-
-FieldSelectorResult -> uses kludgy workaround due to Enums not being able to be null. It's only used in the MapFieldSelector class, when
- deciding to include a field or not.
-
-ConcurrentMergeScheduler/IndexWriter -> Tries to assert the current thread holds a lock. this isn't possible in .NET
-
-SegmentInfos.cs -> 3 places need to return a readonly HashMap.
-
-
-There are a good amount of methods that have been changed from protected internal to public, seemingly for use with NUnit. I've added Lucene.Net.Test
-as a friend assembly that can access internals. We can change these accessibility modifiers back to how they are in java, and still have it be testable.
-We can also get rid of the properties and such that are "fields_forNUnit" or like it. It just doesn't look good.
-
-TODO: NamedThreadFactory.java - Is this needed? What is it for, just for debugging?
-TODO: DummyConcurrentLock.java - Not Needed?
-
-TODO: LockStressTest.java - Not yet ported.
-TODO: MMapDirectory.java - Port Issues
-TODO: NIOFSDirectory.java - Port Issues
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/BlockTermState.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTermState.cs b/src/Lucene.Net.Core/Codecs/BlockTermState.cs
deleted file mode 100644
index acd8723..0000000
--- a/src/Lucene.Net.Core/Codecs/BlockTermState.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System.Diagnostics;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * 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 DocsEnum = Lucene.Net.Index.DocsEnum; // javadocs
- using OrdTermState = Lucene.Net.Index.OrdTermState;
- using TermState = Lucene.Net.Index.TermState;
-
- /// <summary>
- /// Holds all state required for <seealso cref="PostingsReaderBase"/>
- /// to produce a <seealso cref="DocsEnum"/> without re-seeking the
- /// terms dict.
- /// </summary>
- public class BlockTermState : OrdTermState
- {
- /// <summary>
- /// how many docs have this term </summary>
- public int DocFreq { get; set; }
-
- /// <summary>
- /// total number of occurrences of this term </summary>
- public long TotalTermFreq { get; set; }
-
- /// <summary>
- /// the term's ord in the current block </summary>
- public int TermBlockOrd { get; set; }
-
- /// <summary>
- /// fp into the terms dict primary file (_X.tim) that holds this term </summary>
- // TODO: update BTR to nuke this
- public long BlockFilePointer { get; set; }
-
- /// <summary>
- /// Sole constructor. (For invocation by subclass
- /// constructors, typically implicit.)
- /// </summary>
- protected internal BlockTermState()
- {
- }
-
- public override void CopyFrom(TermState other)
- {
- Debug.Assert(other is BlockTermState, "can not copy from " + other.GetType().Name);
- BlockTermState other2 = (BlockTermState)other;
- base.CopyFrom(other);
- DocFreq = other2.DocFreq;
- TotalTermFreq = other2.TotalTermFreq;
- TermBlockOrd = other2.TermBlockOrd;
- BlockFilePointer = other2.BlockFilePointer;
- }
-
- public override string ToString()
- {
- return "docFreq=" + DocFreq + " totalTermFreq=" + TotalTermFreq + " termBlockOrd=" + TermBlockOrd + " blockFP=" + BlockFilePointer;
- }
- }
-}
\ No newline at end of file