![JAR search and dependency download from the Maven repository](/logo.png)
monniasza.collects.indexar.Guard Maven / Gradle / Ivy
/**
*
*/
package monniasza.collects.indexar;
import java.util.function.Predicate;
import com.google.common.collect.SetMultimap;
import mmb.NN;
import monniasza.collects.Collects;
/**
* Imposes restrictions on contents of a database. Does not index values.
* The predicate may throw exceptions if desired
* @author oskar
* @param type of values
*/
public class Guard implements Index> {
/** Condition required for new objects in the database*/
@NN public final Predicate pred;
/**
* Creates a guard
* @param pred condition required for new objects in the database
*/
public Guard(Predicate pred) {
this.pred = pred;
}
@Override
public boolean add(T value) {
return false;
}
@Override
public boolean remove(Object value) {
return false;
}
@Override
public boolean test(T value) {
return pred.test(value);
}
@Override
public SetMultimap
© 2015 - 2025 Weber Informatics LLC | Privacy Policy