Skip to content

Commit

Permalink
apache#679 Tried adding readonly and const to reduce visibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
sachdevlaksh committed Oct 29, 2022
1 parent 640f865 commit 5a85bba
Show file tree
Hide file tree
Showing 34 changed files with 178 additions and 178 deletions.
4 changes: 2 additions & 2 deletions src/Lucene.Net.Analysis.Common/Analysis/En/KStemData1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private KStemData1()
{
}
// KStemData1 ... KStemData8 are created from "head_word_list.txt"
internal static string[] data = new string[] {
public static readonly string[] data = new string[] {
"aback","abacus","abandon","abandoned","abase",
"abash","abate","abattoir","abbess","abbey",
"abbot","abbreviate","abbreviation","abc","abdicate",
Expand Down Expand Up @@ -752,4 +752,4 @@ private KStemData1()
"cascara","case","casebook","casein","casework",
};
}
}
}
4 changes: 2 additions & 2 deletions src/Lucene.Net.Analysis.Common/Analysis/En/KStemData2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData2
private KStemData2()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"cash","cashew","cashier","cashmere","casing",
"casino","cask","casket","casque","cassava",
"casserole","cassette","cassock","cassowary","cast",
Expand Down Expand Up @@ -750,4 +750,4 @@ private KStemData2()
"distal","distance","distant","distantly","distaste",
};
}
}
}
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData3
private KStemData3()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"distasteful","distemper","distempered","distend","distension",
"distil","distill","distillation","distiller","distillery",
"distinct","distinction","distinctive","distinguish","distinguishable",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData4
private KStemData4()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"granular","granulate","granule","grape","grapefruit",
"grapeshot","grapevine","graph","graphic","graphical",
"graphically","graphite","graphology","grapnel","grapple",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData5
private KStemData5()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"lock","locker","locket","lockjaw","locknut",
"lockout","locks","locksmith","lockstitch","lockup",
"loco","locomotion","locomotive","locum","locus",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData6
private KStemData6()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"pedant","pedantic","pedantry","peddle","peddler",
"pederast","pederasty","pedestal","pedestrian","pediatrician",
"pediatrics","pedicab","pedicel","pedicure","pedigree",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData7
private KStemData7()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"rupee","rupture","rural","ruritanian","ruse",
"rush","rushes","rushlight","rusk","russet",
"rust","rustic","rusticate","rustication","rustle",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.Common/Analysis/En/KStemData8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal class KStemData8
private KStemData8()
{
}
internal static string[] data = new string[] {
internal static readonly string[] data = new string[] {
"tenor","tenpin","tense","tensile","tension",
"tent","tentacle","tentative","tenterhooks","tenuity",
"tenuous","tenure","tepee","tepid","tequila",
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Analysis.OpenNLP/OpenNLPTokenizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Lucene.Net.Analysis.OpenNlp
/// </summary>
public sealed class OpenNLPTokenizer : SegmentingTokenizerBase
{
public static int EOS_FLAG_BIT = 1;
public const int EOS_FLAG_BIT = 1;

private readonly ICharTermAttribute termAtt;
private readonly IFlagsAttribute flagsAtt;
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/MultiTrie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ namespace Egothor.Stemmer
/// </summary>
public class MultiTrie : Trie
{
internal static char EOM = '*';
internal static string EOM_NODE = "" + EOM;
internal static readonly char EOM = '*';
internal static readonly string EOM_NODE = "" + EOM;

protected IList<Trie> m_tries = new JCG.List<Trie>();

Expand Down
12 changes: 6 additions & 6 deletions src/Lucene.Net.Benchmark/ByTask/Tasks/TaskSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
/// </summary>
public class TaskSequence : PerfTask
{
public static int REPEAT_EXHAUST = -2;
public const int REPEAT_EXHAUST = -2;
private IList<PerfTask> tasks;
private int repetitions = 1;
private readonly bool parallel;
Expand All @@ -46,7 +46,7 @@ public class TaskSequence : PerfTask
private bool resetExhausted = false;
private PerfTask[] tasksArray;
private bool anyExhaustibleTasks;
private readonly bool collapsable = false; // to not collapse external sequence named in alg.
private readonly bool collapsable = false; // to not collapse external sequence named in alg.

private bool fixedTime; // true if we run for fixed time
private double runTimeSec; // how long to run for
Expand Down Expand Up @@ -298,7 +298,7 @@ private int DoSerialTasksWithRate()
{
break;
}
nextStartTime += delayStep; // this aims at avarage rate.
nextStartTime += delayStep; // this aims at avarage rate.
try
{
int inc = task.RunAndMaybeStats(letChildReport);
Expand Down Expand Up @@ -493,7 +493,7 @@ private void StartlThreadsWithRate(ParallelTask[] t)
{
Thread.Sleep((int)waitMore);
}
nextStartTime += delayStep; // this aims at average rate of starting threads.
nextStartTime += delayStep; // this aims at average rate of starting threads.
t[i].Start();
}
}
Expand Down Expand Up @@ -572,7 +572,7 @@ public virtual int GetRate()
}

/// <summary>
///
///
/// </summary>
/// <param name="rate">The rate to set.</param>
/// <param name="perMin"></param>
Expand Down Expand Up @@ -606,7 +606,7 @@ private void SetSequenceName()

public override string GetName()
{
return seqName; // override to include more info
return seqName; // override to include more info
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net.Benchmark/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class Constants // LUCENENET specific: CA1052 Static holder types
public const int DEFAULT_SCALE_UP = 5;
public const int DEFAULT_LOG_STEP = 1000;

public static bool[] BOOLEANS = new bool[] { false, true };
public static readonly bool[] BOOLEANS = new bool[] { false, true };

public const int DEFAULT_MAXIMUM_DOCUMENTS = int.MaxValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Lucene.Net.Search.Highlight
*/

/// <summary>
/// Class used to extract <see cref="WeightedSpanTerm"/>s from a <see cref="Query"/> based on whether
/// Class used to extract <see cref="WeightedSpanTerm"/>s from a <see cref="Query"/> based on whether
/// <see cref="Term"/>s from the <see cref="Query"/> are contained in a supplied <see cref="Analysis.TokenStream"/>.
/// </summary>
public class WeightedSpanTermExtractor
Expand Down Expand Up @@ -137,10 +137,10 @@ protected virtual void Extract(Query query, IDictionary<string, WeightedSpanTerm
}
else if (query is CommonTermsQuery)
{
// specialized since rewriting would change the result query
// specialized since rewriting would change the result query
// this query is TermContext sensitive.
ExtractWeightedTerms(terms, query);
}
}
else if (query is DisjunctionMaxQuery disjunctionMaxQuery)
{
foreach (var q in disjunctionMaxQuery)
Expand Down Expand Up @@ -336,7 +336,7 @@ protected virtual void ExtractWeightedSpanTerms(IDictionary<string, WeightedSpan
}

/// <summary>
/// Fills a <see cref="T:IDictionary{string, WeightedSpanTerm}"/> with <see cref="WeightedSpanTerm"/>s using the terms from
/// Fills a <see cref="T:IDictionary{string, WeightedSpanTerm}"/> with <see cref="WeightedSpanTerm"/>s using the terms from
/// the supplied <see cref="Search.Spans.SpanQuery"/>.
/// </summary>
/// <param name="terms"><see cref="T:IDictionary{string, WeightedSpanTerm}"/> to place created <see cref="WeightedSpanTerm"/>s in</param>
Expand Down Expand Up @@ -395,7 +395,7 @@ protected virtual AtomicReaderContext GetLeafContext()
/// </summary>
internal sealed class DelegatingAtomicReader : FilterAtomicReader
{
public static string FIELD_NAME = "shadowed_field";
internal static readonly string FIELD_NAME = "shadowed_field";

internal DelegatingAtomicReader(AtomicReader reader) : base(reader) { }

Expand Down Expand Up @@ -430,7 +430,7 @@ public override BinaryDocValues GetBinaryDocValues(string field)
{
return base.GetBinaryDocValues(FIELD_NAME);
}

public override SortedDocValues GetSortedDocValues(string field)
{
return base.GetSortedDocValues(FIELD_NAME);
Expand Down
64 changes: 32 additions & 32 deletions src/Lucene.Net.QueryParser/Classic/ParseException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ namespace Lucene.Net.QueryParsers.Classic
* limitations under the License.
*/

/// <summary>
/// <summary>
/// This exception is thrown when parse errors are encountered.
/// You can explicitly create objects of this exception type by
/// calling the method GenerateParseException in the generated
/// parser.
///
///
/// You can modify this class to customize your error reporting
/// mechanisms so long as you retain the public fields.
/// </summary>
// LUCENENET: It is no longer good practice to use binary serialization.
// LUCENENET: It is no longer good practice to use binary serialization.
// See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568
#if FEATURE_SERIALIZABLE_EXCEPTIONS
[Serializable]
Expand Down Expand Up @@ -107,14 +107,14 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
}
#endif

/// <summary>
/// <summary>
/// This is the last token that has been consumed successfully. If
/// this object has been created due to a parse error, the token
/// following this token will (therefore) be the first error token.
/// </summary>
public Token CurrentToken { get; set; }

/// <summary>
/// <summary>
/// Each entry in this array is an array of integers. Each array
/// of integers represents a sequence of tokens (by their ordinal
/// values) that is expected at this point of the parse.
Expand All @@ -123,7 +123,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
[SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
public int[][] ExpectedTokenSequences { get; set; }

/// <summary>
/// <summary>
/// This is a reference to the "tokenImage" array of the generated
/// parser within which the parse error occurred. This array is
/// defined in the generated ...Constants interface.
Expand Down Expand Up @@ -193,13 +193,13 @@ private static string Initialize(Token currentToken,
retval += expected.ToString();
return retval;
}
/// <summary>

/// <summary>
/// The end of line string for this machine.
/// </summary>
protected static string eol = Environment.NewLine;
/// <summary>
protected static readonly string eol = Environment.NewLine;

/// <summary>
/// Used to convert raw characters to their escaped version
/// when these raw version cannot be used as part of an ASCII
/// string literal.
Expand All @@ -212,43 +212,43 @@ internal static string AddEscapes(string str)
{
switch (str[i])
{
case (char) (0):

case (char) (0):
continue;
case '\b':

case '\b':
retval.Append("\\b");
continue;
case '\t':

case '\t':
retval.Append("\\t");
continue;
case '\n':

case '\n':
retval.Append("\\n");
continue;
case '\f':

case '\f':
retval.Append("\\f");
continue;
case '\r':

case '\r':
retval.Append("\\r");
continue;
case '\"':

case '\"':
retval.Append("\\\"");
continue;
case '\'':

case '\'':
retval.Append("\\\'");
continue;
case '\\':

case '\\':
retval.Append("\\\\");
continue;
default:

default:
if ((ch = str[i]) < 0x20 || ch > 0x7e)
{
string s = "0000" + Convert.ToString(ch, 16);
Expand All @@ -259,7 +259,7 @@ internal static string AddEscapes(string str)
retval.Append(ch);
}
continue;

}
}
return retval.ToString();
Expand Down
Loading

0 comments on commit 5a85bba

Please sign in to comment.