diff --git a/CHANGELOG.md b/CHANGELOG.md index 7286fe1a..b1140c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GenerateDocumentationFile - Split files +- Use EditorBrowsable(EditorBrowsableState.Never) instead of private or internal ## [1.0.5] - 2020-12-18 ### Added diff --git a/Source/AtCoderLibrary/DataStructure/FenwickTree.cs b/Source/AtCoderLibrary/DataStructure/FenwickTree.cs index af5e3bde..f0c4e4d5 100644 --- a/Source/AtCoderLibrary/DataStructure/FenwickTree.cs +++ b/Source/AtCoderLibrary/DataStructure/FenwickTree.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System.ComponentModel; +using System.Diagnostics; using System.Runtime.CompilerServices; using AtCoder.Internal; @@ -24,7 +25,9 @@ public class FenwickTree where TOp : struct, IArithmeticOperator { private static readonly TOp op = default; - internal readonly TValue[] data; + + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly TValue[] data; public int Length { get; } @@ -76,7 +79,9 @@ public TValue Sum(int l, int r) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal TValue Sum(int r) + + [EditorBrowsable(EditorBrowsableState.Never)] + public TValue Sum(int r) { TValue s = default; for (; r > 0; r -= InternalBit.ExtractLowestSetBit(r)) diff --git a/Source/AtCoderLibrary/DataStructure/LazySegtree.cs b/Source/AtCoderLibrary/DataStructure/LazySegtree.cs index f89bee1c..aa34dc4c 100644 --- a/Source/AtCoderLibrary/DataStructure/LazySegtree.cs +++ b/Source/AtCoderLibrary/DataStructure/LazySegtree.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using AtCoder.Internal; @@ -60,8 +61,10 @@ public class LazySegtree where TOp : struct, ILazySegtreeOperato internal readonly int log; internal readonly int size; - internal readonly TValue[] d; - internal readonly F[] lz; + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly TValue[] d; + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly F[] lz; /// @@ -105,10 +108,14 @@ public LazySegtree(TValue[] v) : this(v.Length) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void Update(int k) => d[k] = op.Operate(d[2 * k], d[2 * k + 1]); + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Update(int k) => d[k] = op.Operate(d[2 * k], d[2 * k + 1]); [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void AllApply(int k, F f) + + [EditorBrowsable(EditorBrowsableState.Never)] + public void AllApply(int k, F f) { AssertF(f, op.Identity, op.Identity); AssertMonoid(d[k]); @@ -118,7 +125,9 @@ internal void AllApply(int k, F f) if (k < size) lz[k] = op.Composition(f, lz[k]); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void Push(int k) + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Push(int k) { AllApply(2 * k, lz[k]); AllApply(2 * k + 1, lz[k]); diff --git a/Source/AtCoderLibrary/DataStructure/Segtree.cs b/Source/AtCoderLibrary/DataStructure/Segtree.cs index b98c7dbd..f02e4bd6 100644 --- a/Source/AtCoderLibrary/DataStructure/Segtree.cs +++ b/Source/AtCoderLibrary/DataStructure/Segtree.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using AtCoder.Internal; @@ -47,7 +48,9 @@ public class Segtree where TOp : struct, ISegtreeOperator internal readonly int log; internal readonly int size; - internal readonly TValue[] d; + + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly TValue[] d; /// @@ -87,7 +90,8 @@ public Segtree(TValue[] v) : this(v.Length) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void Update(int k) => d[k] = op.Operate(d[2 * k], d[2 * k + 1]); + [EditorBrowsable(EditorBrowsableState.Never)] + public void Update(int k) => d[k] = op.Operate(d[2 * k], d[2 * k + 1]); /// /// a[] を返します。 diff --git a/Source/AtCoderLibrary/Graph/DSU.cs b/Source/AtCoderLibrary/Graph/DSU.cs index 1fd502a2..4be4b179 100644 --- a/Source/AtCoderLibrary/Graph/DSU.cs +++ b/Source/AtCoderLibrary/Graph/DSU.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.ComponentModel; using AtCoder.Internal; namespace AtCoder @@ -6,7 +7,9 @@ namespace AtCoder public class DSU { internal readonly int _n; - internal readonly int[] _parentOrSize; + + [EditorBrowsable(EditorBrowsableState.Never)] + public readonly int[] _parentOrSize; /// /// クラスの新しいインスタンスを、 頂点 0 辺のグラフとして初期化します。 diff --git a/Source/AtCoderLibrary/Internal/CollectionDebugView.cs b/Source/AtCoderLibrary/Internal/CollectionDebugView.cs index 72ebfd57..9738426f 100644 --- a/Source/AtCoderLibrary/Internal/CollectionDebugView.cs +++ b/Source/AtCoderLibrary/Internal/CollectionDebugView.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Linq; namespace AtCoder.Internal { - internal class CollectionDebugView + + [EditorBrowsable(EditorBrowsableState.Never)] + public class CollectionDebugView { private readonly IEnumerable collection; public CollectionDebugView(IEnumerable collection) @@ -13,6 +16,8 @@ public CollectionDebugView(IEnumerable collection) this.collection = collection ?? throw new ArgumentNullException(nameof(collection)); } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] +#pragma warning disable CA1819 // Properties should not return arrays public T[] Items => collection.ToArray(); +#pragma warning restore CA1819 // Properties should not return arrays } } diff --git a/Source/AtCoderLibrary/STL/Deque.cs b/Source/AtCoderLibrary/STL/Deque.cs index 247718ba..e947b03f 100644 --- a/Source/AtCoderLibrary/STL/Deque.cs +++ b/Source/AtCoderLibrary/STL/Deque.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using AtCoder.Internal; @@ -11,10 +12,18 @@ namespace AtCoder [DebuggerDisplay("Count = {" + nameof(Count) + "}")] public class Deque : IEnumerable, IReadOnlyCollection, ICollection { - internal T[] data; - internal int mask; - internal int head; - internal int tail; + + [EditorBrowsable(EditorBrowsableState.Never)] + public T[] data; + + [EditorBrowsable(EditorBrowsableState.Never)] + public int mask; + + [EditorBrowsable(EditorBrowsableState.Never)] + public int head; + + [EditorBrowsable(EditorBrowsableState.Never)] + public int tail; public Deque() : this(8) { } public Deque(int capacity) @@ -60,7 +69,8 @@ public void AddLast(T item) if (head == tail) Resize(); } - private void Resize() + [EditorBrowsable(EditorBrowsableState.Never)] + public void Resize() { var oldSize = data.Length; var newArray = new T[oldSize << 1]; @@ -122,7 +132,7 @@ public struct Enumerator : IEnumerator, IEnumerable int index; public readonly int last; public T Current => deque.data[index]; - internal Enumerator(Deque deque, bool isReverse) + public Enumerator(Deque deque, bool isReverse) { this.deque = deque; this.isReverse = isReverse; diff --git a/Source/AtCoderLibrary/SourceExpander.Embedder.Config.json b/Source/AtCoderLibrary/SourceExpander.Embedder.Config.json index 1d7c5190..5f871e2f 100644 --- a/Source/AtCoderLibrary/SourceExpander.Embedder.Config.json +++ b/Source/AtCoderLibrary/SourceExpander.Embedder.Config.json @@ -14,6 +14,7 @@ "System.Diagnostics.DebuggerStepThroughAttribute", "System.Diagnostics.DebuggerTypeProxyAttribute", "System.Diagnostics.DebuggerVisualizerAttribute", + "System.ComponentModel.EditorBrowsableAttribute", "AtCoder.IsOperatorAttribute" ] } \ No newline at end of file diff --git a/Source/AtCoderLibrary/Util/DebugUtil.cs b/Source/AtCoderLibrary/Util/DebugUtil.cs index d70f2464..0a28b567 100644 --- a/Source/AtCoderLibrary/Util/DebugUtil.cs +++ b/Source/AtCoderLibrary/Util/DebugUtil.cs @@ -1,9 +1,12 @@ using System; +using System.ComponentModel; using System.Diagnostics; namespace AtCoder.Internal { - internal static class DebugUtil + + [EditorBrowsable(EditorBrowsableState.Never)] + public static class DebugUtil { /// /// if is false, throw exception.