Class IngredientCollectionQuantitativeGrouper<T,M,I extends IIngredientList<T,M> & IIngredientCollectionMutable<T,M>>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionWrapper<T,M,I>
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionMutableWrapper<T,M,I>
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionQuantitativeGrouper<T,M,I>
- Type Parameters:
T- An instance type.M- The matching condition parameter.I- The inner collection type.
- All Implemented Interfaces:
Iterable<T>,IIngredientCollapsedCollection<T,,M> IIngredientCollapsedCollectionMutable<T,,M> IIngredientCollection<T,,M> IIngredientCollectionLike<T,,M, T> IIngredientCollectionMutable<T,M>
public class IngredientCollectionQuantitativeGrouper<T,M,I extends IIngredientList<T,M> & IIngredientCollectionMutable<T,M>>
extends IngredientCollectionMutableWrapper<T,M,I>
implements IIngredientCollapsedCollectionMutable<T,M>
A mutable ingredient collection that wraps over another mutable ingredient collection
and groups instances by stacking them using their primary quantifier.
Warning: The given collection must allow the storage of multiple equal instances such as an
IIngredientList.
Warning: If the given collection is mutated outside of this grouper,
behaviour becomes undefined.-
Constructor Summary
ConstructorsConstructorDescriptionIngredientCollectionQuantitativeGrouper(I innerCollection) IngredientCollectionQuantitativeGrouper(I innerCollection, boolean ignoreInnerCollectionEmptyCheck) -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the given instance to the collection.booleanAdd the given instances to the collection.booleanCheck if this collection contains the given instance.booleancontainsAll(Iterable<? extends T> instances) Check if this collection contains all the given instances.protected IngredientComponentCategoryType<T, M, ?> protected MlonggetQuantity(T instance) Get the quantity of the given instance.booleanRemove the given instance from the collection.intRemove all the given instances from the collection.intRemove all occurrences of the given instances under the given match conditions.intRemove all occurrences of the given instance under the given match conditions.voidsetQuantity(T instance, long quantity) Set the quantity of the given instance.Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionMutableWrapper
clearMethods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionWrapper
contains, containsAll, count, equals, getComponent, getInnerCollection, hashCode, isEmpty, iterator, iterator, size, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, containsAll, count, iterator, parallelStream, spliterator, stream, toArrayMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, size, toStringMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionMutable
clear
-
Constructor Details
-
IngredientCollectionQuantitativeGrouper
public IngredientCollectionQuantitativeGrouper(I innerCollection, boolean ignoreInnerCollectionEmptyCheck) -
IngredientCollectionQuantitativeGrouper
-
-
Method Details
-
getPrimaryQuantifier
-
getQuantifierlessMatchCondition
-
contains
Description copied from interface:IIngredientCollectionCheck if this collection contains the given instance. This instance will be compared based on the matcher from the ingredient component type.- Specified by:
containsin interfaceIIngredientCollection<T,M> - Overrides:
containsin classIngredientCollectionWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instance- An instance.- Returns:
- If this collection contains the given instance.
-
containsAll
Description copied from interface:IIngredientCollectionCheck if this collection contains all the given instances. The instances will be compared based on the matcher from the ingredient component type.- Specified by:
containsAllin interfaceIIngredientCollection<T,M> - Overrides:
containsAllin classIngredientCollectionWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instances- Instances.- Returns:
- If this collection contains all the given instances.
-
add
Description copied from interface:IIngredientCollectionMutableAdd the given instance to the collection.- Specified by:
addin interfaceIIngredientCollectionMutable<T,M> - Overrides:
addin classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instance- An instance.- Returns:
- If the collection was changed due to this addition. This can be false in the case of sets in which each instance can only exists once.
-
addAll
Description copied from interface:IIngredientCollectionMutableAdd the given instances to the collection.- Specified by:
addAllin interfaceIIngredientCollectionMutable<T,M> - Overrides:
addAllin classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instances- Instances.- Returns:
- If the collection was changed due to this addition. This can be false in the case of sets in which each instance can only exists once.
-
remove
Description copied from interface:IIngredientCollectionMutableRemove the given instance from the collection.- Specified by:
removein interfaceIIngredientCollectionMutable<T,M> - Overrides:
removein classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instance- An instance.- Returns:
- If the collection was changed due to this addition. Can be false if the collection did not contain the instance.
-
removeAll
Description copied from interface:IIngredientCollectionMutableRemove all occurrences of the given instance under the given match conditions. This instance will be compared based on the matcher from the ingredient component type using the given match condition.- Specified by:
removeAllin interfaceIIngredientCollectionMutable<T,M> - Overrides:
removeAllin classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- The number of removed instances.
-
removeAll
Description copied from interface:IIngredientCollectionMutableRemove all the given instances from the collection.- Specified by:
removeAllin interfaceIIngredientCollectionMutable<T,M> - Overrides:
removeAllin classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instances- Instances.- Returns:
- The number of removed instances.
-
removeAll
Description copied from interface:IIngredientCollectionMutableRemove all occurrences of the given instances under the given match conditions. The instances will be compared based on the matcher from the ingredient component type using the given match condition.- Specified by:
removeAllin interfaceIIngredientCollectionMutable<T,M> - Overrides:
removeAllin classIngredientCollectionMutableWrapper<T,M, I extends IIngredientList<T, M> & IIngredientCollectionMutable<T, M>> - Parameters:
instances- Instances.matchCondition- A match condition.- Returns:
- The number of removed instances.
-
getQuantity
Description copied from interface:IIngredientCollapsedCollectionMutableGet the quantity of the given instance.- Specified by:
getQuantityin interfaceIIngredientCollapsedCollectionMutable<T,M> - Parameters:
instance- An instance, its quantity will be ignored.- Returns:
- The quantity.
-
setQuantity
Description copied from interface:IIngredientCollapsedCollectionMutableSet the quantity of the given instance.- Specified by:
setQuantityin interfaceIIngredientCollapsedCollectionMutable<T,M> - Parameters:
instance- An instance, its quantity will be ignored.quantity- The new quantity to set.
-