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.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
IIngredientCollectionLikeSingleClassifiedTrait.ClassifiedIterator<T,
M, I, C, L extends IIngredientCollectionLike<T, M, I>> An iterator over a single-level classification that allows removals.static class
IIngredientCollectionLikeSingleClassifiedTrait.ClassifiedIteratorDelegated<T,
M, C, I, L extends IIngredientCollectionLike<T, M, I>> An iterator over classified collection of a single-level classification that allows removals. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
appliesToClassifier
(M matchCondition) Check if this collection is able to classify the given match condition.default C
getClassifier
(T instance) Get the classifier for the given instance.getInstance
(I iterableInstance) Get the instance from the given iterator instance.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.void
setSize
(int size) Set the internal size value.Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, iterator, size, toString
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getCategoryType
IngredientComponentCategoryType<T,M, getCategoryType()C> - Returns:
- The category type using which this collection classifies.
-
appliesToClassifier
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
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
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
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
- 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.
-