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
ConstructorsConstructorDescriptionIngredientCollectionCollectionWrappedAdapter(IngredientComponent<T, M> component, C collection) -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the given instance to the collection.voidclear()Clears this collection of all instances.booleanCheck if this collection contains the given instance.protected Citerator()booleanRemove the given instance from the collection.intsize()protected IngredientInstanceWrapper<T, M> Methods inherited from class org.cyclops.cyclopscore.ingredient.collection.IngredientCollectionAdapter
contains, count, getComponent, hashCode, iterator, removeAll, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollection
contains, containsAll, containsAll, count, iterator, parallelStream, spliterator, stream, toArrayMethods inherited from interface org.cyclops.cyclopscore.ingredient.collection.IIngredientCollectionLike
equals, getComponent, hashCode, isEmpty, toStringMethods 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:IIngredientCollectionMutableAdd the given instance to the collection.- Specified by:
addin 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:IIngredientCollectionMutableRemove the given instance from the collection.- Specified by:
removein interfaceIIngredientCollectionMutable<T,M> - Overrides:
removein 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: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 classIngredientCollectionAdapter<T,M> - Parameters:
instance- An instance.- Returns:
- If this collection contains the given instance.
-
clear
public void clear()Description copied from interface:IIngredientCollectionMutableClears this collection of all instances.- Specified by:
clearin interfaceIIngredientCollectionMutable<T,M>
-
size
public int size()- Specified by:
sizein interfaceIIngredientCollectionLike<T,M, C extends Collection<IngredientInstanceWrapper<T, M>>> - Returns:
- The number of instances contained in this collection.
-
iterator
-