aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/Collections/IntervalTree.cs
diff options
context:
space:
mode:
authorBerkan Diler <berkan.diler1@ingka.ikea.com>2022-12-27 20:27:11 +0100
committerGitHub <noreply@github.com>2022-12-27 20:27:11 +0100
commit0d3b82477ecbf7128340b6725a79413427c68748 (patch)
tree2d62c68e38a3c4c79ef7cc1d92700617a40e70ca /Ryujinx.Common/Collections/IntervalTree.cs
parent470be03c2ff22346a1f0ae53fa25f53c4d1790b5 (diff)
Use new ArgumentNullException and ObjectDisposedException throw-helper API (#4163)1.1.493
Diffstat (limited to 'Ryujinx.Common/Collections/IntervalTree.cs')
-rw-r--r--Ryujinx.Common/Collections/IntervalTree.cs49
1 files changed, 10 insertions, 39 deletions
diff --git a/Ryujinx.Common/Collections/IntervalTree.cs b/Ryujinx.Common/Collections/IntervalTree.cs
index c829caba..b5188cc7 100644
--- a/Ryujinx.Common/Collections/IntervalTree.cs
+++ b/Ryujinx.Common/Collections/IntervalTree.cs
@@ -24,10 +24,7 @@ namespace Ryujinx.Common.Collections
/// <exception cref="ArgumentNullException"><paramref name="key"/> is null</exception>
public int Get(K key, ref V[] overlaps)
{
- if (key == null)
- {
- throw new ArgumentNullException(nameof(key));
- }
+ ArgumentNullException.ThrowIfNull(key);
IntervalTreeNode<K, V> node = GetNode(key);
@@ -61,15 +58,8 @@ namespace Ryujinx.Common.Collections
/// <exception cref="ArgumentNullException"><paramref name="start"/> or <paramref name="end"/> is null</exception>
public int Get(K start, K end, ref V[] overlaps, int overlapCount = 0)
{
- if (start == null)
- {
- throw new ArgumentNullException(nameof(start));
- }
-
- if (end == null)
- {
- throw new ArgumentNullException(nameof(end));
- }
+ ArgumentNullException.ThrowIfNull(start);
+ ArgumentNullException.ThrowIfNull(end);
GetValues(Root, start, end, ref overlaps, ref overlapCount);
@@ -85,20 +75,9 @@ namespace Ryujinx.Common.Collections
/// <exception cref="ArgumentNullException"><paramref name="start"/>, <paramref name="end"/> or <paramref name="value"/> are null</exception>
public void Add(K start, K end, V value)
{
- if (start == null)
- {
- throw new ArgumentNullException(nameof(start));
- }
-
- if (end == null)
- {
- throw new ArgumentNullException(nameof(end));
- }
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
+ ArgumentNullException.ThrowIfNull(start);
+ ArgumentNullException.ThrowIfNull(end);
+ ArgumentNullException.ThrowIfNull(value);
Insert(start, end, value);
}
@@ -112,10 +91,7 @@ namespace Ryujinx.Common.Collections
/// <returns>Number of deleted values</returns>
public int Remove(K key, V value)
{
- if (key == null)
- {
- throw new ArgumentNullException(nameof(key));
- }
+ ArgumentNullException.ThrowIfNull(key);
int removed = Delete(key, value);
@@ -168,10 +144,7 @@ namespace Ryujinx.Common.Collections
/// <exception cref="ArgumentNullException"><paramref name="key"/> is null</exception>
private IntervalTreeNode<K, V> GetNode(K key)
{
- if (key == null)
- {
- throw new ArgumentNullException(nameof(key));
- }
+ ArgumentNullException.ThrowIfNull(key);
IntervalTreeNode<K, V> node = Root;
while (node != null)
@@ -462,10 +435,8 @@ namespace Ryujinx.Common.Collections
public bool ContainsKey(K key)
{
- if (key == null)
- {
- throw new ArgumentNullException(nameof(key));
- }
+ ArgumentNullException.ThrowIfNull(key);
+
return GetNode(key) != null;
}
}