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 Type
    Method
    Description
    void
    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.
    long
    getQuantity(T instance)
    Get the available quantity for the given instance.
    void
    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, toArray

    Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike

    equals, getComponent, hashCode, isEmpty, size, toString

    Methods inherited from interface java.lang.Iterable

    forEach, iterator
  • Method Details

    • getNonEmptyPositions

      Iterator<PartPos> getNonEmptyPositions()
      Returns:
      Get all positions that are not empty.
    • getPositions

      Iterator<PartPos> getPositions(T instance, M matchFlags)
      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

      void addPosition(T instance, PrioritizedPartPos pos)
      Indicate that the given position contains the given position.
      Parameters:
      instance - An instance.
      pos - A position.
    • removePosition

      void removePosition(T instance, PrioritizedPartPos pos)
      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

      long getQuantity(T instance)
      Get the available quantity for the given instance.
      Parameters:
      instance - An instance to match.
      Returns:
      The indexed quantity.