Class IngredientCollectionDiffManager<T,M>

java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.diff.IngredientCollectionDiffManager<T,M>
Type Parameters:
T - The instance type.
M - The matching condition parameter.

public class IngredientCollectionDiffManager<T,M> extends Object
Observes an IIngredientCollection to calculate diffs each time onChange(Iterator) is called.
  • Constructor Details

    • IngredientCollectionDiffManager

      public IngredientCollectionDiffManager(IngredientComponent<T,M> ingredientComponent)
  • Method Details

    • onChange

      public IngredientCollectionDiff<T,M> onChange(Iterator<T> newInstances)
      Calculates the diff between the given instances and the instances from the last call of this method. When this method has not been called before, it will emit a diff with all instances as additions.
      Parameters:
      newInstances - The new instances.
      Returns:
      The diff.
    • getInstancesCache

      public IngredientCollectionPrototypeMap<T,M> getInstancesCache()