Class IngredientCollectionCollectionWrappedAdapter<T,M,C extends Collection<IngredientInstanceWrapper<T,M>>>
java.lang.Object
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter<T,M>
org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionCollectionWrappedAdapter<T,M,C>
- Type Parameters:
T
- The instance type.M
- The matching condition parameter.C
- The type of collection that will contain the wrappers.
- All Implemented Interfaces:
Iterable<T>
,IIngredientCollection<T,
,M> IIngredientCollectionLike<T,
,M, T> IIngredientCollectionMutable<T,
M>
- Direct Known Subclasses:
IngredientSet
public abstract class IngredientCollectionCollectionWrappedAdapter<T,M,C extends Collection<IngredientInstanceWrapper<T,M>>>
extends IngredientCollectionAdapter<T,M>
implements IIngredientCollectionMutable<T,M>
An abstract collection that wraps instances in a
IngredientInstanceWrapper
and stores those in a regular Collection
.-
Constructor Summary
ConstructorDescriptionIngredientCollectionCollectionWrappedAdapter
(IngredientComponent<T, M> component, C collection) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add the given instance to the collection.void
clear()
Clears this collection of all instances.boolean
Check if this collection contains the given instance.protected C
iterator()
boolean
Remove the given instance from the collection.int
size()
protected IngredientInstanceWrapper<T,
M> Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter
contains, count, getComponent, hashCode, iterator, removeAll, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, containsAll, containsAll, count, iterator, parallelStream, spliterator, stream, toArray
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, toString
Methods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionMutable
addAll, removeAll, removeAll, removeAll
-
Constructor Details
-
IngredientCollectionCollectionWrappedAdapter
public IngredientCollectionCollectionWrappedAdapter(IngredientComponent<T, M> component, C collection)
-
-
Method Details
-
getCollection
-
wrap
-
add
Description copied from interface:IIngredientCollectionMutable
Add the given instance to the collection.- Specified by:
add
in interfaceIIngredientCollectionMutable<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.
-
remove
Description copied from interface:IIngredientCollectionMutable
Remove the given instance from the collection.- Specified by:
remove
in interfaceIIngredientCollectionMutable<T,
M> - Overrides:
remove
in classIngredientCollectionAdapter<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.
-
contains
Description copied from interface:IIngredientCollection
Check if this collection contains the given instance. This instance will be compared based on the matcher from the ingredient component type.- Specified by:
contains
in interfaceIIngredientCollection<T,
M> - Overrides:
contains
in classIngredientCollectionAdapter<T,
M> - Parameters:
instance
- An instance.- Returns:
- If this collection contains the given instance.
-
clear
public void clear()Description copied from interface:IIngredientCollectionMutable
Clears this collection of all instances.- Specified by:
clear
in interfaceIIngredientCollectionMutable<T,
M>
-
size
public int size()- Specified by:
size
in interfaceIIngredientCollectionLike<T,
M, C extends Collection<IngredientInstanceWrapper<T, M>>> - Returns:
- The number of instances contained in this collection.
-
iterator
-