Package gaiasky.util.gdx.contrib.utils
Class ItemsManager<T extends com.badlogic.gdx.utils.Disposable>
java.lang.Object
gaiasky.util.gdx.contrib.utils.ItemsManager<T>
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,java.lang.Iterable<T>
public class ItemsManager<T extends com.badlogic.gdx.utils.Disposable>
extends java.lang.Object
implements java.lang.Iterable<T>, com.badlogic.gdx.utils.Disposable
-
Field Summary
Fields Modifier and Type Field Description protected com.badlogic.gdx.utils.Array<java.lang.Boolean>owned -
Constructor Summary
Constructors Constructor Description ItemsManager() -
Method Summary
Modifier and Type Method Description voidadd(T item)Add an item to the manager and transfer ownership to itvoidadd(T item, boolean own)Add an item to the manager, if own is true the manager will manage the resource's lifecycleintcount()Returns the number of items managed by this instancevoiddispose()Tget(int index)Returns the item at the specified indexjava.util.Iterator<T>iterator()voidremove(T item)Removes a previously added resourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
owned
protected final com.badlogic.gdx.utils.Array<java.lang.Boolean> owned
-
-
Constructor Details
-
ItemsManager
public ItemsManager()
-
-
Method Details
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
add
Add an item to the manager, if own is true the manager will manage the resource's lifecycle -
add
Add an item to the manager and transfer ownership to it -
get
Returns the item at the specified index -
count
public int count()Returns the number of items managed by this instance -
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<T extends com.badlogic.gdx.utils.Disposable>
-
remove
Removes a previously added resource
-