Class IngredientSet<T,M>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter<T,M>
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionCollectionWrappedAdapter<T, M, Set<IngredientInstanceWrapper<T,M>>>
org.cyclops.cyclopscore.ingredient.collection.IngredientSet<T,M>
- Type Parameters:
T- The instance type.M- The matching condition parameter.
- All Implemented Interfaces:
Iterable<T>, IIngredientCollection<T,M>, IIngredientCollectionLike<T, M, T>, IIngredientCollectionMutable<T, M>, IIngredientSet<T, M>, IIngredientSetMutable<T, M>
- Direct Known Subclasses:
IngredientHashSet, IngredientTreeSet
public class IngredientSet<T,M>
extends IngredientCollectionCollectionWrappedAdapter<T, M, Set<IngredientInstanceWrapper<T,M>>>
implements IIngredientSetMutable<T,M>
A mutable ingredient collection using set semantics.
This means that each instances can only be present once in the collection based on its equals method.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionIngredientSet(IngredientComponent<T, M> component, Set<IngredientInstanceWrapper<T, M>> set) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if this collection contains the given instance 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.An iterator over this collection over all occurrences of the given instance under the given match conditions.intRemove all occurrences of the given instance under the given match conditions.Methods inherited from class IngredientCollectionCollectionWrappedAdapter
add, clear, contains, getCollection, iterator, remove, size, wrapMethods inherited from class IngredientCollectionAdapter
getComponent, hashCode, toStringMethods inherited from interface IIngredientCollection
contains, containsAll, containsAll, parallelStream, stream, toArrayMethods inherited from interface IIngredientCollectionLike
getComponent, hashCode, isEmpty, size, toStringMethods inherited from interface IIngredientCollectionMutable
add, addAll, clear, remove, removeAll, removeAllMethods inherited from interface IIngredientSet
spliterator
-
Constructor Details
-
IngredientSet
-
-
Method Details
-
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 classIngredientCollectionAdapter<T,M> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- The number of removed instances.
-
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> - Overrides:
containsin classIngredientCollectionAdapter<T,M> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- If this collection contains the given instance 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> - Overrides:
countin classIngredientCollectionAdapter<T,M> - Parameters:
instance- An instance.matchCondition- A match condition.- Returns:
- The number of occurrences of the given instance under the given match conditions.
-
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, T> - Overrides:
iteratorin classIngredientCollectionAdapter<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.
-
equals
Description copied from interface:IIngredientCollectionLikeCheck if this collection equals the given object.
-