package jalview.util.matcher; import java.util.function.Function; /** * An interface to describe a set of one or more key-value match conditions, * where all conditions are combined with either AND or OR * * @author gmcarstairs * */ public interface KeyedMatcherSetI { /** * Answers true if the value provided for this matcher's key passes this * matcher's match condition * * @param valueProvider * @return */ boolean matches(Function valueProvider); /** * Answers a new object that matches the logical AND of this and m * * @param m * @return * @throws IllegalStateException * if an attempt is made to AND to existing OR-ed conditions */ KeyedMatcherSetI and(KeyedMatcherI m); /** * Answers true if any second condition is AND-ed with this one, false if it * is OR-ed * * @return */ boolean isAnded(); /** * Answers a new object that matches the logical OR of this and m * * @param m * @return * @throws IllegalStateException * if an attempt is made to OR to existing AND-ed conditions */ KeyedMatcherSetI or(KeyedMatcherI m); /** * Answers an iterator over the combined match conditions * * @return */ Iterable getMatchers(); /** * Answers true if this object contains no conditions * * @return */ boolean isEmpty(); }