@see Predicates#compose(Predicate, Function)
| 648 | /** @see Predicates#compose(Predicate, Function) */ |
| 649 | |
| 650 | private static class CompositionPredicate<A, B> implements Predicate<A>, Serializable { |
| 651 | final Predicate<B> p; |
| 652 | final Function<A, ? extends B> f; |
| 653 | private CompositionPredicate(Predicate<B> p, Function<A, ? extends B> f) { |
| 654 | this.p = checkNotNull(p); |
| 655 | this.f = checkNotNull(f); |
| 656 | } |
| 657 | |
| 658 | @Override |
| 659 | public boolean apply(@Nullable A a) { |
| 660 | return p.apply(f.apply(a)); |
| 661 | } |
| 662 | |
| 663 | @Override |
| 664 | public boolean equals(@Nullable Object obj) { |
| 665 | if (obj instanceof CompositionPredicate) { |
| 666 | CompositionPredicate<?, ?> that = (CompositionPredicate<?, ?>) obj; |
| 667 | return f.equals(that.f) && p.equals(that.p); |
| 668 | } |
| 669 | return false; |
| 670 | } |
| 671 | |
| 672 | @Override |
| 673 | public int hashCode() { |
| 674 | return f.hashCode() ^ p.hashCode(); |
| 675 | } |
| 676 | |
| 677 | @Override |
| 678 | public String toString() { |
| 679 | // TODO(cpovirk): maybe make this look like the method call does ("Predicates.compose(...)") |
| 680 | return p + "(" + f + ")"; |
| 681 | } |
| 682 | |
| 683 | private static final long serialVersionUID = 0; |
| 684 | } |
| 685 | |
| 686 | /** @see Predicates#contains(Pattern) */ |
| 687 |
nothing calls this directly
no outgoing calls
no test coverage detected