Interface IIngredientPositionsIndex<T,M>
- Type Parameters:
T- An instance type.M- The matching condition parameter.
- All Superinterfaces:
org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection<T,,M> org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike<T,,M, T> Iterable<T>
- All Known Implementing Classes:
IngredientPositionsIndex,IngredientPositionsIndexEmpty
public interface IIngredientPositionsIndex<T,M>
extends org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection<T,M>
An index that maps ingredients to positions that contain that instance.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddPosition(T instance, PrioritizedPartPos pos) Indicate that the given position contains the given position.getPositions(T instance, M matchFlags) Get all positions that have an instance that contain the given instance.longgetQuantity(T instance) Get the available quantity for the given instance.voidremovePosition(T instance, PrioritizedPartPos pos) Indicate that the given instance is removed from the given position.Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, contains, containsAll, containsAll, count, iterator, parallelStream, spliterator, stream, toArrayMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, size, toString
-
Method Details
-
getNonEmptyPositions
- Returns:
- Get all positions that are not empty.
-
getPositions
Get all positions that have an instance that contain the given instance.- Parameters:
instance- An instance to match.matchFlags- Instance match conditions.- Returns:
- The positions.
-
addPosition
Indicate that the given position contains the given position.- Parameters:
instance- An instance.pos- A position.
-
removePosition
Indicate that the given instance is removed from the given position. This will not necessarily remove the given position, only if the total instance quantity becomes zero.- Parameters:
instance- An instance.pos- A position.
-
getQuantity
Get the available quantity for the given instance.- Parameters:
instance- An instance to match.- Returns:
- The indexed quantity.
-