Push project

This commit is contained in:
2026-01-07 22:41:11 +08:00
commit 794fb22492
103 changed files with 6658 additions and 0 deletions

20
Sorting/SortingService.cs Normal file
View File

@@ -0,0 +1,20 @@
using SortingModel.SortingAlgorithms;
using SortingModel.SortingAlgorithms.Interfaces;
namespace SortingModel
{
public class SortingService : ISortingService
{
private readonly ISortingAlgorithmFactory _factory;
public SortingService(ISortingAlgorithmFactory? factory = null) => this._factory = factory ?? new SortingAlgorithmFactory();
public IEnumerable<string> GetAvailableAlgorithmNames() => this._factory.GetAvailableAlgorithmNames();
public string SortText(string inputText, string strategy)
{
ISortingAlgorithm algorithm = this._factory.Create(strategy);
return algorithm.Sort(inputText);
}
}
}