From 984261221ceecc7c6d04e014a9296d562d53bacd Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 28 Apr 2014 08:25:21 -0500 Subject: [PATCH] Mark Sharpen classes internal where possible --- .../CSharp/Antlr4.Runtime.Test/Sharpen/CRC32.cs | 2 +- .../Antlr4.Runtime.Test/Sharpen/Checksum.cs | 2 +- .../Antlr4.Runtime.Test/TestPerformance.cs | 9 +++++---- runtime/CSharp/Antlr4.Runtime/Sharpen/Arrays.cs | 2 +- .../Sharpen/Compat/IStructuralComparable.cs | 2 +- .../Sharpen/Compat/IStructuralEquatable.cs | 2 +- .../Antlr4.Runtime/Sharpen/Compat/Tuple.cs | 2 +- .../Antlr4.Runtime/Sharpen/Compat/Tuples.cs | 16 ++++++++-------- .../Sharpen/DictionaryExtensions.cs | 2 +- .../Antlr4.Runtime/Sharpen/ListExtensions.cs | 2 +- .../Sharpen/SequenceEqualityComparer`1.cs | 2 +- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/CRC32.cs b/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/CRC32.cs index 5eb5c719f..7292734f7 100644 --- a/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/CRC32.cs +++ b/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/CRC32.cs @@ -2,7 +2,7 @@ { using System; - public class CRC32 : Checksum + internal class CRC32 : Checksum { private uint _crc; diff --git a/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/Checksum.cs b/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/Checksum.cs index ca60175f9..4692c126d 100644 --- a/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/Checksum.cs +++ b/runtime/CSharp/Antlr4.Runtime.Test/Sharpen/Checksum.cs @@ -1,6 +1,6 @@ namespace Sharpen { - public interface Checksum + internal interface Checksum { long Value { diff --git a/runtime/CSharp/Antlr4.Runtime.Test/TestPerformance.cs b/runtime/CSharp/Antlr4.Runtime.Test/TestPerformance.cs index fb45f25e1..3961cc1d6 100644 --- a/runtime/CSharp/Antlr4.Runtime.Test/TestPerformance.cs +++ b/runtime/CSharp/Antlr4.Runtime.Test/TestPerformance.cs @@ -10,7 +10,6 @@ using Antlr4.Runtime.Misc; using Antlr4.Runtime.Tree; using Microsoft.VisualStudio.TestTools.UnitTesting; - using Arrays = Sharpen.Arrays; using BitSet = Sharpen.BitSet; using Checksum = Sharpen.Checksum; using CRC32 = Sharpen.CRC32; @@ -252,8 +251,10 @@ sharedParsers[0].Atn.ClearDFA(); } - Arrays.Fill(sharedLexers, null); - Arrays.Fill(sharedParsers, null); + for (int j = 0; j < sharedLexers.Length; j++) + sharedLexers[j] = null; + for (int j = 0; j < sharedParsers.Length; j++) + sharedParsers[j] = null; } parse2(factory, sources); @@ -1053,7 +1054,7 @@ } } - protected class ChecksumParseTreeListener : IParseTreeListener + internal class ChecksumParseTreeListener : IParseTreeListener { private const int VISIT_TERMINAL = 1; private const int VISIT_ERROR_NODE = 2; diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Arrays.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Arrays.cs index 64ac4a737..9495f84dd 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Arrays.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Arrays.cs @@ -33,7 +33,7 @@ namespace Sharpen using System.Collections.Generic; using StringBuilder = System.Text.StringBuilder; - public static class Arrays + internal static class Arrays { public static T[] CopyOf(T[] array, int newSize) { diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralComparable.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralComparable.cs index ba3d9847a..2048a909d 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralComparable.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralComparable.cs @@ -33,7 +33,7 @@ using System.Collections; namespace Sharpen { - public interface IStructuralComparable { + internal interface IStructuralComparable { int CompareTo (object other, IComparer comparer); } } diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralEquatable.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralEquatable.cs index 4124954e7..af233b69b 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralEquatable.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/IStructuralEquatable.cs @@ -33,7 +33,7 @@ using System.Collections; namespace Sharpen { - public interface IStructuralEquatable { + internal interface IStructuralEquatable { bool Equals (object other, IEqualityComparer comparer); int GetHashCode (IEqualityComparer comparer); diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuple.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuple.cs index 8f97f15f2..509c25bdc 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuple.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuple.cs @@ -32,7 +32,7 @@ using System; namespace Sharpen { - public static class Tuple + internal static class Tuple { public static Tuple> Create ( diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuples.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuples.cs index 459e69abe..7586e7b8d 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuples.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/Compat/Tuples.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; namespace Sharpen { - public partial class Tuple + internal partial class Tuple { public Tuple (T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { @@ -64,7 +64,7 @@ namespace Sharpen /* The rest is generated by the script at the bottom */ [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; @@ -195,7 +195,7 @@ namespace Sharpen } [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; @@ -276,7 +276,7 @@ namespace Sharpen } [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; @@ -367,7 +367,7 @@ namespace Sharpen } [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; @@ -468,7 +468,7 @@ namespace Sharpen } [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; @@ -579,7 +579,7 @@ namespace Sharpen } [Serializable] - public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; @@ -700,7 +700,7 @@ namespace Sharpen } [Serializable] - public partial class Tuple : IStructuralEquatable, IStructuralComparable, IComparable + internal partial class Tuple : IStructuralEquatable, IStructuralComparable, IComparable { T1 item1; T2 item2; diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/DictionaryExtensions.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/DictionaryExtensions.cs index c6ed2ccce..0feb3b985 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/DictionaryExtensions.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/DictionaryExtensions.cs @@ -31,7 +31,7 @@ namespace Sharpen { using System.Collections.Generic; - public static class DictionaryExtensions + internal static class DictionaryExtensions { public static TValue Get(this IDictionary dictionary, TKey key) where TValue : class diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/ListExtensions.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/ListExtensions.cs index 17ea6be5c..bb7df0df2 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/ListExtensions.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/ListExtensions.cs @@ -31,7 +31,7 @@ namespace Sharpen { using System.Collections.Generic; - public static class ListExtensions + internal static class ListExtensions { public static T Set(this IList list, int index, T value) where T : class diff --git a/runtime/CSharp/Antlr4.Runtime/Sharpen/SequenceEqualityComparer`1.cs b/runtime/CSharp/Antlr4.Runtime/Sharpen/SequenceEqualityComparer`1.cs index 5e48ed9a4..763deb002 100644 --- a/runtime/CSharp/Antlr4.Runtime/Sharpen/SequenceEqualityComparer`1.cs +++ b/runtime/CSharp/Antlr4.Runtime/Sharpen/SequenceEqualityComparer`1.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; - public class SequenceEqualityComparer : EqualityComparer> + internal class SequenceEqualityComparer : EqualityComparer> { private static readonly SequenceEqualityComparer _default = new SequenceEqualityComparer();