Package gaiasky.util
Class MyPools
- java.lang.Object
-
- gaiasky.util.MyPools
-
public class MyPools extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
free(java.lang.Object object)
Frees an object from thepool
.static void
freeAll(com.badlogic.gdx.utils.Array objects)
Frees the specified objects from thepool
.static void
freeAll(com.badlogic.gdx.utils.Array objects, boolean samePool)
Frees the specified objects from thepool
.static <T> com.badlogic.gdx.utils.Pool<T>
get(java.lang.Class<T> type)
Returns a new or existing pool for the specified type, stored in a Class toPool
map.static <T> com.badlogic.gdx.utils.Pool<T>
get(java.lang.Class<T> type, int max)
Returns a new or existing pool for the specified type, stored in a Class toPool
map.static <T> T
obtain(java.lang.Class<T> type)
Obtains an object from thepool
.static <T> void
set(java.lang.Class<T> type, com.badlogic.gdx.utils.Pool<T> pool)
Sets an existing pool for the specified type, stored in a Class toPool
map.
-
-
-
Method Detail
-
get
public static <T> com.badlogic.gdx.utils.Pool<T> get(java.lang.Class<T> type, int max)
Returns a new or existing pool for the specified type, stored in a Class toPool
map. Note the max size is ignored if this is not the first time this pool has been requested.
-
get
public static <T> com.badlogic.gdx.utils.Pool<T> get(java.lang.Class<T> type)
Returns a new or existing pool for the specified type, stored in a Class toPool
map.
-
set
public static <T> void set(java.lang.Class<T> type, com.badlogic.gdx.utils.Pool<T> pool)
Sets an existing pool for the specified type, stored in a Class toPool
map.
-
obtain
public static <T> T obtain(java.lang.Class<T> type)
Obtains an object from thepool
.
-
free
public static void free(java.lang.Object object)
Frees an object from thepool
.
-
freeAll
public static void freeAll(com.badlogic.gdx.utils.Array objects)
Frees the specified objects from thepool
. Null objects within the array are silently ignored. Objects don't need to be from the same pool.
-
freeAll
public static void freeAll(com.badlogic.gdx.utils.Array objects, boolean samePool)
Frees the specified objects from thepool
. Null objects within the array are silently ignored.- Parameters:
samePool
- If true, objects don't need to be from the same pool but the pool must be looked up for each object.
-
-