Class IngredientCollectionWrapper<T,M,W extends IIngredientCollection<T,M>>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionWrapper<T,M,W>
- Type Parameters:
T- An instance type.M- The matching condition parameter.
- All Implemented Interfaces:
Iterable<T>,IIngredientCollection<T,,M> IIngredientCollectionLike<T,M, T>
- Direct Known Subclasses:
IngredientCollectionMutableWrapper
public class IngredientCollectionWrapper<T,M,W extends IIngredientCollection<T,M>>
extends Object
implements IIngredientCollection<T,M>
An ingredient collection that wraps over another ingredient collection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if this collection contains the given instance.booleanCheck if this collection contains the given instance under the given match conditions.booleancontainsAll(Iterable<? extends T> instances) Check if this collection contains all the given instances.booleancontainsAll(Iterable<? extends T> instances, M matchCondition) Check if this collection contains all the given instances under the given match conditions.intCount the number of occurrences of the given instance under the given match conditions.booleanCheck if this collection equals the given object.protected WinthashCode()booleanisEmpty()iterator()An iterator over this collection over all occurrences of the given instance under the given match conditions.intsize()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
parallelStream, spliterator, stream, toArray
-
Constructor Details
-
IngredientCollectionWrapper
-
-
Method Details
-
getInnerCollection
-
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> - Parameters:
instance- An instance.- Returns:
- If this collection contains the given instance.
-
contains
Description copied from interface:IIngredientCollectionCheck if this collection contains 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:
containsin interfaceIIngredientCollection<T,M> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- If this collection contains the given instance under the given match conditions.
-
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> - Parameters:
instances- Instances.- Returns:
- If this collection contains all the given instances.
-
containsAll
Description copied from interface:IIngredientCollectionCheck if this collection contains all 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:
containsAllin interfaceIIngredientCollection<T,M> - Parameters:
instances- Instances.matchCondition- A match condition.- Returns:
- If this collection contains all the given instances under the given match conditions.
-
count
Description copied from interface:IIngredientCollectionCount the number of 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:
countin interfaceIIngredientCollection<T,M> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- The number of occurrences of the given instance under the given match conditions.
-
getComponent
- Specified by:
getComponentin interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Returns:
- The ingredient component type of which this collection contains instances.
-
size
public int size()- Specified by:
sizein interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Returns:
- The number of instances contained in this collection.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Returns:
- If the are no instances in this collection.
-
iterator
Description copied from interface:IIngredientCollectionAn iterator over this collection over all occurrences of the given instance under the given match conditions.- Specified by:
iteratorin interfaceIIngredientCollection<T,M> - Specified by:
iteratorin interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- An iterator over this collection over all occurrences of the given instance under the given match conditions.
-
iterator
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Overrides:
hashCodein classObject- Returns:
- A hashcode of this collection, based on the hash codes, provided by the component type.
-
equals
Description copied from interface:IIngredientCollectionLikeCheck if this collection equals the given object.- Specified by:
equalsin interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Overrides:
equalsin classObject- Parameters:
obj- An object.- Returns:
- True if the given object is an ingredient collection of the same type, component type and contains the same instances.
-
toString
- Specified by:
toStringin interfaceIIngredientCollectionLike<T,M, W extends IIngredientCollection<T, M>> - Overrides:
toStringin classObject- Returns:
- A string representation of this collection, provided by the component type.
-