com.github.ruediste.salta.matchers.Matcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of salta-core Show documentation
Show all versions of salta-core Show documentation
Core of the Salta Framework. Provides most of the infrastructure, but no API
package com.github.ruediste.salta.matchers;
import com.github.ruediste.salta.matchers.Matchers.AndMatcher;
import com.github.ruediste.salta.matchers.Matchers.OrMatcher;
/**
* Returns {@code true} or {@code false} for a given input.
*
* @author crazybob@google.com (Bob Lee)
*/
public interface Matcher {
/**
* Returns {@code true} if this matches {@code t}, {@code false} otherwise.
*/
boolean matches(T t);
/**
* Returns a new matcher which returns {@code true} if both this and the
* given matcher return {@code true}.
*/
default Matcher and(Matcher other) {
return new AndMatcher(this, other);
}
/**
* Returns a new matcher which returns {@code true} if either this or the
* given matcher return {@code true}.
*/
default Matcher or(Matcher other) {
return new OrMatcher(this, other);
}
}