001/*
002 * ============================================================================
003 * Copyright © 2002-2024 by Thomas Thrien.
004 * All Rights Reserved.
005 * ============================================================================
006 *
007 * Licensed to the public under the agreements of the GNU Lesser General Public
008 * License, version 3.0 (the "License"). You may obtain a copy of the License at
009 *
010 *      http://www.gnu.org/licenses/lgpl.html
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015 * License for the specific language governing permissions and limitations
016 * under the License.
017 */
018
019package org.tquadrat.foundation.function.tce;
020
021import static org.apiguardian.api.API.Status.STABLE;
022
023import org.apiguardian.api.API;
024import org.tquadrat.foundation.annotation.ClassVersion;
025
026/**
027 *  The TCE version of the interface
028 *  {@link java.util.function.Predicate}
029 *  that represents a predicate (boolean-valued function) of one argument. <br>
030 *  <br>Different from the method
031 *  {@link java.util.function.Predicate#test(Object) Predicate.test()}
032 *  the method
033 *  {@link #test(Object)}
034 *  of this interface declares to throw a
035 *  {@linkplain Exception checked exception}.<br>
036 *  <br>This is a functional interface whose functional method is
037 *  {@link #test(Object)}.
038 *
039 *  @param <T> The type of the input to the predicate.
040 *
041 *  @extauthor Thomas Thrien - thomas.thrien@tquadrat.org
042 *  @version $Id: TCEPredicate.java 1118 2024-03-15 16:14:15Z tquadrat $
043 *  @since 0.0.5
044 *
045 *  @UMLGraph.link
046 */
047@FunctionalInterface
048@ClassVersion( sourceVersion = "$Id: TCEPredicate.java 1118 2024-03-15 16:14:15Z tquadrat $" )
049@API( status = STABLE, since = "0.0.5" )
050public interface TCEPredicate<T>
051{
052        /*---------*\
053    ====** Methods **==========================================================
054        \*---------*/
055    /**
056     *  Evaluates this predicate on the given argument.
057     *
058     *  @param  arg The input argument
059     *  @return {@code true} if the input argument matches the predicate,
060     *      otherwise {@code false}.
061     *  @throws Exception   Something went wrong.
062     */
063    @SuppressWarnings( {"ProhibitedExceptionDeclared"} )
064    public boolean test( T arg ) throws Exception;
065}
066//  interface TCEPredicate
067
068/*
069 *  End of File
070 */