monniasza.collects.indexar.Guard Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world.
THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<
The newest version!
/**
*
*/
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