APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.maps

public Class MapObjects

extends Object
implements Iterable<MapObject>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.util.Iterator, com.badlogic.gdx.utils.Array, com.badlogic.gdx.utils.reflect.ClassReflection

@brief Collection of MapObject instances

Field Summary

Modifier and TypeField and Description
private Array<MapObject>

Constructor Summary

AccessConstructor and Description
public
MapObjects()

Creates an empty set of MapObject instances

Method Summary

Modifier and TypeMethod and Description
public void
add(MapObject
instance to be added to the collection
object
)

public MapObject
get(int index)

Returns: the MapObject at the specified index

public MapObject
get(String name)

Returns: the first object having the specified name, if one exists, otherwise null

public <T extends MapObject> Array<T>
getByType(Class<T>
class of the objects we want to retrieve
type
)

Returns: array filled with all the objects in the collection matching type

public <T extends MapObject> Array<T>
getByType(Class<T>
class of the objects we want to retrieve
type
,
Array<T>
collection to put the returned objects in
fill
)

Returns: array filled with all the objects in the collection matching type

public int
getCount()

Returns: number of objects in the collection

public int
getIndex(String name)

Get the index of the object having the specified name, or -1 if no such object exists.

public int
getIndex(MapObject object)

Get the index of the object in the collection, or -1 if no such object exists.

public Iterator<MapObject>

Returns:

iterator for the objects within the collection
iterator
()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public void
remove(int
removes MapObject instance at index
index
)

public void
remove(MapObject
instance to be removed
object
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

objectsback to summary
private Array<MapObject> objects

Constructor Detail

MapObjectsback to summary
public MapObjects()

Creates an empty set of MapObject instances

Method Detail

addback to summary
public void add(MapObject object)
Parameters
object:MapObject

instance to be added to the collection

getback to summary
public MapObject get(int index)
Returns:MapObject

the MapObject at the specified index

getback to summary
public MapObject get(String name)
Returns:MapObject

the first object having the specified name, if one exists, otherwise null

getByTypeback to summary
public <T extends MapObject> Array<T> getByType(Class<T> type)
Parameters
type:Class<T>

class of the objects we want to retrieve

Returns:Array<T>

array filled with all the objects in the collection matching type

getByTypeback to summary
public <T extends MapObject> Array<T> getByType(Class<T> type, Array<T> fill)
Parameters
type:Class<T>

class of the objects we want to retrieve

fill:Array<T>

collection to put the returned objects in

Returns:Array<T>

array filled with all the objects in the collection matching type

getCountback to summary
public int getCount()
Returns:int

number of objects in the collection

getIndexback to summary
public int getIndex(String name)

Get the index of the object having the specified name, or -1 if no such object exists.

getIndexback to summary
public int getIndex(MapObject object)

Get the index of the object in the collection, or -1 if no such object exists.

iteratorback to summary
public Iterator<MapObject> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<MapObject>

iterator for the objects within the collection

Annotations
@Override
removeback to summary
public void remove(int index)
Parameters
index:int

removes MapObject instance at index

removeback to summary
public void remove(MapObject object)
Parameters
object:MapObject

instance to be removed