You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2013/09/24 20:33:02 UTC
[26/50] [abbrv] IT NOW BUILDS!~!!!
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanNearPayloadCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanNearPayloadCheckQuery.cs b/src/core/Search/Spans/SpanNearPayloadCheckQuery.cs
index f6224e3..020ffa2 100644
--- a/src/core/Search/Spans/SpanNearPayloadCheckQuery.cs
+++ b/src/core/Search/Spans/SpanNearPayloadCheckQuery.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Text;
using Lucene.Net.Support;
using Lucene.Net.Util;
+using System;
namespace Lucene.Net.Search.Spans
{
@@ -50,11 +51,11 @@ namespace Lucene.Net.Search.Spans
{
var buffer = new StringBuilder();
buffer.Append("spanPayCheck(");
- buffer.Append(match.toString(field));
+ buffer.Append(match.ToString(field));
buffer.Append(", payloadRef: ");
foreach (var bytes in payloadToMatch)
{
- ToStringUtils.ByteArray(buffer, bytes);
+ ToStringUtils.ByteArray(buffer, (sbyte[])(Array)bytes);
buffer.Append(';');
}
buffer.Append(")");
@@ -64,7 +65,7 @@ namespace Lucene.Net.Search.Spans
public override object Clone()
{
- var result = new SpanNearPayloadCheckQuery((SpanNearQuery) match.clone(), payloadToMatch);
+ var result = new SpanNearPayloadCheckQuery((SpanNearQuery) match.Clone(), payloadToMatch);
result.Boost = Boost;
return result;
}
@@ -76,13 +77,13 @@ namespace Lucene.Net.Search.Spans
var other = (SpanNearPayloadCheckQuery) o;
return this.payloadToMatch.Equals(other.payloadToMatch)
- && this.match.equals(other.match)
+ && this.match.Equals(other.match)
&& this.Boost == other.Boost;
}
public override int GetHashCode()
{
- int h = match.hashCode();
+ int h = match.GetHashCode();
h ^= (h << 8) | Support.Number.URShift(h, 25); // reversible
//TODO: is this right?
h ^= payloadToMatch.GetHashCode();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanNearQuery.cs b/src/core/Search/Spans/SpanNearQuery.cs
index b945f29..1aa8ca8 100644
--- a/src/core/Search/Spans/SpanNearQuery.cs
+++ b/src/core/Search/Spans/SpanNearQuery.cs
@@ -139,7 +139,7 @@ namespace Lucene.Net.Search.Spans
// optimize 1-clause case
return clauses[0].GetSpans(context, acceptDocs, termContexts);
- return inOrder ? (SpansBase)new NearSpansOrdered(this, context, collectPayloads) : (SpansBase)new NearSpansUnordered(this, context);
+ return inOrder ? (SpansBase)new NearSpansOrdered(this, context, acceptDocs, termContexts, collectPayloads) : (SpansBase)new NearSpansUnordered(this, context, acceptDocs, termContexts);
}
public override Query Rewrite(IndexReader reader)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanPositionCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanPositionCheckQuery.cs b/src/core/Search/Spans/SpanPositionCheckQuery.cs
index b24c9ef..bf55a94 100644
--- a/src/core/Search/Spans/SpanPositionCheckQuery.cs
+++ b/src/core/Search/Spans/SpanPositionCheckQuery.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Search.Spans
public override SpansBase GetSpans(AtomicReaderContext context, IBits acceptDocs, IDictionary<Term, TermContext> termContexts)
{
- return new PositionCheckSpan(context, acceptDocs, termContexts);
+ return new PositionCheckSpan(context, acceptDocs, termContexts, this);
}
public override Query Rewrite(IndexReader reader)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanScorer.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanScorer.cs b/src/core/Search/Spans/SpanScorer.cs
index 2657542..0c7a730 100644
--- a/src/core/Search/Spans/SpanScorer.cs
+++ b/src/core/Search/Spans/SpanScorer.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search.Spans
public override long Cost
{
- get { return spans.Cost(); }
+ get { return spans.Cost; }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanTermQuery.cs b/src/core/Search/Spans/SpanTermQuery.cs
index 0c6fd7f..c3db355 100644
--- a/src/core/Search/Spans/SpanTermQuery.cs
+++ b/src/core/Search/Spans/SpanTermQuery.cs
@@ -30,38 +30,38 @@ namespace Lucene.Net.Search.Spans
[Serializable]
public class SpanTermQuery : SpanQuery
{
- protected Term internalTerm;
+ protected Term term;
/// <summary>Construct a SpanTermQuery matching the named term's spans. </summary>
public SpanTermQuery(Term term)
{
- this.internalTerm = term;
+ this.term = term;
}
/// <summary>Return the term whose spans are matched. </summary>
public virtual Term Term
{
- get { return internalTerm; }
+ get { return term; }
}
public override string Field
{
- get { return internalTerm.Field; }
+ get { return term.Field; }
}
public override void ExtractTerms(ISet<Term> terms)
{
- terms.Add(internalTerm);
+ terms.Add(term);
}
public override string ToString(string field)
{
var buffer = new StringBuilder();
- if (internalTerm.Field.Equals(field))
- buffer.Append(internalTerm.Text);
+ if (term.Field.Equals(field))
+ buffer.Append(term.Text);
else
{
- buffer.Append(internalTerm.ToString());
+ buffer.Append(term.ToString());
}
buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/SpanWeight.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/SpanWeight.cs b/src/core/Search/Spans/SpanWeight.cs
index c4c693b..9506a94 100644
--- a/src/core/Search/Spans/SpanWeight.cs
+++ b/src/core/Search/Spans/SpanWeight.cs
@@ -96,7 +96,7 @@ namespace Lucene.Net.Search.Spans
public override Explanation Explain(AtomicReaderContext context, int doc)
{
- var scorer = (SpanScorer)Scorer(context, true, false, context.Reader.LiveDocs);
+ var scorer = (SpanScorer)Scorer(context, true, false, context.AtomicReader.LiveDocs);
if (scorer != null)
{
var newDoc = scorer.Advance(doc);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/Spans/TermSpans.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/Spans/TermSpans.cs b/src/core/Search/Spans/TermSpans.cs
index fddd161..367907f 100644
--- a/src/core/Search/Spans/TermSpans.cs
+++ b/src/core/Search/Spans/TermSpans.cs
@@ -184,8 +184,8 @@ namespace Lucene.Net.Search.Spans
{
get { return 0; }
}
-
- private static readonly TermSpans EMPTY_TERM_SPANS = new EmptyTermSpans();
}
+
+ public static readonly TermSpans EMPTY_TERM_SPANS = new EmptyTermSpans();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/TermQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/TermQuery.cs b/src/core/Search/TermQuery.cs
index 553beb8..969b355 100644
--- a/src/core/Search/TermQuery.cs
+++ b/src/core/Search/TermQuery.cs
@@ -101,7 +101,7 @@ namespace Lucene.Net.Search
// assert termNotInReader(context.reader(), term) : "no termstate found but term exists in reader term=" + term;
return null;
}
- var termsEnum = context.Reader.Terms(parent.term.Field).Iterator(null);
+ var termsEnum = context.AtomicReader.Terms(parent.term.Field).Iterator(null);
termsEnum.SeekExact(parent.term.Bytes, state);
return termsEnum;
}
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search
public override Explanation Explain(AtomicReaderContext context, int doc)
{
- var scorer = Scorer(context, true, false, context.Reader.LiveDocs);
+ var scorer = Scorer(context, true, false, context.AtomicReader.LiveDocs);
if (scorer != null)
{
int newDoc = scorer.Advance(doc);
@@ -163,7 +163,7 @@ namespace Lucene.Net.Search
{
var context = searcher.TopReaderContext;
TermContext termState;
- if (perReaderTermState == null || perReaderTermState.TopReaderContext != context)
+ if (perReaderTermState == null || perReaderTermState.topReaderContext != context)
{
// make TermQuery single-pass if we don't have a PRTS or if the context differs!
termState = TermContext.Build(context, term, true); // cache term lookups!
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/TermRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/TermRangeFilter.cs b/src/core/Search/TermRangeFilter.cs
index 61f3cc3..8ecc938 100644
--- a/src/core/Search/TermRangeFilter.cs
+++ b/src/core/Search/TermRangeFilter.cs
@@ -81,13 +81,13 @@ namespace Lucene.Net.Search
}
/// <summary>Returns the lower value of this range filter </summary>
- public virtual string LowerTerm
+ public virtual BytesRef LowerTerm
{
get { return query.LowerTerm; }
}
/// <summary>Returns the upper value of this range filter </summary>
- public virtual string UpperTerm
+ public virtual BytesRef UpperTerm
{
get { return query.UpperTerm; }
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/TermRangeQuery.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/TermRangeQuery.cs b/src/core/Search/TermRangeQuery.cs
index ed5824e..9203d8e 100644
--- a/src/core/Search/TermRangeQuery.cs
+++ b/src/core/Search/TermRangeQuery.cs
@@ -40,8 +40,8 @@ namespace Lucene.Net.Search
[Serializable]
public class TermRangeQuery : MultiTermQuery
{
- private string lowerTerm;
- private string upperTerm;
+ private BytesRef lowerTerm;
+ private BytesRef upperTerm;
private bool includeLower;
private bool includeUpper;
@@ -85,13 +85,13 @@ namespace Lucene.Net.Search
}
/// <summary>Returns the lower value of this range query </summary>
- public virtual string LowerTerm
+ public virtual BytesRef LowerTerm
{
get { return lowerTerm; }
}
/// <summary>Returns the upper value of this range query </summary>
- public virtual string UpperTerm
+ public virtual BytesRef UpperTerm
{
get { return upperTerm; }
}
@@ -110,14 +110,14 @@ namespace Lucene.Net.Search
protected internal override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
{
- if (lowerTerm != null && upperTerm != null && lowerTerm.CompareTo(upperTerm) > )
+ if (lowerTerm != null && upperTerm != null && lowerTerm.CompareTo(upperTerm) > 0)
{
return TermsEnum.EMPTY;
}
var tenum = terms.Iterator(null);
- if ((lowerTerm == null || (includeLower && lowerTerm.Length == 0)) && uperTerm == null)
+ if ((lowerTerm == null || (includeLower && lowerTerm.length == 0)) && upperTerm == null)
{
return tenum;
}
@@ -134,10 +134,10 @@ namespace Lucene.Net.Search
buffer.Append(":");
}
buffer.Append(includeLower ? '[' : '{');
- buffer.append(lowerTerm != null ? ("*".Equals(Term.ToString(lowerTerm)) ? "\\*" : Term.ToString(lowerTerm)) : "*");
- buffer.append(" TO ");
- buffer.append(upperTerm != null ? ("*".Equals(Term.ToString(upperTerm)) ? "\\*" : Term.ToString(upperTerm)) : "*");
- buffer.append(includeUpper ? ']' : '}');
+ buffer.Append(lowerTerm != null ? ("*".Equals(Term.ToString(lowerTerm)) ? "\\*" : Term.ToString(lowerTerm)) : "*");
+ buffer.Append(" TO ");
+ buffer.Append(upperTerm != null ? ("*".Equals(Term.ToString(upperTerm)) ? "\\*" : Term.ToString(upperTerm)) : "*");
+ buffer.Append(includeUpper ? ']' : '}');
buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
@@ -162,9 +162,9 @@ namespace Lucene.Net.Search
if (GetType() != obj.GetType())
return false;
var other = (TermRangeQuery)obj;
- if (includeLower != other.IncludeLower)
+ if (includeLower != other.includeLower)
return false;
- if (includeUpper != other.IncludeUpper)
+ if (includeUpper != other.includeUpper)
return false;
if (lowerTerm == null)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/TopDocs.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/TopDocs.cs b/src/core/Search/TopDocs.cs
index 7dd08b2..183ab88 100644
--- a/src/core/Search/TopDocs.cs
+++ b/src/core/Search/TopDocs.cs
@@ -187,7 +187,7 @@ namespace Lucene.Net.Search
for (var compIDX = 0; compIDX < comparators.Length; compIDX++)
{
- var comp = comparators[compIDX];
+ FieldComparator comp = comparators[compIDX];
var cmp = reverseMul[compIDX] * comp.CompareValues(firstFD.fields[compIDX], secondFD.fields[compIDX]);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Search/TopFieldCollector.cs
----------------------------------------------------------------------
diff --git a/src/core/Search/TopFieldCollector.cs b/src/core/Search/TopFieldCollector.cs
index 5ea70e5..4a18202 100644
--- a/src/core/Search/TopFieldCollector.cs
+++ b/src/core/Search/TopFieldCollector.cs
@@ -101,7 +101,7 @@ namespace Lucene.Net.Search
{
this.docBase = context.docBase;
queue.SetComparator(0, comparator.SetNextReader(context));
- comparator = queue.FirstComparator;
+ comparator = queue.firstComparator;
}
public override void SetScorer(Scorer scorer)
@@ -493,7 +493,7 @@ namespace Lucene.Net.Search
this.docBase = docBase;
for (var i = 0; i < comparators.Length; i++)
{
- queue.SetComparators(i, comparators[i].SetNextReader(context));
+ queue.SetComparator(i, comparators[i].SetNextReader(context));
}
}
@@ -1005,7 +1005,7 @@ namespace Lucene.Net.Search
{
var comp = comparators[compIDX];
- var cmp = reverseMul[compIDX] * comp.CompareDocToValue(doc, after.fields[compIDX]);
+ var cmp = reverseMul[compIDX] * comp.CompareDocToObjectValue(doc, after.fields[compIDX]);
if (cmp < 0)
{
return;
@@ -1208,7 +1208,7 @@ namespace Lucene.Net.Search
if (numHits <= 0) throw new ArgumentException("numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count");
- FieldValueHitQueue<Entry> queue = FieldValueHitQueue<Entry>.Create(sort.fields, numHits);
+ FieldValueHitQueue<Entry> queue = FieldValueHitQueue.Create<Entry>(sort.fields, numHits);
if (after == null)
{
if (queue.Comparators.Length == 1)
@@ -1335,7 +1335,7 @@ namespace Lucene.Net.Search
}
// If this is a maxScoring tracking collector and there were no results,
- return new TopFieldDocs(totalHits, results, ((FieldValueHitQueue<Entry>)pq).GetFields(), maxScore);
+ return new TopFieldDocs(totalHits, results, ((FieldValueHitQueue<Entry>)pq).Fields, maxScore);
}
public override bool AcceptsDocsOutOfOrder
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Store/NIOFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/core/Store/NIOFSDirectory.cs b/src/core/Store/NIOFSDirectory.cs
index e7d8984..b6af63f 100644
--- a/src/core/Store/NIOFSDirectory.cs
+++ b/src/core/Store/NIOFSDirectory.cs
@@ -66,7 +66,7 @@ namespace Lucene.Net.Store
public override IndexInput OpenSlice(string sliceDescription, long offset, long length)
{
return new NIOFSIndexInput(sliceDescription, path, descriptor, /*descriptor.getChannel(),*/ offset,
- length, BufferedIndexInput.BufferSize(context), parent.ReadChunkSize);
+ length, BufferedIndexInput.GetBufferSize(context), parent.ReadChunkSize);
}
public override IndexInput OpenFullSlice()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Store/SimpleFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/core/Store/SimpleFSDirectory.cs b/src/core/Store/SimpleFSDirectory.cs
index 7053d80..74810da 100644
--- a/src/core/Store/SimpleFSDirectory.cs
+++ b/src/core/Store/SimpleFSDirectory.cs
@@ -90,7 +90,7 @@ namespace Lucene.Net.Store
public override IndexInput OpenSlice(string sliceDescription, long offset, long length)
{
return new SimpleFSIndexInput("SimpleFSIndexInput(" + sliceDescription + " in path=\"" + file.FullName + "\" slice=" + offset + ":" + (offset + length) + ")", descriptor, offset,
- length, BufferedIndexInput.BufferSize(context), parent.ReadChunkSize);
+ length, BufferedIndexInput.GetBufferSize(context), parent.ReadChunkSize);
}
public override IndexInput OpenFullSlice()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Support/Deflater.cs
----------------------------------------------------------------------
diff --git a/src/core/Support/Deflater.cs b/src/core/Support/Deflater.cs
index 03473de..7db9d76 100644
--- a/src/core/Support/Deflater.cs
+++ b/src/core/Support/Deflater.cs
@@ -30,12 +30,18 @@ namespace Lucene.Net.Support
delegate void FinishDelegate();
delegate bool GetIsFinishedDelegate();
delegate int DeflateDelegate(byte[] output);
+ delegate void ResetDelegate();
+ delegate bool GetIsNeedingInputDelegate();
+ delegate int DeflateDelegate3(byte[] output, int offset, int length);
SetLevelDelegate setLevelMethod;
SetInputDelegate setInputMethod;
FinishDelegate finishMethod;
GetIsFinishedDelegate getIsFinishedMethod;
DeflateDelegate deflateMethod;
+ ResetDelegate resetMethod;
+ GetIsNeedingInputDelegate getIsNeedingInputMethod;
+ DeflateDelegate3 deflate3Method;
public const int BEST_COMPRESSION = 9;
@@ -67,6 +73,21 @@ namespace Lucene.Net.Support
typeof(DeflateDelegate),
deflaterInstance,
type.GetMethod("Deflate", new Type[] { typeof(byte[]) }));
+
+ resetMethod = (ResetDelegate)Delegate.CreateDelegate(
+ typeof(ResetDelegate),
+ deflaterInstance,
+ type.GetMethod("Reset", Type.EmptyTypes));
+
+ getIsNeedingInputMethod = (GetIsNeedingInputDelegate)Delegate.CreateDelegate(
+ typeof(GetIsNeedingInputDelegate),
+ deflaterInstance,
+ type.GetMethod("get_IsNeedingInput", Type.EmptyTypes));
+
+ deflate3Method = (DeflateDelegate3)Delegate.CreateDelegate(
+ typeof(DeflateDelegate3),
+ deflaterInstance,
+ type.GetMethod("Deflate", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));
}
public void SetLevel(int level)
@@ -93,5 +114,20 @@ namespace Lucene.Net.Support
{
return deflateMethod(output);
}
+
+ public int Deflate(byte[] output, int offset, int length)
+ {
+ return deflate3Method(output, offset, length);
+ }
+
+ public void Reset()
+ {
+ resetMethod();
+ }
+
+ public bool IsNeedingInput
+ {
+ get { return getIsNeedingInputMethod(); }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Support/Inflater.cs
----------------------------------------------------------------------
diff --git a/src/core/Support/Inflater.cs b/src/core/Support/Inflater.cs
index a67add0..5b16fc8 100644
--- a/src/core/Support/Inflater.cs
+++ b/src/core/Support/Inflater.cs
@@ -28,10 +28,16 @@ namespace Lucene.Net.Support
delegate void SetInputDelegate(byte[] buffer);
delegate bool GetIsFinishedDelegate();
delegate int InflateDelegate(byte[] buffer);
+ delegate void ResetDelegate();
+ delegate void SetInputDelegate3(byte[] buffer, int index, int count);
+ delegate int InflateDelegate3(byte[] buffer, int offset, int count);
SetInputDelegate setInputMethod;
GetIsFinishedDelegate getIsFinishedMethod;
InflateDelegate inflateMethod;
+ ResetDelegate resetMethod;
+ SetInputDelegate3 setInput3Method;
+ InflateDelegate3 inflate3Method;
internal Inflater(object inflaterInstance)
{
@@ -51,6 +57,21 @@ namespace Lucene.Net.Support
typeof(InflateDelegate),
inflaterInstance,
type.GetMethod("Inflate", new Type[] { typeof(byte[]) }));
+
+ resetMethod = (ResetDelegate)Delegate.CreateDelegate(
+ typeof(ResetDelegate),
+ inflaterInstance,
+ type.GetMethod("Reset", Type.EmptyTypes));
+
+ setInput3Method = (SetInputDelegate3)Delegate.CreateDelegate(
+ typeof(SetInputDelegate3),
+ inflaterInstance,
+ type.GetMethod("SetInput", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));
+
+ inflate3Method = (InflateDelegate3)Delegate.CreateDelegate(
+ typeof(InflateDelegate3),
+ inflaterInstance,
+ type.GetMethod("Inflate", new Type[] { typeof(byte[]), typeof(int), typeof(int) }));
}
public void SetInput(byte[] buffer)
@@ -58,6 +79,11 @@ namespace Lucene.Net.Support
setInputMethod(buffer);
}
+ public void SetInput(byte[] buffer, int index, int count)
+ {
+ setInput3Method(buffer, index, count);
+ }
+
public bool IsFinished
{
get { return getIsFinishedMethod(); }
@@ -67,5 +93,15 @@ namespace Lucene.Net.Support
{
return inflateMethod(buffer);
}
+
+ public int Inflate(byte[] buffer, int offset, int count)
+ {
+ return inflate3Method(buffer, offset, count);
+ }
+
+ public void Reset()
+ {
+ resetMethod();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Support/StringBuilderExtensions.cs
----------------------------------------------------------------------
diff --git a/src/core/Support/StringBuilderExtensions.cs b/src/core/Support/StringBuilderExtensions.cs
new file mode 100644
index 0000000..769dde1
--- /dev/null
+++ b/src/core/Support/StringBuilderExtensions.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Lucene.Net.Support
+{
+ public static class StringBuilderExtensions
+ {
+ public static StringBuilder Reverse(this StringBuilder text)
+ {
+ if (text.Length > 1)
+ {
+ int pivotPos = text.Length / 2;
+ for (int i = 0; i < pivotPos; i++)
+ {
+ int iRight = text.Length - (i + 1);
+ char rightChar = text[i];
+ char leftChar = text[iRight];
+ text[i] = leftChar;
+ text[iRight] = rightChar;
+ }
+ }
+
+ return text;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/733dc181/src/core/Util/Fst/ReverseBytesReader.cs
----------------------------------------------------------------------
diff --git a/src/core/Util/Fst/ReverseBytesReader.cs b/src/core/Util/Fst/ReverseBytesReader.cs
index ad9c4d1..2df7b8c 100644
--- a/src/core/Util/Fst/ReverseBytesReader.cs
+++ b/src/core/Util/Fst/ReverseBytesReader.cs
@@ -12,14 +12,14 @@
public override byte ReadByte()
{
- return bytes[Position--];
+ return (byte)bytes[Position--];
}
public override void ReadBytes(byte[] b, int offset, int len)
{
for (var i = 0; i < len; i++)
{
- b[offset + i] = bytes[Position--];
+ b[offset + i] = (byte)bytes[Position--];
}
}