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

monniasza.collects.indexar.Guard Maven / Gradle / Ivy

Go to download

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 multimap() {
		return Collects.emptyMultimap();
	}

	
	@Override
	public void clear() {
		//does nothing
	}

	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy