| 1 | package com.github.dakusui.pcond.core.printable; | |
| 2 | ||
| 3 | import com.github.dakusui.pcond.core.Evaluable; | |
| 4 | import com.github.dakusui.pcond.core.Evaluator; | |
| 5 | import com.github.dakusui.pcond.experimentals.currying.context.CurriedContext; | |
| 6 | import com.github.dakusui.pcond.core.identifieable.Identifiable; | |
| 7 | import com.github.dakusui.pcond.forms.Predicates; | |
| 8 | import com.github.dakusui.pcond.internals.InternalUtils; | |
| 9 | ||
| 10 | import java.util.*; | |
| 11 | import java.util.function.BinaryOperator; | |
| 12 | import java.util.function.Function; | |
| 13 | import java.util.function.Predicate; | |
| 14 | import java.util.function.Supplier; | |
| 15 | import java.util.stream.Stream; | |
| 16 | ||
| 17 | import static com.github.dakusui.pcond.core.identifieable.Identifiable.argsOf; | |
| 18 | import static com.github.dakusui.pcond.core.identifieable.Identifiable.creatorOf; | |
| 19 | import static com.github.dakusui.pcond.internals.InternalUtils.*; | |
| 20 | import static java.lang.String.format; | |
| 21 | import static java.util.Arrays.asList; | |
| 22 | import static java.util.Collections.emptyList; | |
| 23 | import static java.util.Collections.singletonList; | |
| 24 | import static java.util.Objects.requireNonNull; | |
| 25 | import static java.util.stream.Collectors.joining; | |
| 26 | import static java.util.stream.Collectors.toList; | |
| 27 | ||
| 28 | public enum PrintablePredicateFactory { | |
| 29 | NEGATION, | |
| 30 | CONJUNCTION, | |
| 31 | DISJUNCTION, | |
| 32 | LEAF, | |
| 33 | ; | |
| 34 | ||
| 35 | private static <T> PrintablePredicate<T> toPrintablePredicateIfNotPrintable(Predicate<T> predicate) { | |
| 36 |
1
1. toPrintablePredicateIfNotPrintable : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::toPrintablePredicateIfNotPrintable → KILLED |
return (PrintablePredicate<T>) toLeafIfNotPrintable(predicate); |
| 37 | } | |
| 38 | ||
| 39 | public static <T> Predicate<T> toLeafIfNotPrintable(Predicate<T> predicate) { | |
| 40 |
1
1. toLeafIfNotPrintable : negated conditional → KILLED |
if (!(predicate instanceof PrintablePredicate)) |
| 41 |
1
1. toLeafIfNotPrintable : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::toLeafIfNotPrintable → KILLED |
return leaf(Identifiable.formatObjectName(predicate), predicate); |
| 42 |
1
1. toLeafIfNotPrintable : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::toLeafIfNotPrintable → KILLED |
return predicate; |
| 43 | } | |
| 44 | ||
| 45 | public static <T> Predicate<T> leaf(String name, Predicate<T> predicate) { | |
| 46 |
2
1. lambda$leaf$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::lambda$leaf$0 → KILLED 2. leaf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::leaf → KILLED |
return leaf(() -> name, predicate); |
| 47 | } | |
| 48 | ||
| 49 | public static <T> Predicate<T> leaf(Supplier<String> formatter, Predicate<T> predicate) { | |
| 50 |
1
1. leaf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::leaf → KILLED |
return leaf(formatter, predicate, PrintablePredicateFactory.class); |
| 51 | } | |
| 52 | ||
| 53 | public static <T> Predicate<T> leaf(Supplier<String> formatter, Predicate<T> predicate, Object fallbackCreator) { | |
| 54 |
1
1. leaf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::leaf → KILLED |
return parameterizedLeaf( |
| 55 |
1
1. lambda$leaf$1 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::lambda$leaf$1 → KILLED |
(args) -> formatter, |
| 56 |
1
1. lambda$leaf$2 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::lambda$leaf$2 → KILLED |
(args) -> predicate, |
| 57 | emptyList(), | |
| 58 | fallbackCreator); | |
| 59 | } | |
| 60 | ||
| 61 | public static <T> Predicate<T> parameterizedLeaf( | |
| 62 | Function<List<Object>, Supplier<String>> formatterFactory, | |
| 63 | Function<List<Object>, Predicate<T>> predicateFactory, | |
| 64 | List<Object> args, | |
| 65 | Object fallbackCreator | |
| 66 | ) { | |
| 67 | Supplier<String> formatter = formatterFactory.apply(args); | |
| 68 | Predicate<T> predicate = predicateFactory.apply(args); | |
| 69 |
1
1. parameterizedLeaf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::parameterizedLeaf → KILLED |
return creatorOf(predicate) |
| 70 |
1
1. lambda$parameterizedLeaf$3 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::lambda$parameterizedLeaf$3 → KILLED |
.map(c -> new LeafPredicate<>(c, argsOf(predicate), formatter, predicate)) |
| 71 | .orElse(new LeafPredicate<>(fallbackCreator, args, formatter, predicate)); | |
| 72 | } | |
| 73 | ||
| 74 | public static <P, O> TransformingPredicate.Factory<P, O> transform(Function<O, P> function) { | |
| 75 |
1
1. transform : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::transform → KILLED |
return TransformingPredicate.Factory.create(function); |
| 76 | } | |
| 77 | ||
| 78 | public static <T> Conjunction<T> and(List<Predicate<? super T>> predicates) { | |
| 79 |
1
1. and : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::and → KILLED |
return new Conjunction<T>(predicates, true); |
| 80 | } | |
| 81 | ||
| 82 | public static <T> Disjunction<T> or(List<Predicate<? super T>> predicates) { | |
| 83 |
1
1. or : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::or → KILLED |
return new Disjunction<T>(predicates, true); |
| 84 | } | |
| 85 | ||
| 86 | public static <T> Conjunction<T> allOf(List<Predicate<? super T>> predicates) { | |
| 87 |
1
1. allOf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::allOf → KILLED |
return new Conjunction<T>(predicates, false); |
| 88 | } | |
| 89 | ||
| 90 | public static <T> Disjunction<T> anyOf(List<Predicate<? super T>> predicates) { | |
| 91 |
1
1. anyOf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::anyOf → KILLED |
return new Disjunction<T>(predicates, false); |
| 92 | } | |
| 93 | ||
| 94 | public static <T> Predicate<T> not(Predicate<T> predicate) { | |
| 95 |
1
1. not : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::not → KILLED |
return not_(predicate); |
| 96 | } | |
| 97 | ||
| 98 | public static <T> Negation<T> not_(Predicate<T> predicate) { | |
| 99 |
1
1. not_ : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::not_ → KILLED |
return new Negation<T>(toPrintablePredicateIfNotPrintable(predicate), singletonList(predicate)); |
| 100 | } | |
| 101 | ||
| 102 | public static <E> Predicate<Stream<E>> allMatch(Predicate<E> predicate) { | |
| 103 |
1
1. allMatch : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::allMatch → KILLED |
return AllMatch.create(predicate); |
| 104 | } | |
| 105 | ||
| 106 | public static <E> Predicate<Stream<E>> noneMatch(Predicate<E> predicate) { | |
| 107 |
1
1. noneMatch : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::noneMatch → KILLED |
return NoneMatch.create(predicate); |
| 108 | } | |
| 109 | ||
| 110 | public static <E> Predicate<Stream<E>> anyMatch(Predicate<E> predicate) { | |
| 111 |
1
1. anyMatch : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::anyMatch → KILLED |
return AnyMatch.create(predicate); |
| 112 | } | |
| 113 | ||
| 114 | public static <T> Predicate<CurriedContext> variableBundlePredicate(Predicate<T> predicate, int argIndex) { | |
| 115 |
1
1. variableBundlePredicate : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory::variableBundlePredicate → KILLED |
return CurriedContextPredicate.create(toPrintablePredicateIfNotPrintable(predicate), argIndex); |
| 116 | } | |
| 117 | ||
| 118 | private static RuntimeException noPredicateGiven() { | |
| 119 | throw new IllegalArgumentException("No predicate was given"); | |
| 120 | } | |
| 121 | ||
| 122 | /* | |
| 123 | Expected: "100 -> && -> false" | |
| 124 | but: was "100 -> && -> false" | |
| 125 | */ | |
| 126 | public enum Leaf { | |
| 127 |
1
1. lambda$static$0 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$0 → KILLED |
ALWAYS_TRUE("alwaysTrue", v -> true), |
| 128 |
2
1. lambda$static$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$1 → KILLED 2. lambda$static$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$1 → KILLED |
IS_TRUE("isTrue", (Boolean v) -> v), |
| 129 |
2
1. lambda$static$2 : negated conditional → KILLED 2. lambda$static$2 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$2 → KILLED |
IS_FALSE("isFalse", (Boolean v) -> !v), |
| 130 | IS_NULL("isNull", Objects::isNull), | |
| 131 | IS_NOT_NULL("isNotNull", Objects::nonNull), | |
| 132 |
2
1. lambda$static$3 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$3 → KILLED 2. lambda$static$3 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$3 → KILLED |
IS_EMPTY_STRING("isEmpty", v -> ((String) v).isEmpty()), |
| 133 |
3
1. lambda$static$4 : negated conditional → KILLED 2. lambda$static$4 : negated conditional → KILLED 3. lambda$static$4 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$4 → KILLED |
IS_NULL_OR_EMPTY_STRING("isNullOrEmptyString", v -> v == null || ((String) v).isEmpty()), |
| 134 |
2
1. lambda$static$5 : negated conditional → KILLED 2. lambda$static$5 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$5 → KILLED |
IS_EMPTY_ARRAY("isEmptyArray", objects -> ((Object[]) objects).length == 0), |
| 135 |
2
1. lambda$static$6 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$6 → KILLED 2. lambda$static$6 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$static$6 → KILLED |
IS_EMPTY_COLLECTION("isEmpty", v -> ((Collection<?>) v).isEmpty()), |
| 136 | ; | |
| 137 | final Predicate<?> instance; | |
| 138 | ||
| 139 | @SuppressWarnings("unchecked") | |
| 140 | Leaf(String s, Predicate<?> predicate) { | |
| 141 |
1
1. lambda$new$7 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::lambda$new$7 → KILLED |
this.instance = leaf(() -> s, (Predicate<? super Object>) predicate, this); |
| 142 | } | |
| 143 | ||
| 144 | @SuppressWarnings("unchecked") | |
| 145 | public <T> Predicate<T> instance() { | |
| 146 |
1
1. instance : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Leaf::instance → KILLED |
return (Predicate<T>) this.instance; |
| 147 | } | |
| 148 | } | |
| 149 | ||
| 150 | public enum ParameterizedLeafFactory { | |
| 151 | IS_EQUAL_TO( | |
| 152 |
2
1. lambda$null$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$0 → KILLED 2. lambda$static$1 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$1 → KILLED |
(args) -> () -> format("isEqualTo[%s]", args.get(0)), |
| 153 |
3
1. lambda$null$2 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$2 → KILLED 2. lambda$null$2 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$2 → KILLED 3. lambda$static$3 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$3 → KILLED |
(args) -> v -> Objects.equals(v, args.get(0))), |
| 154 | @SuppressWarnings("unchecked") GREATER_THAN( | |
| 155 |
2
1. lambda$null$4 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$4 → KILLED 2. lambda$static$5 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$5 → KILLED |
(args) -> () -> format(">[%s]", args.get(0)), |
| 156 |
4
1. lambda$null$6 : changed conditional boundary → KILLED 2. lambda$null$6 : negated conditional → KILLED 3. lambda$null$6 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$6 → KILLED 4. lambda$static$7 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$7 → KILLED |
(args) -> v -> ((Comparable<? super Comparable<?>>) v).compareTo((Comparable<? super Comparable<?>>) args.get(0)) > 0), |
| 157 | @SuppressWarnings("unchecked") GREATER_THAN_OR_EQUAL_TO( | |
| 158 |
2
1. lambda$null$8 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$8 → KILLED 2. lambda$static$9 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$9 → KILLED |
(args) -> () -> format(">=[%s]", args.get(0)), |
| 159 |
4
1. lambda$null$10 : changed conditional boundary → KILLED 2. lambda$null$10 : negated conditional → KILLED 3. lambda$null$10 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$10 → KILLED 4. lambda$static$11 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$11 → KILLED |
(args) -> v -> ((Comparable<? super Comparable<?>>) v).compareTo((Comparable<? super Comparable<?>>) args.get(0)) >= 0), |
| 160 | @SuppressWarnings("unchecked") LESS_THAN_OR_EQUAL_TO( | |
| 161 |
2
1. lambda$null$12 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$12 → KILLED 2. lambda$static$13 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$13 → KILLED |
(args) -> () -> format("<=[%s]", args.get(0)), |
| 162 |
4
1. lambda$null$14 : changed conditional boundary → KILLED 2. lambda$null$14 : negated conditional → KILLED 3. lambda$null$14 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$14 → KILLED 4. lambda$static$15 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$15 → KILLED |
(args) -> v -> ((Comparable<? super Comparable<?>>) v).compareTo((Comparable<? super Comparable<?>>) args.get(0)) <= 0), |
| 163 | @SuppressWarnings("unchecked") LESS_THAN( | |
| 164 |
2
1. lambda$null$16 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$16 → KILLED 2. lambda$static$17 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$17 → KILLED |
(args) -> () -> format("<[%s]", args.get(0)), |
| 165 |
4
1. lambda$null$18 : changed conditional boundary → KILLED 2. lambda$null$18 : negated conditional → KILLED 3. lambda$null$18 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$18 → KILLED 4. lambda$static$19 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$19 → KILLED |
(args) -> v -> ((Comparable<? super Comparable<?>>) v).compareTo((Comparable<? super Comparable<?>>) args.get(0)) < 0), |
| 166 | @SuppressWarnings("unchecked") EQUAL_TO( | |
| 167 |
2
1. lambda$null$20 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$20 → KILLED 2. lambda$static$21 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$21 → KILLED |
(args) -> () -> format("=[%s]", args.get(0)), |
| 168 |
3
1. lambda$null$22 : negated conditional → KILLED 2. lambda$null$22 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$22 → KILLED 3. lambda$static$23 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$23 → KILLED |
(args) -> v -> ((Comparable<? super Comparable<?>>) v).compareTo((Comparable<? super Comparable<?>>) args.get(0)) == 0), |
| 169 | MATCHES_REGEX( | |
| 170 |
2
1. lambda$null$24 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$24 → KILLED 2. lambda$static$25 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$25 → KILLED |
(args) -> () -> String.format("matchesRegex[%s]", args.get(0)), |
| 171 |
3
1. lambda$null$26 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$26 → KILLED 2. lambda$null$26 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$26 → KILLED 3. lambda$static$27 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$27 → KILLED |
(args) -> (s) -> ((String) s).matches((String) args.get(0))), |
| 172 | CONTAINS_STRING( | |
| 173 |
2
1. lambda$null$28 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$28 → KILLED 2. lambda$static$29 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$29 → KILLED |
(args) -> () -> format("containsString[%s]", args.get(0)), |
| 174 |
3
1. lambda$null$30 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$30 → KILLED 2. lambda$null$30 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$30 → KILLED 3. lambda$static$31 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$31 → KILLED |
(args) -> (s) -> ((String) s).contains((String) args.get(0))), |
| 175 | STARTS_WITH( | |
| 176 |
2
1. lambda$null$32 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$32 → KILLED 2. lambda$static$33 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$33 → KILLED |
(args) -> () -> format("startsWith[%s]", args.get(0)), |
| 177 |
3
1. lambda$null$34 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$34 → KILLED 2. lambda$null$34 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$34 → KILLED 3. lambda$static$35 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$35 → KILLED |
(args) -> (s) -> ((String) s).startsWith((String) args.get(0))), |
| 178 | ENDS_WITH( | |
| 179 |
2
1. lambda$null$36 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$36 → KILLED 2. lambda$static$37 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$37 → KILLED |
(args) -> () -> format("endsWith[%s]", args.get(0)), |
| 180 |
3
1. lambda$null$38 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$38 → KILLED 2. lambda$null$38 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$38 → KILLED 3. lambda$static$39 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$39 → KILLED |
(args) -> (s) -> ((String) s).endsWith((String) args.get(0))), |
| 181 | EQUALS_IGNORE_CASE( | |
| 182 |
2
1. lambda$null$40 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$40 → KILLED 2. lambda$static$41 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$41 → KILLED |
(args) -> () -> format("equalsIgnoreCase[%s]", args.get(0)), |
| 183 |
1
1. lambda$static$43 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$43 → KILLED |
(args) -> (s) -> { |
| 184 |
2
1. lambda$null$42 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$42 → KILLED 2. lambda$null$42 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$42 → KILLED |
return ((String) s).equalsIgnoreCase((String) args.get(0)); |
| 185 | }), | |
| 186 | OBJECT_IS_SAME_AS( | |
| 187 |
2
1. lambda$null$44 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$44 → KILLED 2. lambda$static$45 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$45 → KILLED |
arg -> () -> format("==[%s]", arg.get(0)), |
| 188 |
3
1. lambda$null$46 : negated conditional → KILLED 2. lambda$null$46 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$46 → KILLED 3. lambda$static$47 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$47 → KILLED |
args -> v -> v == args.get(0)), |
| 189 | CONTAINS( | |
| 190 |
2
1. lambda$null$48 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$48 → KILLED 2. lambda$static$49 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$49 → KILLED |
(args) -> () -> format("contains[%s]", args.get(0)), |
| 191 |
3
1. lambda$null$50 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$50 → KILLED 2. lambda$null$50 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$null$50 → KILLED 3. lambda$static$51 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::lambda$static$51 → KILLED |
(args) -> (c) -> ((Collection<?>) c).contains(args.get(0))); |
| 192 | private final Function<List<Object>, Predicate<Object>> predicateFactory; | |
| 193 | private final Function<List<Object>, Supplier<String>> formatterFactory; | |
| 194 | ||
| 195 | ParameterizedLeafFactory(Function<List<Object>, Supplier<String>> formatterFactory, Function<List<Object>, Predicate<Object>> predicateFactory) { | |
| 196 | this.predicateFactory = predicateFactory; | |
| 197 | this.formatterFactory = formatterFactory; | |
| 198 | } | |
| 199 | ||
| 200 | Function<List<Object>, Supplier<String>> formatterFactory() { | |
| 201 |
1
1. formatterFactory : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::formatterFactory → KILLED |
return this.formatterFactory; |
| 202 | } | |
| 203 | ||
| 204 | @SuppressWarnings({ "unchecked", "rawtypes" }) | |
| 205 | <T> Function<List<Object>, Predicate<T>> functionFactory() { | |
| 206 |
1
1. functionFactory : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::functionFactory → KILLED |
return (Function) this.predicateFactory; |
| 207 | } | |
| 208 | ||
| 209 | public static <T> Predicate<T> create(ParameterizedLeafFactory parameterizedLeafFactory, List<Object> args) { | |
| 210 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$ParameterizedLeafFactory::create → KILLED |
return parameterizedLeaf( |
| 211 | parameterizedLeafFactory.formatterFactory(), parameterizedLeafFactory.functionFactory(), args, parameterizedLeafFactory | |
| 212 | ); | |
| 213 | } | |
| 214 | } | |
| 215 | ||
| 216 | private static class LeafPredicate<T> extends PrintablePredicate<T> implements Evaluable.LeafPred<T>, Evaluator.Explainable { | |
| 217 | protected LeafPredicate(Object creator, List<Object> args, Supplier<String> formatter, Predicate<? super T> predicate) { | |
| 218 | super(creator, args, formatter, predicate); | |
| 219 | } | |
| 220 | ||
| 221 | @Override | |
| 222 | public Predicate<? super T> predicate() { | |
| 223 |
1
1. predicate : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$LeafPredicate::predicate → KILLED |
return predicate; |
| 224 | } | |
| 225 | ||
| 226 | @Override | |
| 227 | public Object explainOutputExpectation() { | |
| 228 |
1
1. explainOutputExpectation : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$LeafPredicate::explainOutputExpectation → KILLED |
return this.formatter.get(); |
| 229 | } | |
| 230 | ||
| 231 | @Override | |
| 232 | public Object explainActual(Object actualValue) { | |
| 233 |
1
1. explainActual : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$LeafPredicate::explainActual → SURVIVED |
return actualValue; |
| 234 | } | |
| 235 | ||
| 236 | @Override | |
| 237 | public String toString() { | |
| 238 |
1
1. toString : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$LeafPredicate::toString → KILLED |
return formatObject(toNonStringObject(this.formatter.get())); |
| 239 | } | |
| 240 | } | |
| 241 | ||
| 242 | static class Negation<T> extends PrintablePredicate<T> implements Evaluable.Negation<T> { | |
| 243 | final Evaluable<T> target; | |
| 244 | ||
| 245 | @SuppressWarnings("unchecked") | |
| 246 | protected Negation(Predicate<T> predicate, List<Object> args) { | |
| 247 | super( | |
| 248 | NEGATION, | |
| 249 | args, | |
| 250 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Negation::lambda$new$0 → KILLED |
() -> format("!%s", predicate), |
| 251 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Negation::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Negation::lambda$new$1 → KILLED |
(t) -> PrintablePredicate.unwrap((Predicate<Object>) predicate).negate().test(t)); |
| 252 | this.target = toEvaluableIfNecessary(predicate); | |
| 253 | this.squashable = true; | |
| 254 | } | |
| 255 | ||
| 256 | @Override | |
| 257 | public Evaluable<T> target() { | |
| 258 |
1
1. target : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Negation::target → KILLED |
return target; |
| 259 | } | |
| 260 | } | |
| 261 | ||
| 262 | public static class Conjunction<T> extends Junction<T> implements Evaluable.Conjunction<T> { | |
| 263 | protected Conjunction(List<Predicate<? super T>> predicates, boolean shortcut) { | |
| 264 | super( | |
| 265 | predicates, | |
| 266 | CONJUNCTION, | |
| 267 | "&&", | |
| 268 | Predicate::and, | |
| 269 | shortcut); | |
| 270 | } | |
| 271 | } | |
| 272 | ||
| 273 | public static class Disjunction<T> extends Junction<T> implements Evaluable.Disjunction<T> { | |
| 274 | protected Disjunction(List<Predicate<? super T>> predicates, boolean shortcut) { | |
| 275 | super( | |
| 276 | predicates, | |
| 277 | DISJUNCTION, | |
| 278 | "||", | |
| 279 | Predicate::or, | |
| 280 | shortcut); | |
| 281 | } | |
| 282 | } | |
| 283 | ||
| 284 | abstract static class Junction<T> extends PrintablePredicate<T> implements Evaluable.Composite<T> { | |
| 285 | final List<Evaluable<T>> children; | |
| 286 | final private boolean shortcut; | |
| 287 | ||
| 288 | @SuppressWarnings("unchecked") | |
| 289 | protected Junction( | |
| 290 | List<Predicate<? super T>> predicates, | |
| 291 | PrintablePredicateFactory creator, | |
| 292 | String junctionSymbol, | |
| 293 | BinaryOperator<Predicate<T>> junctionOp, boolean shortcut) { | |
| 294 | super( | |
| 295 | creator, | |
| 296 | new ArrayList<>(predicates), | |
| 297 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$new$0 → KILLED |
() -> formatJunction(predicates, junctionSymbol), |
| 298 | junction(predicates, junctionOp)); | |
| 299 | this.children = predicates.stream() | |
| 300 | .map(InternalUtils::toEvaluableIfNecessary) | |
| 301 |
1
1. lambda$new$1 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$new$1 → KILLED |
.map(each -> (Evaluable<T>) each) |
| 302 | .collect(toList()); | |
| 303 | this.shortcut = shortcut; | |
| 304 | } | |
| 305 | ||
| 306 | @Override | |
| 307 | public List<Evaluable<T>> children() { | |
| 308 |
1
1. children : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::children → KILLED |
return this.children; |
| 309 | } | |
| 310 | ||
| 311 | @Override | |
| 312 | public boolean shortcut() { | |
| 313 |
2
1. shortcut : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::shortcut → KILLED 2. shortcut : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::shortcut → KILLED |
return this.shortcut; |
| 314 | } | |
| 315 | ||
| 316 | public List<Predicate<T>> childPredicates() { | |
| 317 |
1
1. childPredicates : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::childPredicates → NO_COVERAGE |
return childrenOfJunction(this); |
| 318 | } | |
| 319 | ||
| 320 | static <T> String formatJunction(List<Predicate<? super T>> predicates, String junctionSymbol) { | |
| 321 |
1
1. formatJunction : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::formatJunction → KILLED |
return predicates.stream() |
| 322 |
1
1. lambda$formatJunction$2 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$formatJunction$2 → KILLED |
.map(PrintablePredicateFactory::toPrintablePredicateIfNotPrintable) |
| 323 | .map(Object::toString) | |
| 324 | .collect(joining(junctionSymbol, "(", ")")); | |
| 325 | } | |
| 326 | ||
| 327 | @SuppressWarnings("unchecked") | |
| 328 | static <T> Predicate<T> junction(List<Predicate<? super T>> predicates_, BinaryOperator<Predicate<T>> junctionOp) { | |
| 329 |
1
1. junction : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::junction → KILLED |
return predicates_ |
| 330 | .stream() | |
| 331 | .map(PrintablePredicate::unwrap) | |
| 332 |
1
1. lambda$junction$3 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$junction$3 → KILLED |
.map(p -> (Predicate<T>) p) |
| 333 | .reduce(junctionOp) | |
| 334 |
1
1. lambda$junction$4 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$junction$4 → NO_COVERAGE |
.orElseThrow(PrintablePredicateFactory::noPredicateGiven); |
| 335 | } | |
| 336 | ||
| 337 | static <T> List<Predicate<T>> childrenOfJunction(Junction<T> junction) { | |
| 338 |
1
1. childrenOfJunction : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::childrenOfJunction → NO_COVERAGE |
return evaluablesToPredicates(junction.children); |
| 339 | } | |
| 340 | ||
| 341 | @SuppressWarnings("unchecked") | |
| 342 | private static <T> List<Predicate<T>> evaluablesToPredicates(List<Evaluable<T>> evaluables) { | |
| 343 |
1
1. evaluablesToPredicates : replaced return value with Collections.emptyList for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::evaluablesToPredicates → NO_COVERAGE |
return evaluables.stream() |
| 344 | .peek(each -> { | |
| 345 | assert each instanceof Predicate; | |
| 346 | }) | |
| 347 |
1
1. lambda$evaluablesToPredicates$6 : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$Junction::lambda$evaluablesToPredicates$6 → NO_COVERAGE |
.map(each -> (Predicate<T>) each) |
| 348 | .collect(toList()); | |
| 349 | } | |
| 350 | } | |
| 351 | ||
| 352 | /** | |
| 353 | * This is an interface that corresponds to a "matcher" in other assertion | |
| 354 | * libraries. | |
| 355 | */ | |
| 356 | public static class TransformingPredicate<T, R> extends PrintablePredicate<T> implements Evaluable.Transformation<T, R> { | |
| 357 | private final Evaluable<? super T> mapper; | |
| 358 | private final Evaluable<? super R> checker; | |
| 359 | private final String mapperName; | |
| 360 | private final String checkerName; | |
| 361 | ||
| 362 | public TransformingPredicate(String mapperName, String checkerName, Predicate<? super R> predicate, Function<? super T, ? extends R> function) { | |
| 363 | super( | |
| 364 | TransformingPredicate.class, | |
| 365 | asList(predicate, function), | |
| 366 |
3
1. lambda$new$0 : negated conditional → KILLED 2. lambda$new$0 : negated conditional → KILLED 3. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::lambda$new$0 → KILLED |
() -> mapperName == null ? |
| 367 |
1
1. lambda$new$0 : negated conditional → KILLED |
format("%s %s", function, checkerName == null ? predicate : (checkerName + ":" + predicate.toString())) : |
| 368 | format("%s(%s %s)", mapperName, function, checkerName == null ? predicate : checkerName + ":" + predicate.toString()), | |
| 369 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::lambda$new$1 → KILLED |
v -> predicate.test(function.apply(v))); |
| 370 | this.mapper = toEvaluableIfNecessary(function); | |
| 371 | this.mapperName = mapperName; | |
| 372 | this.checker = toEvaluableIfNecessary(predicate); | |
| 373 | this.checkerName = checkerName; | |
| 374 | this.squashable = true; | |
| 375 | } | |
| 376 | ||
| 377 | @SuppressWarnings("unchecked") | |
| 378 | @Override | |
| 379 | public Evaluable<T> mapper() { | |
| 380 |
1
1. mapper : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::mapper → KILLED |
return (Evaluable<T>) this.mapper; |
| 381 | } | |
| 382 | ||
| 383 | @SuppressWarnings("unchecked") | |
| 384 | @Override | |
| 385 | public Evaluable<R> checker() { | |
| 386 |
1
1. checker : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::checker → KILLED |
return (Evaluable<R>) this.checker; |
| 387 | } | |
| 388 | ||
| 389 | @Override | |
| 390 | public Optional<String> mapperName() { | |
| 391 |
1
1. mapperName : replaced return value with Optional.empty for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::mapperName → SURVIVED |
return Optional.ofNullable(this.mapperName); |
| 392 | } | |
| 393 | ||
| 394 | @Override | |
| 395 | public Optional<String> checkerName() { | |
| 396 |
1
1. checkerName : replaced return value with Optional.empty for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate::checkerName → KILLED |
return Optional.ofNullable(this.checkerName); |
| 397 | } | |
| 398 | ||
| 399 | /** | |
| 400 | * This is an interface that corresponds to a "matcher" in other assertion | |
| 401 | * libraries. | |
| 402 | * | |
| 403 | * @param <P> Intermediate parameter type tested by a predicated. | |
| 404 | * @param <O> Input parameter type. | |
| 405 | */ | |
| 406 | public static abstract class Factory<P, O> { | |
| 407 | public abstract Predicate<O> check(String condName, Predicate<? super P> cond); | |
| 408 | ||
| 409 | @SuppressWarnings("unchecked") | |
| 410 | public <OO> Factory<P, OO> castTo(@SuppressWarnings("unused") Class<OO> ooClass) { | |
| 411 |
1
1. castTo : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory::castTo → KILLED |
return (Factory<P, OO>) this; |
| 412 | } | |
| 413 | | |
| 414 | public abstract Predicate<O> check(Predicate<? super P> cond); | |
| 415 | | |
| 416 | @SafeVarargs | |
| 417 | public final Predicate<O> checkAllOf(Predicate<? super P>... conds) { | |
| 418 |
1
1. checkAllOf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory::checkAllOf → NO_COVERAGE |
return check(Predicates.allOf(conds)); |
| 419 | } | |
| 420 | @SafeVarargs | |
| 421 | public final Predicate<O> allOf(Predicate<? super P>... conds) { | |
| 422 |
1
1. allOf : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory::allOf → NO_COVERAGE |
return checkAllOf(conds); |
| 423 | } | |
| 424 | ||
| 425 | public static <P, O> Factory<P, O> create(Function<O, P> function) { | |
| 426 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory::create → KILLED |
return create(null, null, function); |
| 427 | } | |
| 428 | ||
| 429 | public static <P, O> Factory<P, O> create(String mapperName, String checkerName, Function<O, P> function) { | |
| 430 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory::create → KILLED |
return new Factory<P, O>() { |
| 431 | @Override | |
| 432 | public Predicate<O> check(String condName, Predicate<? super P> cond) { | |
| 433 |
1
1. check : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory$1::check → KILLED |
return new TransformingPredicate<>(mapperName, condName, cond, function); |
| 434 | } | |
| 435 | ||
| 436 | @Override | |
| 437 | public Predicate<O> check(Predicate<? super P> cond) { | |
| 438 |
1
1. check : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$TransformingPredicate$Factory$1::check → KILLED |
return new TransformingPredicate<>(mapperName, checkerName, toPrintablePredicateIfNotPrintable(cond), function); |
| 439 | } | |
| 440 | }; | |
| 441 | } | |
| 442 | } | |
| 443 | } | |
| 444 | ||
| 445 | static class CurriedContextPredicate extends PrintablePredicate<CurriedContext> implements Evaluable.CurriedContextPred { | |
| 446 | private final Evaluable<?> enclosed; | |
| 447 | private final int argIndex; | |
| 448 | ||
| 449 | private <T> CurriedContextPredicate(Object creator, List<Object> args, Predicate<T> predicate, int argIndex) { | |
| 450 | super( | |
| 451 | creator, | |
| 452 | args, | |
| 453 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::lambda$new$0 → KILLED |
() -> format("curry[%s,%s]", predicate, argIndex), |
| 454 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::lambda$new$1 → KILLED |
context -> PrintablePredicate.unwrap(predicate).test(context.valueAt(argIndex))); |
| 455 | this.enclosed = toEvaluableIfNecessary(predicate); | |
| 456 | this.argIndex = argIndex; | |
| 457 | ||
| 458 | } | |
| 459 | ||
| 460 | @SuppressWarnings("unchecked") | |
| 461 | @Override | |
| 462 | public <TT> Evaluable<TT> enclosed() { | |
| 463 |
1
1. enclosed : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::enclosed → KILLED |
return (Evaluable<TT>) this.enclosed; |
| 464 | } | |
| 465 | ||
| 466 | @Override | |
| 467 | public int argIndex() { | |
| 468 |
1
1. argIndex : replaced int return with 0 for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::argIndex → KILLED |
return argIndex; |
| 469 | } | |
| 470 | ||
| 471 | public static <T> CurriedContextPredicate create(Predicate<T> predicate, int argIndex) { | |
| 472 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$CurriedContextPredicate::create → KILLED |
return new CurriedContextPredicate(CurriedContextPredicate.class, asList(predicate, argIndex), predicate, argIndex); |
| 473 | } | |
| 474 | } | |
| 475 | ||
| 476 | static class AllMatch<E> extends StreamPredicate<E> { | |
| 477 | @SuppressWarnings("unchecked") | |
| 478 | private AllMatch(Predicate<? super E> predicate) { | |
| 479 | super( | |
| 480 | AllMatch.class, | |
| 481 | singletonList(predicate), | |
| 482 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AllMatch::lambda$new$0 → KILLED |
() -> format("allMatch[%s]", predicate), |
| 483 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AllMatch::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AllMatch::lambda$new$1 → KILLED |
(Stream<E> stream) -> stream.allMatch(predicate), |
| 484 | toEvaluableIfNecessary((Predicate<? super Stream<? extends E>>) predicate), | |
| 485 | true, | |
| 486 | false); | |
| 487 | } | |
| 488 | ||
| 489 | static <E> StreamPredicate<E> create(Predicate<? super E> predicate) { | |
| 490 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AllMatch::create → KILLED |
return new AllMatch<>( |
| 491 | predicate | |
| 492 | ); | |
| 493 | } | |
| 494 | } | |
| 495 | ||
| 496 | static class AnyMatch<E> extends StreamPredicate<E> { | |
| 497 | @SuppressWarnings("unchecked") | |
| 498 | private AnyMatch(Predicate<? super E> predicate) { | |
| 499 | super( | |
| 500 | AnyMatch.class, | |
| 501 | singletonList(predicate), | |
| 502 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AnyMatch::lambda$new$0 → KILLED |
() -> format("anyMatch[%s]", predicate), |
| 503 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AnyMatch::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AnyMatch::lambda$new$1 → KILLED |
(Stream<E> stream) -> stream.anyMatch(PrintablePredicate.unwrap(predicate)), |
| 504 | toEvaluableIfNecessary((Predicate<? super Stream<E>>) predicate), | |
| 505 | false, | |
| 506 | true); | |
| 507 | } | |
| 508 | ||
| 509 | public static <E> StreamPredicate<E> create(Predicate<? super E> predicate) { | |
| 510 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$AnyMatch::create → KILLED |
return new AnyMatch<>( |
| 511 | predicate | |
| 512 | ); | |
| 513 | } | |
| 514 | } | |
| 515 | ||
| 516 | static class NoneMatch<E> extends StreamPredicate<E> { | |
| 517 | @SuppressWarnings("unchecked") | |
| 518 | private NoneMatch(Predicate<? super E> predicate) { | |
| 519 | super( | |
| 520 | NoneMatch.class, | |
| 521 | singletonList(predicate), | |
| 522 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$NoneMatch::lambda$new$0 → KILLED |
() -> format("noneMatch[%s]", predicate), |
| 523 |
2
1. lambda$new$1 : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$NoneMatch::lambda$new$1 → KILLED 2. lambda$new$1 : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$NoneMatch::lambda$new$1 → KILLED |
(Stream<E> stream) -> stream.noneMatch(predicate), |
| 524 | toEvaluableIfNecessary((Predicate<? super Stream<E>>) predicate), | |
| 525 | true, | |
| 526 | true); | |
| 527 | } | |
| 528 | ||
| 529 | @Override | |
| 530 | public boolean requestExpectationFlip() { | |
| 531 |
1
1. requestExpectationFlip : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$NoneMatch::requestExpectationFlip → KILLED |
return true; |
| 532 | } | |
| 533 | ||
| 534 | public static <E> StreamPredicate<E> create(Predicate<E> predicate) { | |
| 535 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$NoneMatch::create → KILLED |
return new NoneMatch<E>( |
| 536 | predicate | |
| 537 | ) { | |
| 538 | }; | |
| 539 | } | |
| 540 | } | |
| 541 | ||
| 542 | public abstract static class StreamPredicate<E> extends PrintablePredicate<Stream<E>> implements Evaluable.StreamPred<E> { | |
| 543 | private final Evaluable<Stream<E>> cut; | |
| 544 | private final boolean defaultValue; | |
| 545 | private final boolean cutOn; | |
| 546 | ||
| 547 | private StreamPredicate(Object creator, List<Object> args, Supplier<String> formatter, Predicate<Stream<E>> predicate, Evaluable<Stream<E>> cut, boolean defaultValue, boolean cutOn) { | |
| 548 | super(creator, args, formatter, predicate); | |
| 549 | this.cut = requireNonNull(cut); | |
| 550 | this.defaultValue = defaultValue; | |
| 551 | this.cutOn = cutOn; | |
| 552 | } | |
| 553 | ||
| 554 | @Override | |
| 555 | public boolean defaultValue() { | |
| 556 |
2
1. defaultValue : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$StreamPredicate::defaultValue → KILLED 2. defaultValue : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$StreamPredicate::defaultValue → KILLED |
return defaultValue; |
| 557 | } | |
| 558 | ||
| 559 | @SuppressWarnings("unchecked") | |
| 560 | @Override | |
| 561 | public Evaluable<E> cut() { | |
| 562 |
1
1. cut : replaced return value with null for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$StreamPredicate::cut → KILLED |
return (Evaluable<E>) this.cut; |
| 563 | } | |
| 564 | ||
| 565 | @Override | |
| 566 | public boolean valueToCut() { | |
| 567 |
2
1. valueToCut : replaced boolean return with false for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$StreamPredicate::valueToCut → KILLED 2. valueToCut : replaced boolean return with true for com/github/dakusui/pcond/core/printable/PrintablePredicateFactory$StreamPredicate::valueToCut → KILLED |
return cutOn; |
| 568 | } | |
| 569 | } | |
| 570 | } | |
Mutations | ||
| 36 |
1.1 |
|
| 40 |
1.1 |
|
| 41 |
1.1 |
|
| 42 |
1.1 |
|
| 46 |
1.1 2.2 |
|
| 50 |
1.1 |
|
| 54 |
1.1 |
|
| 55 |
1.1 |
|
| 56 |
1.1 |
|
| 69 |
1.1 |
|
| 70 |
1.1 |
|
| 75 |
1.1 |
|
| 79 |
1.1 |
|
| 83 |
1.1 |
|
| 87 |
1.1 |
|
| 91 |
1.1 |
|
| 95 |
1.1 |
|
| 99 |
1.1 |
|
| 103 |
1.1 |
|
| 107 |
1.1 |
|
| 111 |
1.1 |
|
| 115 |
1.1 |
|
| 127 |
1.1 |
|
| 128 |
1.1 2.2 |
|
| 129 |
1.1 2.2 |
|
| 132 |
1.1 2.2 |
|
| 133 |
1.1 2.2 3.3 |
|
| 134 |
1.1 2.2 |
|
| 135 |
1.1 2.2 |
|
| 141 |
1.1 |
|
| 146 |
1.1 |
|
| 152 |
1.1 2.2 |
|
| 153 |
1.1 2.2 3.3 |
|
| 155 |
1.1 2.2 |
|
| 156 |
1.1 2.2 3.3 4.4 |
|
| 158 |
1.1 2.2 |
|
| 159 |
1.1 2.2 3.3 4.4 |
|
| 161 |
1.1 2.2 |
|
| 162 |
1.1 2.2 3.3 4.4 |
|
| 164 |
1.1 2.2 |
|
| 165 |
1.1 2.2 3.3 4.4 |
|
| 167 |
1.1 2.2 |
|
| 168 |
1.1 2.2 3.3 |
|
| 170 |
1.1 2.2 |
|
| 171 |
1.1 2.2 3.3 |
|
| 173 |
1.1 2.2 |
|
| 174 |
1.1 2.2 3.3 |
|
| 176 |
1.1 2.2 |
|
| 177 |
1.1 2.2 3.3 |
|
| 179 |
1.1 2.2 |
|
| 180 |
1.1 2.2 3.3 |
|
| 182 |
1.1 2.2 |
|
| 183 |
1.1 |
|
| 184 |
1.1 2.2 |
|
| 187 |
1.1 2.2 |
|
| 188 |
1.1 2.2 3.3 |
|
| 190 |
1.1 2.2 |
|
| 191 |
1.1 2.2 3.3 |
|
| 201 |
1.1 |
|
| 206 |
1.1 |
|
| 210 |
1.1 |
|
| 223 |
1.1 |
|
| 228 |
1.1 |
|
| 233 |
1.1 |
|
| 238 |
1.1 |
|
| 250 |
1.1 |
|
| 251 |
1.1 2.2 |
|
| 258 |
1.1 |
|
| 297 |
1.1 |
|
| 301 |
1.1 |
|
| 308 |
1.1 |
|
| 313 |
1.1 2.2 |
|
| 317 |
1.1 |
|
| 321 |
1.1 |
|
| 322 |
1.1 |
|
| 329 |
1.1 |
|
| 332 |
1.1 |
|
| 334 |
1.1 |
|
| 338 |
1.1 |
|
| 343 |
1.1 |
|
| 347 |
1.1 |
|
| 366 |
1.1 2.2 3.3 |
|
| 367 |
1.1 |
|
| 369 |
1.1 2.2 |
|
| 380 |
1.1 |
|
| 386 |
1.1 |
|
| 391 |
1.1 |
|
| 396 |
1.1 |
|
| 411 |
1.1 |
|
| 418 |
1.1 |
|
| 422 |
1.1 |
|
| 426 |
1.1 |
|
| 430 |
1.1 |
|
| 433 |
1.1 |
|
| 438 |
1.1 |
|
| 453 |
1.1 |
|
| 454 |
1.1 2.2 |
|
| 463 |
1.1 |
|
| 468 |
1.1 |
|
| 472 |
1.1 |
|
| 482 |
1.1 |
|
| 483 |
1.1 2.2 |
|
| 490 |
1.1 |
|
| 502 |
1.1 |
|
| 503 |
1.1 2.2 |
|
| 510 |
1.1 |
|
| 522 |
1.1 |
|
| 523 |
1.1 2.2 |
|
| 531 |
1.1 |
|
| 535 |
1.1 |
|
| 556 |
1.1 2.2 |
|
| 562 |
1.1 |
|
| 567 |
1.1 2.2 |