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
-
Constructor Summary
ConstructorDescriptionIngredientSet
(IngredientComponent<T, M> component, Set<IngredientInstanceWrapper<T, M>> set) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if this collection contains the given instance under the given match conditions.int
Count the number of occurrences of the given instance under the given match conditions.boolean
Check if this collection equals the given object.An iterator over this collection over all occurrences of the given instance under the given match conditions.int
Remove all occurrences of the given instance under the given match conditions.Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionCollectionWrappedAdapter
add, clear, contains, getCollection, iterator, remove, size, wrap
Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter
getComponent, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, containsAll, containsAll, parallelStream, stream, toArray
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
getComponent, hashCode, isEmpty, size, toString
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionMutable
add, addAll, clear, remove, removeAll, removeAll
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientSet
spliterator
-
Constructor Details
-
IngredientSet
-
-
Method Details
-
removeAll
Description copied from interface:IIngredientCollectionMutable
Remove 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:
removeAll
in interfaceIIngredientCollectionMutable<T,
M> - Overrides:
removeAll
in classIngredientCollectionAdapter<T,
M> - Parameters:
instance
- An instance.matchCondition
- A match condition.- Returns:
- The number of removed instances.
-
contains
Description copied from interface:IIngredientCollection
Check 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:
contains
in interfaceIIngredientCollection<T,
M> - Overrides:
contains
in 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:IIngredientCollection
Count 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:
count
in interfaceIIngredientCollection<T,
M> - Overrides:
count
in 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:IIngredientCollection
An iterator over this collection over all occurrences of the given instance under the given match conditions.- Specified by:
iterator
in interfaceIIngredientCollection<T,
M> - Specified by:
iterator
in interfaceIIngredientCollectionLike<T,
M, T> - Overrides:
iterator
in 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:IIngredientCollectionLike
Check if this collection equals the given object.
-