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