Class MapObjects

  • All Implemented Interfaces:
    java.lang.Iterable<MapObject>

    public class MapObjects
    extends java.lang.Object
    implements java.lang.Iterable<MapObject>
    • Constructor Summary

      Constructors 
      Constructor Description
      MapObjects()
      Creates an empty set of MapObject instances
    • Constructor Detail

      • MapObjects

        public MapObjects()
        Creates an empty set of MapObject instances
    • 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 MapObjectArray<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 MapObjectArray<T> getByType​(java.lang.Class<T> type,
                                                        Array<T> fill)
        Parameters:
        type - class of the objects we want to retrieve
        fill - collection to put the returned objects in
        Returns:
        array filled with all the objects in the collection matching type
      • iterator

        public java.util.Iterator<MapObject> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<MapObject>
        Returns:
        iterator for the objects within the collection