public static bool IsHollistic(this SequencePredicate predicate) { switch (predicate) { case SequencePredicate.Any: case SequencePredicate.NotAll: return(false); case SequencePredicate.All: case SequencePredicate.None: return(true); default: throw predicate.Unexpected(); } }
public static SequencePredicate Negative(this SequencePredicate predicate) { switch (predicate) { case SequencePredicate.Any: return(SequencePredicate.None); case SequencePredicate.All: return(SequencePredicate.NotAll); case SequencePredicate.None: return(SequencePredicate.None); case SequencePredicate.NotAll: return(SequencePredicate.NotAll); default: throw predicate.Unexpected(); } }
public static bool Predicate <T>(this IEnumerable <T> source, Func <T, bool> predicate, SequencePredicate predicateType) { switch (predicateType) { case SequencePredicate.Any: return(source.Any(predicate)); case SequencePredicate.All: return(source.All(predicate)); case SequencePredicate.None: return(source.None(predicate)); case SequencePredicate.NotAll: return(source.NotAll(predicate)); default: throw predicateType.Unexpected(); } }
public static bool IsIndividual(this SequencePredicate predicate) { return(!predicate.IsHollistic()); }
public static bool IsNegative(this SequencePredicate predicate) { return(!predicate.IsPositive()); }