001package Torello.Java.Function; 002 003/** 004 * Function-Pointer 005 * <SPAN CLASS=TJF>Input:</SPAN> {@code A, B, C, D, E, F} 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='Hex Predicate' DATA-Number=six> 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 third input-parameter. 015 * @param <D> The type of the fourth input-parameter. 016 * @param <E> The type of the fifth input-parameter. 017 * @param <F> The type of the last input-parameter. 018 */ 019@FunctionalInterface 020public interface HexPredicate<A, B, C, D, E, F> 021{ 022 /** 023 * Evaluates {@code "this"} predicate on the given arguments. 024 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH> 025 * 026 * @param a the first input argument 027 * @param b the second input argument 028 * @param c the third input argument 029 * @param d the fourth input argument 030 * @param e the fifth input argument 031 * @param f the sixth input argument 032 * @return {@code TRUE} if the input arguments match the predicate, otherwise <B>FALSE</B> 033 */ 034 public boolean test(A a, B b, C c, D d, E e, F f); 035 036 /** 037 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_AND_METHOD> 038 * @param other A predicate that will be logically-AND'ed with this predicate 039 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_AND_RETURN> 040 * @throws NullPointerException if parameter {@code 'other'} is null. 041 */ 042 default HexPredicate<A, B, C, D, E, F> and 043 (HexPredicate<? super A, ? super B, ? super C, ? super D, ? super E, ? super F> other) 044 { 045 if (other == null) 046 throw new NullPointerException("null has been passed to parameter 'other"); 047 048 return (A a, B b, C c, D d, E e, F f) -> 049 this.test(a, b, c, d, e, f) && other.test(a, b, c, d, e, f); 050 } 051 052 /** 053 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_NEGATE_METHOD> 054 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_NEGATE_RETURN> 055 */ 056 default HexPredicate<A, B, C, D, E, F> negate() 057 { return (A a, B b, C c, D d, E e, F f) -> ! this.test(a, b, c, d, e, f); } 058 059 /** 060 * <EMBED CLASS='external-html' DATA-FILE-ID=PRED_OR_METHOD> 061 * @param other a predicate that will be logically-ORed with this predicate 062 * @return <EMBED CLASS='external-html' DATA-FILE-ID=PRED_OR_RETURN> 063 * @throws NullPointerException if parameter {@code 'other'} is null. 064 */ 065 default HexPredicate<A, B, C, D, E, F> or 066 (HexPredicate<? super A, ? super B, ? super C, ? super D, ? super E, ? super F> other) 067 { 068 if (other == null) 069 throw new NullPointerException("null has been passed to parameter 'other"); 070 071 return (A a, B b, C c, D d, E e, F f) -> 072 this.test(a, b, c, d, e, f) || other.test(a, b, c, d, e, f); 073 } 074}