mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:17:27 +08:00
Use HashSet
instead of SortedSet
No need for it to be sorted.
This commit is contained in:
parent
77119b2cdb
commit
feaf59e15f
@ -257,7 +257,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var filterCriteria = new FilterCriteria();
|
var filterCriteria = new FilterCriteria();
|
||||||
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
||||||
Assert.Contains(BeatmapOnlineStatus.Ranked, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Ranked));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -269,7 +269,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
Assert.AreEqual("I want the pp", filterCriteria.SearchText.Trim());
|
Assert.AreEqual("I want the pp", filterCriteria.SearchText.Trim());
|
||||||
Assert.AreEqual(4, filterCriteria.SearchTerms.Length);
|
Assert.AreEqual(4, filterCriteria.SearchTerms.Length);
|
||||||
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
||||||
Assert.Contains(BeatmapOnlineStatus.Ranked, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Ranked));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -279,8 +279,8 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var filterCriteria = new FilterCriteria();
|
var filterCriteria = new FilterCriteria();
|
||||||
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
||||||
Assert.Contains(BeatmapOnlineStatus.Ranked, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Ranked));
|
||||||
Assert.Contains(BeatmapOnlineStatus.Loved, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Loved));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -290,10 +290,10 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
var filterCriteria = new FilterCriteria();
|
var filterCriteria = new FilterCriteria();
|
||||||
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
Assert.IsNotEmpty(filterCriteria.OnlineStatus.Values);
|
||||||
Assert.Contains(BeatmapOnlineStatus.Ranked, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Ranked));
|
||||||
Assert.Contains(BeatmapOnlineStatus.Approved, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Approved));
|
||||||
Assert.Contains(BeatmapOnlineStatus.Qualified, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Qualified));
|
||||||
Assert.Contains(BeatmapOnlineStatus.Loved, filterCriteria.OnlineStatus.Values);
|
Assert.That(filterCriteria.OnlineStatus.Values, Contains.Item(BeatmapOnlineStatus.Loved));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("creator")]
|
[TestCase("creator")]
|
||||||
|
@ -119,21 +119,15 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
public bool HasFilter => Values.Count > 0;
|
public bool HasFilter => Values.Count > 0;
|
||||||
|
|
||||||
public bool IsInRange(T value)
|
public bool IsInRange(T value) => Values.Contains(value);
|
||||||
{
|
|
||||||
return Values.Contains(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<T> Values = new SortedSet<T>();
|
public HashSet<T> Values = new HashSet<T>();
|
||||||
|
|
||||||
public OptionalSet()
|
public OptionalSet()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(OptionalSet<T> other)
|
public bool Equals(OptionalSet<T> other) => Values.SetEquals(other.Values);
|
||||||
{
|
|
||||||
return Values.SetEquals(other.Values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct OptionalRange<T> : IEquatable<OptionalRange<T>>
|
public struct OptionalRange<T> : IEquatable<OptionalRange<T>>
|
||||||
|
Loading…
Reference in New Issue
Block a user