Skip to content

Commit

Permalink
Merge pull request #12 from naminodarie/feature/editor_browsable
Browse files Browse the repository at this point in the history
Use EditorBrowsable(EditorBrowsableState.Never)
  • Loading branch information
kzrnm authored Dec 18, 2020
2 parents 6b23d21 + fd94a98 commit d896c6d
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions Source/AtCoderLibrary/DataStructure/FenwickTree.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using AtCoder.Internal;

Expand All @@ -24,7 +25,9 @@ public class FenwickTree<TValue, TOp>
where TOp : struct, IArithmeticOperator<TValue>
{
private static readonly TOp op = default;
internal readonly TValue[] data;

[EditorBrowsable(EditorBrowsableState.Never)]
public readonly TValue[] data;

public int Length { get; }

Expand Down Expand Up @@ -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))
Expand Down
19 changes: 14 additions & 5 deletions Source/AtCoderLibrary/DataStructure/LazySegtree.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using AtCoder.Internal;
Expand Down Expand Up @@ -60,8 +61,10 @@ public class LazySegtree<TValue, F, TOp> 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;


/// <summary>
Expand Down Expand Up @@ -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]);
Expand All @@ -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]);
Expand Down
8 changes: 6 additions & 2 deletions Source/AtCoderLibrary/DataStructure/Segtree.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using AtCoder.Internal;
Expand Down Expand Up @@ -47,7 +48,9 @@ public class Segtree<TValue, TOp> where TOp : struct, ISegtreeOperator<TValue>

internal readonly int log;
internal readonly int size;
internal readonly TValue[] d;

[EditorBrowsable(EditorBrowsableState.Never)]
public readonly TValue[] d;


/// <summary>
Expand Down Expand Up @@ -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]);

/// <summary>
/// a[<paramref name="p"/>] を返します。
Expand Down
5 changes: 4 additions & 1 deletion Source/AtCoderLibrary/Graph/DSU.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System.Collections.Generic;
using System.ComponentModel;
using AtCoder.Internal;

namespace AtCoder
{
public class DSU
{
internal readonly int _n;
internal readonly int[] _parentOrSize;

[EditorBrowsable(EditorBrowsableState.Never)]
public readonly int[] _parentOrSize;

/// <summary>
/// <see cref="DSU"/> クラスの新しいインスタンスを、<paramref name="n"/> 頂点 0 辺のグラフとして初期化します。
Expand Down
7 changes: 6 additions & 1 deletion Source/AtCoderLibrary/Internal/CollectionDebugView.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.Internal
{
internal class CollectionDebugView<T>

[EditorBrowsable(EditorBrowsableState.Never)]
public class CollectionDebugView<T>
{
private readonly IEnumerable<T> collection;
public CollectionDebugView(IEnumerable<T> 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
}
}
22 changes: 16 additions & 6 deletions Source/AtCoderLibrary/STL/Deque.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,10 +12,18 @@ namespace AtCoder
[DebuggerDisplay("Count = {" + nameof(Count) + "}")]
public class Deque<T> : IEnumerable<T>, IReadOnlyCollection<T>, ICollection<T>
{
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)
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -122,7 +132,7 @@ public struct Enumerator : IEnumerator<T>, IEnumerable<T>
int index;
public readonly int last;
public T Current => deque.data[index];
internal Enumerator(Deque<T> deque, bool isReverse)
public Enumerator(Deque<T> deque, bool isReverse)
{
this.deque = deque;
this.isReverse = isReverse;
Expand Down
1 change: 1 addition & 0 deletions Source/AtCoderLibrary/SourceExpander.Embedder.Config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"System.Diagnostics.DebuggerStepThroughAttribute",
"System.Diagnostics.DebuggerTypeProxyAttribute",
"System.Diagnostics.DebuggerVisualizerAttribute",
"System.ComponentModel.EditorBrowsableAttribute",
"AtCoder.IsOperatorAttribute"
]
}
5 changes: 4 additions & 1 deletion Source/AtCoderLibrary/Util/DebugUtil.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// if <paramref name="condition"/> is false, throw exception.
Expand Down

0 comments on commit d896c6d

Please sign in to comment.