sharee.bike-App/TINKLib/Model/Connector/Filter/GroupFilterFactory.cs

26 lines
817 B
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using System.Collections.Generic;
2021-06-26 20:57:55 +02:00
using System.Linq;
2021-05-13 20:03:07 +02:00
namespace TINK.Model.Connector.Filter
{
2022-09-06 16:08:19 +02:00
public static class GroupFilterFactory
{
/// <summary>
/// Creates filter object.
/// </summary>
/// <param name="group">if value consists
/// - list of strings entries are used to filter (intersect) with or if value is
/// - null or an empty list null filter is applied, i.e. filtering is off.</param>
/// <returns>Filtering object.</returns>
/// <remarks>
/// Tread group values of null and empty lists as marker to turn filtering off to handle COPRI responses maximal flexible.
/// </remarks>
public static IGroupFilter Create(IEnumerable<string> group)
{
return group != null && group.Count() > 0
? (IGroupFilter)new IntersectGroupFilter(group) :
new NullGroupFilter();
}
}
2021-05-13 20:03:07 +02:00
}