Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
 public static bool IsIndividual(this SequencePredicate predicate)
 {
     return(!predicate.IsHollistic());
 }
Exemplo n.º 5
0
 public static bool IsNegative(this SequencePredicate predicate)
 {
     return(!predicate.IsPositive());
 }