001package Torello.Java.Function; 002 003/** 004 * Function-Pointer 005 * <SPAN CLASS=TJF>Input:</SPAN> {@code A, B, C} 006 * <SPAN CLASS=TJF>Output:</SPAN> {@code boolean}. 007 * 008 * <BR /><BR /> 009 * <EMBED CLASS='external-html' DATA-FILE-ID=BIG_PREDICATE> 010 * <EMBED CLASS="globalDefs" DATA-Name='Tri Predicate' DATA-Number=three> 011 * 012 * @param <A> The type of the first input-parameter. 013 * @param <B> The type of the second input-parameter. 014 * @param <C> The type of the last input-parameter. 015 */ 016@FunctionalInterface 017public interface TriPredicate<A, B, C> 018{ 019 /** 020 * Evaluates {@code "this"} predicate on the given arguments. 021 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH> 022 * 023 * @param a the first input argument 024 * @param b the second input argument 025 * @param c the third input argument 026 * @return {@code TRUE} if the input arguments match the predicate, otherwise <B>FALSE</B> 027 */ 028 public boolean test(A a, B b, C c); 029 030 /** 031 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_AND_METHOD> 032 * @param other A predicate that will be logically-AND'ed with this predicate 033 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_AND_RETURN> 034 * @throws NullPointerException if parameter {@code 'other'} is null. 035 */ 036 default TriPredicate<A, B, C> and(TriPredicate<? super A, ? super B, ? super C> other) 037 { 038 if (other == null) 039 throw new NullPointerException("null has been passed to parameter 'other"); 040 041 return (A a, B b, C c) -> this.test(a, b, c) && other.test(a, b, c); 042 } 043 044 /** 045 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_NEGATE_METHOD> 046 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_NEGATE_RETURN> 047 */ 048 default TriPredicate<A, B, C> negate() 049 { return (A a, B b, C c) -> ! this.test(a, b, c); } 050 051 /** 052 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_OR_METHOD> 053 * @param other a predicate that will be logically-ORed with this predicate 054 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_OR_RETURN> 055 * @throws NullPointerException if parameter {@code 'other'} is null. 056 */ 057 default TriPredicate<A, B, C> or(TriPredicate<? super A, ? super B, ? super C> other) 058 { 059 if (other == null) 060 throw new NullPointerException("null has been passed to parameter 'other"); 061 062 return (A a, B b, C c) -> this.test(a, b, c) || other.test(a, b, c); 063 } 064}