Package com.badlogic.gdx.maps
Class MapObjects
- java.lang.Object
-
- com.badlogic.gdx.maps.MapObjects
-
-
Constructor Summary
Constructors Constructor Description MapObjects()Creates an empty set of MapObject instances
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(MapObject object)MapObjectget(int index)MapObjectget(java.lang.String name)<T extends MapObject>
Array<T>getByType(java.lang.Class<T> type)<T extends MapObject>
Array<T>getByType(java.lang.Class<T> type, Array<T> fill)intgetCount()intgetIndex(MapObject object)Get the index of the object in the collection, or -1 if no such object exists.intgetIndex(java.lang.String name)Get the index of the object having the specified name, or -1 if no such object exists.java.util.Iterator<MapObject>iterator()voidremove(int index)voidremove(MapObject object)
-
-
-
Method Detail
-
get
public MapObject get(int index)
- Parameters:
index-- Returns:
- the MapObject at the specified index
-
get
public MapObject get(java.lang.String name)
- Parameters:
name-- Returns:
- the first object having the specified name, if one exists, otherwise null
-
getIndex
public int getIndex(java.lang.String name)
Get the index of the object having the specified name, or -1 if no such object exists.
-
getIndex
public int getIndex(MapObject object)
Get the index of the object in the collection, or -1 if no such object exists.
-
getCount
public int getCount()
- Returns:
- number of objects in the collection
-
add
public void add(MapObject object)
- Parameters:
object- instance to be added to the collection
-
remove
public void remove(int index)
- Parameters:
index- removes MapObject instance at index
-
remove
public void remove(MapObject object)
- Parameters:
object- instance to be removed
-
getByType
public <T extends MapObject> Array<T> getByType(java.lang.Class<T> type)
- Parameters:
type- class of the objects we want to retrieve- Returns:
- array filled with all the objects in the collection matching type
-
getByType
public <T extends MapObject> Array<T> getByType(java.lang.Class<T> type, Array<T> fill)
- Parameters:
type- class of the objects we want to retrievefill- collection to put the returned objects in- Returns:
- array filled with all the objects in the collection matching type
-
-