diff --git a/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj b/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj index 947caa6..fe63590 100644 --- a/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj +++ b/src/CatLib.Core.NetStandard/CatLib.Core.NetStandard.csproj @@ -106,7 +106,6 @@ - diff --git a/src/CatLib.Core/CatLib.Core.csproj b/src/CatLib.Core/CatLib.Core.csproj index 98b3c29..7f0cd79 100644 --- a/src/CatLib.Core/CatLib.Core.csproj +++ b/src/CatLib.Core/CatLib.Core.csproj @@ -106,7 +106,6 @@ - diff --git a/src/CatLib.Core/Support/SortSet/ISortSet.cs b/src/CatLib.Core/Support/SortSet/ISortSet.cs deleted file mode 100644 index ad23f50..0000000 --- a/src/CatLib.Core/Support/SortSet/ISortSet.cs +++ /dev/null @@ -1,185 +0,0 @@ -/* - * This file is part of the CatLib package. - * - * (c) CatLib - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * Document: https://catlib.io/ - */ - -using System; -using System.Collections.Generic; - -namespace CatLib -{ - /// - /// 有序集 - /// - /// 元素 - /// 分数 - public interface ISortSet : IEnumerable - { - /// - /// 有序集的基数 - /// - int Count { get; } - - /// - /// 同步锁 - /// - object SyncRoot { get; } - - /// - /// 清空SortSet - /// - void Clear(); - - /// - /// 插入记录 - /// - /// 元素 - /// 分数 - void Add(TElement element, TScore score); - - /// - /// 是否包含某个元素 - /// - /// 元素 - bool Contains(TElement element); - - /// - /// 返回有序集的分数 - /// - /// 元素 - /// 分数,如果元素不存在则引发异常 - /// 不存在时引发 - /// null时引发 - TScore GetScore(TElement element); - - /// - /// 获取分数范围内的元素个数 - /// - /// 起始值(包含) - /// 结束值(包含) - /// 分数值在(包含)和(包含)之间的元素数量 - int GetRangeCount(TScore start, TScore end); - - /// - /// 从有序集中删除元素,如果元素不存在返回false - /// - /// 元素 - /// 是否成功 - bool Remove(TElement element); - - /// - /// 根据排名区间移除区间内的元素 - /// - /// 开始的排名(包含),排名以0为底 - /// 结束的排名(包含),排名以0为底 - /// 被删除的元素个数 - int RemoveRangeByRank(int startRank, int stopRank); - - /// - /// 根据分数区间移除区间内的元素 - /// - /// 开始的分数(包含) - /// 结束的分数(包含) - /// 被删除的元素个数 - int RemoveRangeByScore(TScore startScore, TScore stopScore); - - /// - /// 获取排名 , 有序集成员按照Score从小到大排序 - /// - /// 元素 - /// 排名排名以0为底,为-1则表示没有找到元素 - int GetRank(TElement element); - - /// - /// 获取排名,有序集成员按照Score从大到小排序 - /// - /// - /// 排名排名以0为底 , 为-1则表示没有找到元素 - int GetRevRank(TElement element); - - /// - /// 根据排名区间获取区间内的所有元素 - /// - /// 开始的排名(包含),排名以0为底 - /// 结束的排名(包含),排名以0为底 - /// 元素列表 - TElement[] GetElementRangeByRank(int startRank, int stopRank); - - /// - /// 根据分数区间获取区间内的所有元素 - /// - /// 开始的分数(包含) - /// 结束的分数(包含) - /// 元素列表 - TElement[] GetElementRangeByScore(TScore startScore, TScore stopScore); - - /// - /// 根据排名获取元素 (有序集成员按照Score从小到大排序) - /// - /// 排名,排名以0为底 - /// 元素 - TElement GetElementByRank(int rank); - - /// - /// 根据排名获取元素 (有序集成员按照Score从大到小排序) - /// - /// 排名,排名以0为底 - /// 元素 - TElement GetElementByRevRank(int rank); - - /// - /// 反转遍历顺序(并不是反转整个有序集) - /// - void ReverseIterator(); - - /// - /// 反转遍历顺序(并不是反转整个有序集) - /// - /// 指定的反转顺序 - void ReverseIterator(bool forward); - - /// - /// 获取第一个元素 - /// - /// 第一个元素 - TElement First(); - - /// - /// 获取最后一个元素 - /// - /// 最后一个元素 - TElement Last(); - - /// - /// 移除并返回有序集头部的元素 - /// - /// 元素 - TElement Shift(); - - /// - /// 移除并返回有序集尾部的元素 - /// - /// 元素 - TElement Pop(); - - /// - /// 获取指定排名的元素(有序集成员按照Score从小到大排序) - /// - /// 排名,排名以0为底 - /// 指定的元素 - TElement this[int rank] { get; } - - /// - /// 转为数组 - /// - /// 元素数组 - TElement[] ToArray(); - } -} - diff --git a/src/CatLib.Core/Support/SortSet/SortSet.cs b/src/CatLib.Core/Support/SortSet/SortSet.cs index 27b7de8..ef4c8ee 100644 --- a/src/CatLib.Core/Support/SortSet/SortSet.cs +++ b/src/CatLib.Core/Support/SortSet/SortSet.cs @@ -20,7 +20,7 @@ namespace CatLib /// Ordered set /// [DebuggerDisplay("Count = {" + nameof(Count) + "}")] - public sealed class SortSet : ISortSet + public sealed class SortSet : IEnumerable where TScore : IComparable { ///