Skip to content

Commit

Permalink
SWEEP: Make anonymous class members default to private instead of int…
Browse files Browse the repository at this point in the history
…ernal, #715 (#1061)
  • Loading branch information
paulirwin authored Dec 15, 2024
1 parent 3d489a6 commit f7038ba
Show file tree
Hide file tree
Showing 71 changed files with 329 additions and 545 deletions.
10 changes: 5 additions & 5 deletions src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Lucene.Net.Spatial.Prefix
/// <summary>
/// Finds docs where its indexed shape <see cref="Queries.SpatialOperation.Contains"/>
/// the query shape. For use on <see cref="RecursivePrefixTreeStrategy"/>.
///
///
/// @lucene.experimental
/// </summary>
public class ContainsPrefixTreeFilter : AbstractPrefixTreeFilter
Expand Down Expand Up @@ -114,7 +114,7 @@ public ContainsVisitor(ContainsPrefixTreeFilter outerInstance, AtomicReaderConte
{
combinedSubResults = GetDocs(subCell, acceptContains);
}
else if (!outerInstance.m_multiOverlappingIndexedShapes &&
else if (!outerInstance.m_multiOverlappingIndexedShapes &&
subCell.ShapeRel == SpatialRelation.Within)
{
combinedSubResults = GetLeafDocs(subCell, acceptContains); //recursion
Expand All @@ -123,15 +123,15 @@ public ContainsVisitor(ContainsPrefixTreeFilter outerInstance, AtomicReaderConte
{
combinedSubResults = Visit(subCell, acceptContains);
}

if (combinedSubResults is null)
{
break;
}

acceptContains = combinedSubResults;//has the 'AND' effect on next iteration
}

// Result: OR the leaf docs with AND of all child results
if (combinedSubResults != null)
{
Expand Down Expand Up @@ -331,7 +331,7 @@ public DocIdSetIteratorAnonymousClass(int size, int[] docs)
this.docs = docs;
}

internal int idx = -1;
private int idx = -1;

public override int DocID
{
Expand Down
8 changes: 4 additions & 4 deletions src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ public override FunctionValues GetValues(IDictionary context, AtomicReaderContex

BinaryDocValues docValues = readerContext.AtomicReader.GetBinaryDocValues(fieldName);

return new FuctionValuesAnonymousClass(this, docValues);
return new FunctionValuesAnonymousClass(this, docValues);
}

private sealed class FuctionValuesAnonymousClass : FunctionValues
private sealed class FunctionValuesAnonymousClass : FunctionValues
{
private readonly ShapeDocValueSource outerInstance;
private readonly BinaryDocValues docValues;

public FuctionValuesAnonymousClass(ShapeDocValueSource outerInstance, BinaryDocValues docValues)
public FunctionValuesAnonymousClass(ShapeDocValueSource outerInstance, BinaryDocValues docValues)
{
// LUCENENET specific - added guard clauses
this.outerInstance = outerInstance ?? throw new ArgumentNullException(nameof(outerInstance));
Expand All @@ -276,7 +276,7 @@ public FuctionValuesAnonymousClass(ShapeDocValueSource outerInstance, BinaryDocV
private int bytesRefDoc = -1;
private readonly BytesRef bytesRef = new BytesRef();//scratch

internal bool FillBytes(int doc)
private bool FillBytes(int doc)
{
if (bytesRefDoc != doc)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ public class DummyCompressingCodec : CompressingCodec

private sealed class CompressionModeAnonymousClass : CompressionMode
{
public CompressionModeAnonymousClass()
{ }

public override Compressor NewCompressor()
{
return DUMMY_COMPRESSOR;
Expand Down Expand Up @@ -95,4 +92,4 @@ public DummyCompressingCodec()
: this(1 << 14, false)
{ }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public sealed class RAMOnlyPostingsFormat : PostingsFormat
private sealed class ComparerAnonymousClass : IComparer<BytesRef>
#pragma warning restore 659
{
public ComparerAnonymousClass()
{ }

public int Compare(BytesRef t1, BytesRef t2)
{
var b1 = t1.Bytes;
Expand Down Expand Up @@ -288,7 +285,7 @@ public override PostingsConsumer StartTerm(BytesRef text)
return postingsWriter;
}

public override IComparer<BytesRef> Comparer
public override IComparer<BytesRef> Comparer
=> BytesRef.UTF8SortedAsUnicodeComparer;

public override void FinishTerm(BytesRef text, TermStats stats)
Expand Down
8 changes: 4 additions & 4 deletions src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public EnumeratorAnonymousClass(EnumerableAnonymousClass<IndexableField> outerIn
this.outerInstance = outerInstance;
}

internal bool done;
private bool done;
private IEnumerable<IndexableField> current;

public bool MoveNext()
Expand Down Expand Up @@ -265,7 +265,7 @@ public IEnumerator<IEnumerable<IIndexableField>> GetEnumerator()
return new EnumeratorAnonymousClass2(this);
}

IEnumerator IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();

private sealed class EnumeratorAnonymousClass2 : IEnumerator<IEnumerable<IIndexableField>>
Expand All @@ -277,7 +277,7 @@ public EnumeratorAnonymousClass2(EnumerableAnonymousClass2 outerInstance)
this.outerInstance = outerInstance;
}

internal bool done;
private bool done;
private IEnumerable<IIndexableField> current;

public bool MoveNext()
Expand Down Expand Up @@ -519,4 +519,4 @@ public interface ITestPoint
{
void Apply(string message);
}
}
}
16 changes: 6 additions & 10 deletions src/Lucene.Net.TestFramework/Search/QueryUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ public static void CheckHashEquals(Query q)

private sealed class QueryAnonymousClass : Query
{
public QueryAnonymousClass()
{
}

public override string ToString(string field)
{
return "My Whacky Query";
Expand Down Expand Up @@ -187,13 +183,13 @@ public static IndexSearcher WrapUnderlyingReader(Random random, IndexSearcher s,
IndexReader[] readers = new IndexReader[] {
edge < 0 ? r : emptyReaders[0],
emptyReaders[0],
new FCInvisibleMultiReader(edge < 0 ? emptyReaders[4] : emptyReaders[0],
emptyReaders[0],
new FCInvisibleMultiReader(edge < 0 ? emptyReaders[4] : emptyReaders[0],
emptyReaders[0],
0 == edge ? r : emptyReaders[0]),
0 < edge ? emptyReaders[0] : emptyReaders[7],
emptyReaders[0],
new FCInvisibleMultiReader(0 < edge ? emptyReaders[0] : emptyReaders[5],
emptyReaders[0],
new FCInvisibleMultiReader(0 < edge ? emptyReaders[0] : emptyReaders[5],
emptyReaders[0],
0 < edge ? r : emptyReaders[0])
};

Expand Down Expand Up @@ -300,7 +296,7 @@ private sealed class CollectorAnonymousClass : ICollector
private readonly float maxDiff;
private readonly AtomicReader[] lastReader;

public CollectorAnonymousClass(Query q, IndexSearcher s, IList<AtomicReaderContext> readerContextArray,
public CollectorAnonymousClass(Query q, IndexSearcher s, IList<AtomicReaderContext> readerContextArray,
int skip_op, int[] order, int[] opidx, int[] lastDoc, float maxDiff, AtomicReader[] lastReader)
{
this.q = q;
Expand Down Expand Up @@ -503,4 +499,4 @@ public void SetNextReader(AtomicReaderContext context)
public bool AcceptsDocsOutOfOrder => false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public override Tokenizer Create(AttributeSource.AttributeFactory factory, TextR

private sealed class FactoryAnalyzer : Analyzer
{
internal readonly TokenizerFactory tokenizer;
internal readonly CharFilterFactory charFilter;
internal readonly TokenFilterFactory tokenfilter;
private readonly TokenizerFactory tokenizer;
private readonly CharFilterFactory charFilter;
private readonly TokenFilterFactory tokenfilter;

internal FactoryAnalyzer(TokenizerFactory tokenizer, TokenFilterFactory tokenfilter, CharFilterFactory charFilter)
{
Expand Down Expand Up @@ -243,4 +243,4 @@ protected internal override TextReader InitReader(string fieldName, TextReader r
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ private interface IPredicate<T>

private sealed class PredicateAnonymousClass : IPredicate<object[]>
{
public PredicateAnonymousClass()
{
}

public bool Apply(object[] args)
{
return true;
Expand Down Expand Up @@ -171,10 +167,6 @@ static TestRandomChains()

private sealed class PredicateAnonymousClass2 : IPredicate<object[]>
{
public PredicateAnonymousClass2()
{
}

public bool Apply(object[] args)
{
if (Debugging.AssertsEnabled) Debugging.Assert(args.Length == 3);
Expand All @@ -184,10 +176,6 @@ public bool Apply(object[] args)

private sealed class PredicateAnonymousClass3 : IPredicate<object[]>
{
public PredicateAnonymousClass3()
{
}

public bool Apply(object[] args)
{
if (Debugging.AssertsEnabled) Debugging.Assert(args.Length == 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public TokenStreamAnonymousClass(IEnumerator<Token> toks)
posIncAtt = AddAttribute<IPositionIncrementAttribute>();
}

internal ICharTermAttribute termAtt;
internal IOffsetAttribute offsetAtt;
internal IPositionIncrementAttribute posIncAtt;
private ICharTermAttribute termAtt;
private IOffsetAttribute offsetAtt;
private IPositionIncrementAttribute posIncAtt;
public override sealed bool IncrementToken()
{
if (toks.MoveNext())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TestCharTokenizers : BaseTokenStreamTestCase
{

/*
* test to read surrogate pairs without loosing the pairing
* test to read surrogate pairs without loosing the pairing
* if the surrogate pair is at the border of the internal IO buffer
*/
[Test]
Expand Down Expand Up @@ -261,9 +261,6 @@ public virtual void TestSurrogates()

private sealed class AnalyzerAnonymousClass3 : Analyzer
{
public AnalyzerAnonymousClass3()
{ }

protected internal override TokenStreamComponents CreateComponents(string fieldName, TextReader reader)
{
Tokenizer tokenizer = new NumberAndSurrogatePairTokenizer(TEST_VERSION_CURRENT, reader);
Expand All @@ -290,4 +287,4 @@ protected override bool IsTokenChar(int c)
}
}
}
}
}
Loading

0 comments on commit f7038ba

Please sign in to comment.