Interface IIngredientCollectionLikeSingleClassifiedTrait<T,M,I,C,L extends IIngredientCollectionLike<T,M,I>>

Type Parameters:
T - The instance type.
M - The matching condition parameter.
I - The type that can be iterated over. This is typically just T.
C - A classifier type.
L - The collection-like type that is being used to store classified partitions.
All Superinterfaces:
IIngredientCollectionLike<T,M,I>, Iterable<I>
All Known Implementing Classes:
IngredientCollectionSingleClassified, IngredientCollectionSingleClassifiedCollapsed, IngredientMapSingleClassified

public interface IIngredientCollectionLikeSingleClassifiedTrait<T,M,I,C,L extends IIngredientCollectionLike<T,M,I>> extends IIngredientCollectionLike<T,M,I>
An interface-based trait for collections that have a single-level classification, which classify instances in smaller collections based on a category type.
  • Method Details

    • getCategoryType

      IngredientComponentCategoryType<T,M,C> getCategoryType()
      Returns:
      The category type using which this collection classifies.
    • appliesToClassifier

      default boolean appliesToClassifier(M matchCondition)
      Check if this collection is able to classify the given match condition.
      Parameters:
      matchCondition - A match condition.
      Returns:
      If the match condition can be classified.
    • getClassifier

      default C getClassifier(T instance)
      Get the classifier for the given instance.
      Parameters:
      instance - An instance.
      Returns:
      The instance classifier.
    • createEmptyCollection

      L createEmptyCollection()
      Returns:
      A new collection-like for internal classification usage.
    • getOrCreateClassifiedCollection

      default L getOrCreateClassifiedCollection(C classifier)
      Get the existing collection-like for the given classifier, or create a new one if it does not exist yet.
      Parameters:
      classifier - A classifier.
      Returns:
      An existing or new collection-like.
    • getInstance

      T getInstance(I iterableInstance)
      Get the instance from the given iterator instance. This is used internally for iteration purposes. This typically is just a no-op.
      Parameters:
      iterableInstance - An iterator instance.
      Returns:
      An instance.
    • getClassifiedCollections

      Map<C,L> getClassifiedCollections()
      Returns:
      A mapping of all internal classified collections.
    • setSize

      void setSize(int size)
      Set the internal size value. This should not be called outside of internal usage, such as custom iterators that can mutate this collection.
      Parameters:
      size - The new size.