001package Torello.Java.Function;
002
003/**
004 * <CODE>IntFloatPredicate Documentation.</CODE><BR /><BR />
005 * <EMBED CLASS="external-html" DATA-FILE-ID=TWOPRIMPRED>
006 * <EMBED CLASS="globalDefs" DATA-Type1=int DATA-Type2=float>
007 */
008@FunctionalInterface
009public interface IntFloatPredicate
010{
011    /**
012     * Evaluates this predicate on the given arguments.
013     * @param i The integer (first) argument to the predicate.
014     * @param f The float (second) argument to the predicate.
015     * @return <B>TRUE</B> if the input arguments match this predicate, and <B>FALSE</B> otherwise.
016     */
017    public boolean test(int i, float f);
018
019    /**
020     * <EMBED CLASS="external-html" DATA-FILE-ID="PREDANDMETH">
021     * @param other A predicate that will be logically-AND'ed with this predicate
022     * @return <EMBED CLASS="external-html" DATA-FILE-ID="PREDANDRET">
023     * @throws NullPointerException if parameter {@code 'other'} is null.
024     */
025    default IntFloatPredicate and(IntFloatPredicate other)
026    {
027        if (other == null)
028            throw new NullPointerException("null has been passed to parameter 'other");
029
030        return (int i, float f) -> this.test(i, f) && other.test(i, f);
031    }
032
033    /**
034     * <EMBED CLASS="external-html" DATA-FILE-ID="PREDNEGMETH">
035     * @return <EMBED CLASS="external-html" DATA-FILE-ID="PREDNEGRET">
036     */
037    default IntFloatPredicate negate()
038    { return (int i, float f) -> ! this.test(i, f); }
039
040    /**
041     * <EMBED CLASS="external-html" DATA-FILE-ID="PREDORMETH">
042     * @param other a predicate that will be logically-ORed with this predicate
043     * @return <EMBED CLASS="external-html" DATA-FILE-ID="PREDORRET">
044     * @throws NullPointerException if parameter {@code 'other'} is null.
045     */
046    default IntFloatPredicate or(IntFloatPredicate other)
047    {
048        if (other == null)
049            throw new NullPointerException("null has been passed to parameter 'other");
050
051        return (int i, float f) -> this.test(i, f) || other.test(i, f);
052    }
053
054}