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, Iterable<T>

public class ItemsManager<T extends com.badlogic.gdx.utils.Disposable> extends Object implements Iterable<T>, com.badlogic.gdx.utils.Disposable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final com.badlogic.gdx.utils.Array<Boolean>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T item)
    Add an item to the manager and transfer ownership to it
    void
    add(T item, boolean own)
    Add an item to the manager, if own is true the manager will manage the resource's lifecycle
    int
    Returns the number of items managed by this instance
    void
     
    get(int index)
    Returns the item at the specified index
     
    void
    remove(T item)
    Removes a previously added resource

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • owned

      protected final com.badlogic.gdx.utils.Array<Boolean> owned
  • Constructor Details

    • ItemsManager

      public ItemsManager()
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • add

      public void add(T item, boolean own)
      Add an item to the manager, if own is true the manager will manage the resource's lifecycle
    • add

      public void add(T item)
      Add an item to the manager and transfer ownership to it
    • get

      public T get(int index)
      Returns the item at the specified index
    • count

      public int count()
      Returns the number of items managed by this instance
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends com.badlogic.gdx.utils.Disposable>
    • remove

      public void remove(T item)
      Removes a previously added resource