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

monniasza.collects.indexar.Index 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.Set;

import com.google.common.collect.SetMultimap;

/**
 * An abstract implementation of the index
 * @author oskar
 * @param  type of the indexed objects
 * @param  type of the property
 * @param  type of the multimap. Allows to provide more sorted multimaps for optional sorting
 */
public interface Index> {
	/**
	 * Adds value to the index
	 * @param value value to add
	 * @return was the value added?
	 */
	public boolean add(T value);
	/**
	 * Removed the value from the index
	 * @param value value to remove
	 * @return was the value removed?
	 */
	public boolean remove(T value);
	/**
	 * Checks the value if it may be placed
	 * @param value value to check
	 * @return is value allowed to be placed
	 */
	public boolean test(T value);
	/**
	 * Clears the index
	 */
	public void clear();
	/**
	 * @return read-only representation of indexed values
	 */
	public M multimap();
	/**
	 * Tests if the property value is present
	 * @param value value to test
	 * @return is the property value present?
	 */
	public default boolean containsTo(U value) {
		Set set = multimap().get(value);
		return set != null && !set.isEmpty();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy