mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-03-26 01:52:41 -04:00
25 lines
1018 B
C#
25 lines
1018 B
C#
using Cleanuparr.Domain.Enums;
|
|
using Cleanuparr.Infrastructure.Features.Seeker.Selectors;
|
|
|
|
namespace Cleanuparr.Infrastructure.Features.Seeker;
|
|
|
|
/// <summary>
|
|
/// Factory that returns the appropriate item selector based on the configured strategy
|
|
/// </summary>
|
|
public static class ItemSelectorFactory
|
|
{
|
|
public static IItemSelector Create(SelectionStrategy strategy)
|
|
{
|
|
return strategy switch
|
|
{
|
|
SelectionStrategy.OldestSearchFirst => new OldestSearchFirstSelector(),
|
|
SelectionStrategy.OldestSearchWeighted => new OldestSearchWeightedSelector(),
|
|
SelectionStrategy.NewestFirst => new NewestFirstSelector(),
|
|
SelectionStrategy.NewestWeighted => new NewestWeightedSelector(),
|
|
SelectionStrategy.BalancedWeighted => new BalancedWeightedSelector(),
|
|
SelectionStrategy.Random => new RandomSelector(),
|
|
_ => throw new ArgumentOutOfRangeException(nameof(strategy), strategy, "Unknown selection strategy")
|
|
};
|
|
}
|
|
}
|