All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ruediste.salta.matchers.Matcher Maven / Gradle / Ivy

Go to download

Core of the Salta Framework. Provides most of the infrastructure, but no API

There is a newer version: 1.1
Show newest version
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 [email protected] (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);

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy